Jump to content
Sign in to follow this  
johnytapia

Plik xml dla sklepy24.pl

Recommended Posts

Gdyby ktoś potrzebował pliczek xml dla sklepy24.pl to ten mały skrypcik się przyda.
Kodzik na bazie http://www.prestashop.com/forums/viewthread/71267/#312325

wystarczy go odpalić w przeglądarce: http://adrestwojegosklepu/skrypcik.php i zapisać wynik jako xml

Kod:

<?php

$shopUrl = 'adres www sklepu';
$langHr = 4;
include(dirname(__FILE__).'/config/config.inc.php');
require_once(dirname(__FILE__).'/init.php');

error_reporting(0);

$p=Product::getProducts(4, 0, 0, 'id_product', 'desc', false); // number 4 is id of language in database
$products=Product::getProductsProperties(4, $p); // number 4 is id of language in database

header("Content-Type: text/xml");
echo <?xml version="1.0" encoding="utf-8"?>

';

foreach ($products as $row) {
if ($row['active']){

$img=Product::getCover($row['id_product']);
echo '

'.str_replace("&", "&", $row['name']).'
'.$shopUrl.''.$row['link'].'
'.str_replace("&", "&", $row['manufacturer_name']).'
'.($row['price']).'

'.str_replace("&", "&", $row['category']).'

'.$shopUrl.'/img/p/'.$row['id_product'].'-'.$img['id_image'].'.jpg
'.str_replace("&", "and", strip_tags($row['description_short'])).'
';

}
}
echo '';
?>

Share this post


Link to post
Share on other sites

Widzę, że jest jeden drobny problem z kategoriami. Mianowicie wygląda na to, że skrypt wyciąga ps_category_lang>link_rewrite zamiast nazwy kategorii z ps_category_lang>name.
Wie ktoś jak to rozwiązać ??

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More