Ask Your Question

Revision history [back]

Do I need to fetch individual Class from Resource "Property" than same class from Resource "Media" to get respective photos of individual row?

I wrote this code

$query = "(L_StatusCatID=1)";

$results = $rets->Search('Property', 'RE_1', $query, ['Limit' => 9999999]);

foreach ($results as $r) { print_r($r->toArray());

$firstID = $r['L_ListingID'];

$photos = $rets->GetObject("Property", "Photo", $firstID,"*","1");

foreach ($photos as $photo) { // $photo = (array) $photo; // var_dump($photo->getContent());die; //var_dump($photo->getContentId()); $listing = $photo->getContentId(); $number = $photo->getObjectId(); $contentText = $photo->getContent(); $success = false; if (preg_match('/replytext="SUCCESS"/i', $contentText, $match)){ // print "Match found!"; $success = true; }

    if ($success == true) {
            echo "{$listing}'s #{$number} photo is at {$photo->getLocation()}\n";
    }
    else {
            echo "({$listing}-{$number}): {$photo['ReplyCode']} = {$photo['ReplyText']}\n";
    }

}

Do I need to fetch individual Class from Resource "Property" than same class from Resource "Media" to get respective photos of individual row?

I wrote this code

$query = "(L_StatusCatID=1)";

$results = $rets->Search('Property', 'RE_1', $query, ['Limit' => 9999999]);

foreach ($results as $r) { print_r($r->toArray());

$firstID = $r['L_ListingID'];

$photos = $rets->GetObject("Property", "Photo", $firstID,"*","1");

foreach ($photos as $photo) { // $photo = (array) $photo; // var_dump($photo->getContent());die; //var_dump($photo->getContentId()); $listing = $photo->getContentId(); $number = $photo->getObjectId(); $contentText = $photo->getContent(); $success = false; if (preg_match('/replytext="SUCCESS"/i', $contentText, $match)){ // print "Match found!"; $success = true; }

    if ($success == true) {
            echo "{$listing}'s #{$number} photo is at {$photo->getLocation()}\n";
    }
    else {
            echo "({$listing}-{$number}): {$photo['ReplyCode']} = {$photo['ReplyText']}\n";
    }

}

If I am working right then please let me know should I use Property Classes as main category and L_Type_ as subcategory for individual class. I saw too many L_Type_ in a single class and they are helpful in categorization of property please info me if someone has updated PHRETS 1.8 and API implementation to it's latest version.