Helo dear people,
I need some help with piece of code that generates XML
This all works as is:
include(dirname(__FILE__).'/config/config.inc.php');
require_once(dirname(__FILE__).'/init.php');
error_reporting(0);
$p=Product::getProducts(7, 0, 0, 'id_product', 'desc', false);
$products=Product::getProductsProperties(7, $p);
header("Content-Type: text/xml\n\n");
//print "Content-type: text/html\n\n";
echo '<?xml version="1.0" encoding="utf-8"?>
<Catalog>';
foreach ($products as $row) {
if ($row['active']){
$img=Product::getCover($row['id_product']);
echo '
<products>
<code>'.str_replace("&", "&", $row['id_product']).'</code>
<name>'.str_replace("&", "&", $row['name']).'</name>
<descr>'.str_replace("&", "and", strip_tags($row['description_short'])).'</descr>
<price>'.($row['price']*1).'</price>
<quantity>'.str_replace("&", "&", $row['quantity']).'</quantity>
<categ>'.str_replace("&", "&", $row['category']).'</categ>
<link>http://www.xxxxx.hr'.$row['link'].'</link>
<img>http://www.xxxxx.hr/xxxxx/'.$shopUrl.'img/p/'.$row['id_product'].'-'.$img['id_image'].'.jpg</img>
</products>';
}
}
echo '</Catalog>';
?>code]
But now i need to hide quantity if its larger that 5 pieces.
So that all quantity that is >= equal or larger of 5 si shown in XML as 5.
Can anyone help me out with this!?
:'(
BR
Vixus