Jump to content

XML - all product images in description.


irl

Recommended Posts

If work with third parties websites (auction?), may desire to list all images assigned to a product under description. Below is what would need to add/change in your php according to your needs. In my case they resize and had to include again 1st image in the description between.
Declare new tags e.g. for
private $condition = "New";

foreach ($Products AS $Product)
           {
             if ($Product['active'] and $Product['price']!=0) {
               $image = Image::getImages(intval($this->_cookie->id_lang), $Product['id_product']);
               $expire_date = date('Y-m-d', strtotime("28 days"));
               $Price = Product::getPriceStatic(floatval($Product['id_product']));
               $Category = Product::categoryName($Product['id_category_default']);

   $count=count($image);
   $mystr = "";
   for($i=0;$i<$count;$i++){
   $mystr .= "".'http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__. "img/p/" . $image[$i]['id_product'] . "-" . $image[$i]['id_image'] ."-large.jpg" . " ";}                
   $item = "\n"

   . ""."Code".strtolower(Language::getIsoById($this->_cookie->id_lang))."-".$Product['id_product']."\n"
   . "<Title><![CDATA[".xml_convert($Product['name'])."]]></Title>\n"
   . "<![CDATA[".xml_convert($Category)."]]>\n"
   . "".round($Price)."\n"
   . "1\n"
   . "New\n"
   . "Miami\n"
   . "Ask"
   . "<![CDATA[".'http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'img/p/'.$image[0]['id_product'].'-'.$image[0]['id_image'].'-large.jpg'."]]>\n"
   ."<![CDATA[" .strip_tags($Product['description_short'])." - " .strip_tags($Product['description'])."
".$mystr."]]>\n"
   . "\n\n";
   $this->_addToFeed($item);
             }
           }

Link to comment
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...