Jump to content

Chyba exportu na zbozi.cz


Landsman

Recommended Posts

Dobrý večer,

musím sem pro radu. Nějakou dobu zkouším export na zbozi.cz. Používal jsem kódy, které jsem nalezl zde na fóru. U jednoho zlobila cena, nějaký to nevzalo vůbec. Až jsem narazil na jeden hezký. Cena se zobrazuje dobře, název taky OK až na obrázek. Ten to nechce načíst. Dále v exportu vidím již neaktivní zboží (vyprodané a asi i smazané). Na obchodu běží Prestashop verze 1.3.1.1.

URL na export: http://jdem.cz/kgab9
Ukázka chyby: toto je produkt: http://jdem.cz/kgae2 a zde je výpis ze zbozi.cz: http://jdem.cz/kgaf4 (bez obrazku)
Kód exportu:

<?php
$shopUrl = 'http://www.domena.cz';      // adresa shopu včetně http://
include(dirname(__FILE__).'/config/config.inc.php'); // cesta ke config souboru
include(dirname(__FILE__).'/init.php');
error_reporting(0);
$p=Product::getProducts(4, 0, 0, 'id_product', 'desc', false); // ceština je v databázi zapsaná pod číslem 3
$products=Product::getProductsProperties(4, $p); // ceština je v databázi zapsaná pod číslem 3

header("Content-Type: text/xml");
echo '<?xml version="1.0" encoding="utf-8"?>
';
foreach ($products as $row) {
$img=Product::getCover($row['id_product']);
echo '

'.str_replace("&", "&", $row['name']).'
'.str_replace("&", "&",strip_tags($row['description_short'])).'
'.$row['link'].'
'.$shopUrl.'/img/p/'.$row['id_product'].'-'.$img['id_image'].'.jpg
'.($row['price']*1).'
0
';
}
echo '';
?>



Budu vděčný za rady a pomoc.

Link to comment
Share on other sites

  • 3 weeks later...

Stále nevyřešeno, můžete na to někdo prosím mrknout?

<?php           

 $shopUrl = 'lt-obleceni.cz'; 
 $noShowCategory = "0";
 $cfgFile = './config/settings.inc.php';
 if (!file_exists($cfgFile)) {           
   die('Chyba při spouštění skriptu ...');
 }

 require_once($cfgFile);              
 $db = @MySQL_Connect(_DB_SERVER_, _DB_USER_, _DB_PASSWD_); 
 if (!$db) {                                                
   die('Nemohu se spojit s databazi.');                     
 }                                                            

 MySQL_Select_DB(_DB_NAME_, $db);                           
 MySQL_Query("SET NAMES 'utf8'");                           
 $prefix = "ps_";                                           
 header("Content-Type: text/xml");                          
 echo '<?xml version="1.0" encoding="utf-8"?>';              

?>                                                           

<?php  

 echo "\n\n";
 $res = MySQL_Query("SELECT  p.id_product,
                             p.quantity,
                             p.price,
                             p.reduction_price,
                             p.reduction_percent,
                             p.reduction_from,
                             p.reduction_to,  
                             p.active,
                             pl.name,
                             pl.description_short,
                             pl.link_rewrite,
                             i.id_image
                     FROM {$prefix}product p
                     JOIN {$prefix}product_lang pl USING(id_product)
                     JOIN {$prefix}image i USING(id_product)
                     WHERE i.cover = 1 AND p.active = 1 AND NOT (SELECT COUNT(*)
                     FROM {$prefix}category_product cp
                     WHERE cp.id_product = p.id_product
                     AND cp.id_category IN($noShowCategory))
                     ORDER BY p.id_product", $db); 

 $currentDate = date('Y-m-d');

 $skipDuplicate = 1;

 while ($row = MySQL_Fetch_Assoc($res)) {    
   if($skipDuplicate != 1) {
     $desc = strip_tags(html_entity_decode($row['description_short'], ENT_COMPAT, 'utf-8'));
     if ($result['reduction_from'] == $result['reduction_to'] || ($result['reduction_from'] <= $currentDate && $currentDate <= $result['reduction_to'])) {
       if ($row['reduction_price'] && $row['reduction_price'] > 0) {
         if ($row['reduction_price'] >= $row['price']) {
           $reduction = $row['price'];
         } else {
           $reduction = $row['reduction_price'];
         }
       } elseif ($row['reduction_percent'] && $row['reduction_percent'] > 0) {
         if ($row['reduction_percent'] >= 100) {
           $reduction = $row['price'];
         } else {                 
           $reduction = $row['price'] * $row['reduction_percent'] / 100;
         }
       }
     }    
     echo "\n";
     echo "\t" . mb_substr($row['name'], 0, 64, 'utf-8') ."\n"; 
     echo "\t" . mb_substr($desc, 0, 512, 'utf-8') . "\n";
     echo "\thttp://" . $shopUrl . "/" . $row['id_product'] . "-" . $row['link_rewrite'] . ".html\n";     
     echo "\tnew\n";
     echo "\tihned\n";
     echo "\thttp://" . $shopUrl . "/img/p/" .$row['id_product'] . "-" . $row['id_image'] . "-large.jpg\n";
     echo "\t" . round((($row['price'] - $reduction)*0.8),2) . "\n";
     echo "\t" . round((($row['price'] - $reduction)*1),2) . "\n";
     echo "\t0,20\n";
     echo "\n";
     $skipDuplicate = 1;
   } else {
     $skipDuplicate = 0;
   }
   $reduction = NULL;
   $row['reduction_percent'] = NULL;
   $row['reduction_price'] = NULL;
 }

 echo "\n";

?>



http://lt-obleceni.cz/xml_zbozi_cz.php Nevypisuje vše a zboží si nerozumí s cenou..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...