Jump to content

Plik xml dla sklepy24.pl


johnytapia

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 '';
?>

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...