Jump to content

PS 1.5.6 XML Feed problem


Recommended Posts

Hi.

I am trying make an XML feed for price comparison portals. However the execution of the code gets timed-out every time. I used the same code a while ago on 1.5.3 (different hosting provider), and it worked like a charm. Can anyone help please? The problem seems to be with the $kategorie generation (I need a full category path).

 

Thanks!

<?php $shopUrl='http://www.shop.domain'; 
include(dirname(__FILE__).'/config/config.inc.php'); 
include(dirname(__FILE__).'/init.php');
error_reporting(0);
$p=Product::getProducts(7,0,0,'id_product','desc', false);   // Language code
$products=Product::getProductsProperties(7,$p);  // Language code

header("Content-Type:text/xml");
echo'<?xml version="1.0" encoding="utf-8"?>
<SHOP>';
foreach ($products as $row) {
 
$id_image = Product::getCover($row['id_product']);
$image = new Image($id_image['id_image']);
$imgurl = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg"; 
    
$kategorie=array();
$category = new Category(intval($row['id_category_default']), intval(3));

while ($category->id <> 1) {
    $kategorie[]=$category->name;
    $category = new Category(intval($category->id_parent), intval(3));

}

<SHOPITEM>
<CODE>'.$row['id_product'].'</CODE>
<NAME>'.htmlspecialchars($row['name']).'</NAME>
<DESCRIPTION>'.strip_tags(htmlspecialchars($row['description_short'])).'</DESCRIPTION>
<PRODUCT_URL>'.htmlspecialchars($row['link']).'</PRODUCT_URL>
<IMGURL>'.htmlspecialchars($imgurl).'</IMGURL>
<PRICE>'.($row['price']*1).'</PRICE>
<MANUFACTURER>'.htmlspecialchars($row['manufacturer_name']).'</MANUFACTURER>
<SHIPPING>3,90</SHIPPING>
<CATEGORY>'.implode(' > ',array_reverse($kategorie)).'</CATEGORY>
<AVAILABILITY>3 days</AVAILABILITY>
</SHOPITEM>';}echo'
</SHOP>';?>
Link to comment
Share on other sites

×
×
  • Create New...