This commit is contained in:
2025-04-01 00:38:54 +02:00
parent d4d4c0c09d
commit 87da06293a
22351 changed files with 5168854 additions and 7538 deletions

View File

@@ -0,0 +1,122 @@
<?php
class mod_pricewars_ceneo extends Pricewars {
protected function generateXML(){
$link = new Link();
$xml = new DOMDocument();
//$Products = Product::getProducts(Language::getIdByIso("pl"), 0, NULL, 'name', 'ASC');
$Products = $this->getProducts();
$Categories = $this->_getCategoryTree();
if($Products&&$Categories){
$xml->loadXML('<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pasaz:Envelope SYSTEM "loadOffers.dtd">
<pasaz:Envelope xmlns:pasaz="http://schemas.xmlsoap.org/soap/envelope/">
<pasaz:Body>
<loadOffers xmlns="urn:ExportB2B">
<offers/>
</loadOffers>
</pasaz:Body>
</pasaz:Envelope>');
$offers = $xml->getElementsByTagName('offers');
$offers = $offers->item(0);
foreach ($Products AS $Product){
$offer = $xml->createElement('offer');
$offers->appendChild($offer);
$id = $xml->createElement('id',$Product['id_product']);
$offer->appendChild($id);
//to avoid entity warning
//$productName = str_replace("&", "&amp;", $Product['name']);
//again. one below is better ;)
$name = $xml->createElement('name', self::htmlentities($Product['name']));
$offer->appendChild($name);
$price = $xml->createElement('price',$this-> getTaxedPrice($Product));
$offer->appendChild($price);
$url = $xml->createElement('url',htmlspecialchars($link->getProductLink($Product['id_product'], $Product['link_rewrite'])));
$offer->appendChild($url);
$categoryId = $xml->createElement('categoryId',$Categories[$Product['id_category_default']]['path']);
$offer->appendChild($categoryId);
$description_cdata = $xml->createCDATASection(strip_tags(html_entity_decode($Product['description_short'],ENT_COMPAT,"UTF-8"),"<br><li><p><ul><tr>"));
$description = $xml->createElement('description');
$description->appendChild($description_cdata);
$offer->appendChild($description);
$image = Image::getCover($Product['id_product']);
if ($image['id_image'])
//$img_url = $this->getShopHost().'img/p/'.$image['id_product'].'-'.$image['id_image'].'-large.jpg';
$img_url = $this->getImageLink($Product['link_rewrite'], $image['id_product'].'-'.$image['id_image'],$this->getXmlImageType());
else
$img_url = "";
$image = $xml->createElement('image',$img_url);
$offer->appendChild($image);
$attributes = $xml->createElement('attributes');
$offer->appendChild($attributes);
$attribute = $xml->createElement('attribute');
$attributes->appendChild($attribute);
$name = $xml->createElement('name','Producent');
$attribute->appendChild($name);
$value = $xml->createElement('value',$Product['manufacturer_name']);
$attribute->appendChild($value);
/// ean13
$attribute = $xml->createElement('attribute');
$attributes->appendChild($attribute);
$name = $xml->createElement('name', 'EAN');
$attribute->appendChild($name);
$value = $xml->createElement('value', $Product["ean13"]);
$attribute->appendChild($value);
/// eof ean13;
/// ean13
$attribute = $xml->createElement('attribute');
$attributes->appendChild($attribute);
$name = $xml->createElement('name', 'Kod producenta');
$attribute->appendChild($name);
$value = $xml->createElement('value', $Product["reference"]);
$attribute->appendChild($value);
/// eof ean13;
/// hurtownie ACTION S.A. - Dla sklepów zintegrowanych z programem Cennik-Offline
if(isset($Product["id_cennik_offline"])) {
$attribute = $xml->createElement('attribute');
$attributes->appendChild($attribute);
$name = $xml->createElement('name','Kod hurtowni');
$attribute->appendChild($name);
$value = $xml->createElement('value',$Product["id_cennik_offline"]);
$attribute->appendChild($value);
}
/// eof hurtownie;
$availability = $xml->createElement('availability', $Product['quantity']);
$offer->appendChild($availability);
}
}
return $xml;
}
}

View File

@@ -0,0 +1,181 @@
<?php
class mod_pricewars_ceneoNew extends Pricewars {
protected function generateXML(){
$link = new Link();
$xml = new DOMDocument();
$Products = $this->getProducts();
$Categories = $this->_getCategoryTree();
// Generate cool Manufacturers array :)
$Manufacturers_temp = Manufacturer::getManufacturers();
$Manufacturers = array();
foreach ($Manufacturers_temp as $m)
$Manufacturers[$m['id_manufacturer']] = $m['name'];
// OMg... heeeeeavy, time to free up some space... not that Domdocument is havy as it is.... Smarty would be better...
unset($Manufacturers_temp); /// it wont do a shit anyway... just looks nice. Give me Garbarge collectors! give php5.3 everywhere <3 !!
//if($Products && $Categories && $Manufacturers){
if($Products && $Categories){
$xml->loadXML('<?xml version="1.0" encoding="utf-8"?>
<offers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1">
<group name="other">
</group>
</offers>
');
$group = $xml->getElementsByTagName('group');
$group = $group->item(0);
foreach ($Products AS $Product){
if(!isset($this->mappings[$Product['id_category_default']]) OR !isset($this->CeneoCategories[$this->mappings[$Product['id_category_default']]])){
$this->doDebug('<span style="color: grey;">'.$Product['name'].'</span> należy do niezmapowanej kategorii');
continue;
}
$availability = $Product['quantity'] > 0 ? 1 : 0;
$o = $xml->createElement('o');
$id = $xml->createAttribute ('id');
$id->value = $Product['id_product'];
$o->appendChild($id);
$url = $xml->createAttribute ('url');
$url->value = htmlspecialchars($link->getProductLink($Product['id_product'], $Product['link_rewrite']));
$o->appendChild($url);
$price = $xml->createAttribute ('price');
$price->value = $this-> getTaxedPrice($Product);
$o->appendChild($price);
$avail = $xml->createAttribute ('avail');
$avail->value = 1;
$o->appendChild($avail);
$set = $xml->createAttribute ('set');
$set->value = '0';
$o->appendChild($set);
$weight = $xml->createAttribute ('weight');
$Product['weight'] = floatval(str_replace(',', '.', $Product['weight']));
$weight->value = ($Product['weight'] ? $Product['weight']:'0.0');
$o->appendChild($weight);
$stock = $xml->createAttribute ('stock');
$stock->value = 'small';
$o->appendChild($stock);
$name = $xml->createElement('name');
$o->appendChild($name);
$cdata_name = $xml->createCDATASection(self::htmlentities($Product['name']));
$name->appendChild($cdata_name);
// description
$desc = $xml->createElement('desc');
$o->appendChild($desc);
$Product['description_short'] = trim($Product['description_short']);
$cdata_desc = $xml->createCDATASection(self::htmlentities(empty($Product['description_short']) ? $Product['description'] : $Product['description_short']));
$desc->appendChild($cdata_desc);
// category
$cat = $xml->createElement('cat');
$o->appendChild($cat);
$cdata_cat = $xml->createCDATASection($this->CeneoCategories[$this->mappings[$Product['id_category_default']]]);
$cat->appendChild($cdata_cat);
/// Start atrybutów
$attrs = $xml->createElement('attrs');
$o->appendChild($attrs);
// Atrybuty New
$a = $xml->createElement('a');
$attrs->appendChild($a);
$cdata_a = $xml->createCDATASection( isset($Manufacturers[$Product['id_manufacturer']]) ? $Manufacturers[$Product['id_manufacturer']] : NULL);
$a->appendChild($cdata_a);
$name = $xml->createAttribute ('name');
$a->appendChild($name);
$name->value = 'Producent';
// Atrybuty New
$a = $xml->createElement('a');
$attrs->appendChild($a);
$cdata_a = $xml->createCDATASection($Product["reference"]);
$a->appendChild($cdata_a);
$name = $xml->createAttribute ('name');
$a->appendChild($name);
$name->value = 'Kod_producenta';
// Atrybuty New :: EAN
$a = $xml->createElement('a');
$attrs->appendChild($a);
$cdata_a = $xml->createCDATASection($Product["ean13"]);
$a->appendChild($cdata_a);
$name = $xml->createAttribute ('name');
$a->appendChild($name);
$name->value = 'EAN';
// Atrybuty New :: Dla hurtowni ACTION S.A. W sklepach zintegrowanych z prgramem Cennik-offline.
if(isset($Product["id_cennik_offline"])) {
$a = $xml->createElement('a');
$attrs->appendChild($a);
$cdata_a = $xml->createCDATASection($Product["id_cennik_offline"]);
$a->appendChild($cdata_a);
$name = $xml->createAttribute ('name');
$a->appendChild($name);
$name->value = 'Kod hurtowni';
}
// images
$image = Image::getCover($Product['id_product']);
if ($image['id_image']) {
//$img_url = ''.$this->getShopHost().'img/p/'.$image['id_product'].'-'.$image['id_image'].'-large.jpg';
$img_url = $this->getImageLink($Product['link_rewrite'], $image['id_product'].'-'.$image['id_image'],$this->getXmlImageType());
$imgs = $xml->createElement('imgs');
$o->appendChild($imgs);
$main = $xml->createElement('main');
$imgs->appendChild($main);
$url = $xml->createAttribute ('url');
$main->appendChild($url);
$url->value = $img_url;
}
// eof::images
$group->appendChild($o);
//echo $xml->saveXML(); die();
}
}
return $xml;
}
}

View File

@@ -0,0 +1,65 @@
<?php
class mod_pricewars_nokaut extends Pricewars {
protected function generateXML(){
$link = new Link();
$xml = new DOMDocument();
//$Products = Product::getProductsFor(Language::getIdByIso("pl"), 0, NULL, 'name', 'ASC');
$Products = $this->getProducts();
$Categories = $this->_getCategoryTree();
if($Products&&$Categories){
$xml->loadXML('<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE nokaut SYSTEM "http://www.nokaut.pl/integracja/nokaut.dtd">
<nokaut>
<offers/>
</nokaut>');
$offers = $xml->getElementsByTagName('offers');
$offers = $offers->item(0);
foreach ($Products AS $Product){
$offer = $xml->createElement('offer');
$offers->appendChild($offer);
$id = $xml->createElement('id',$Product['id_product']);
$offer->appendChild($id);
$name = $xml->createElement('name', self::htmlentities($Product['name']));
$offer->appendChild($name);
$description_cdata = $xml->createCDATASection(strip_tags(html_entity_decode($Product['description_short'],ENT_COMPAT,"UTF-8"),"<br><li><p><ul><tr>"));
$description = $xml->createElement('description');
$description->appendChild($description_cdata);
$offer->appendChild($description);
$url = $xml->createElement('url',htmlspecialchars($link->getProductLink($Product['id_product'], $Product['link_rewrite'])));
$offer->appendChild($url);
$image = Image::getCover($Product['id_product']);
//var_dump($image);
if ($image['id_image'])
//$img_url = ''.$this->getShopHost().'img/p/'.$image['id_product'].'-'.$image['id_image'].'-large.jpg';
$img_url = $this->getImageLink($Product['link_rewrite'], $image['id_product'].'-'.$image['id_image'],$this->getXmlImageType());
else
$img_url = "";
$image = $xml->createElement('image',$img_url);
$offer->appendChild($image);
$price = $xml->createElement('price',$this-> getTaxedPrice($Product));
$offer->appendChild($price);
$category = $xml->createElement('category',$Categories[$Product['id_category_default']]['path']);
$offer->appendChild($category);
$producer = $xml->createElement('producer',$Product['manufacturer_name']);
$offer->appendChild($producer);
}
}
return $xml;
}
}

View File

@@ -0,0 +1,89 @@
<?php
class mod_pricewars_oferciak extends Pricewars {
protected function generateXML(){
$link = new Link();
$xml = new DOMDocument();
//$Products = Product::getProducts(Language::getIdByIso("pl"), 0, NULL, 'name', 'ASC');
$Products = $this->getProducts();
$Categories = $this->_getCategoryTree();
if($Products&&$Categories){
$xml->loadXML('<?xml version="1.0" encoding="UTF-8" ?>
<oferciak/>
');
$offers = $xml->getElementsByTagName('oferciak');
$offers = $offers->item(0);
foreach ($Products AS $Product){
$offer = $xml->createElement('offer');
$offers->appendChild($offer);
$id = $xml->createElement('id',$Product['id_product']);
$offer->appendChild($id);
$name_cdata = $xml->createCDATASection(self::htmlentities($Product['name']));
$name = $xml->createElement('name');
$name->appendChild($name_cdata);
$offer->appendChild($name);
$description_cdata = $xml->createCDATASection(strip_tags(!empty($Product['description_short']) ? $Product['description_short'] : $Product['description'] ));
$description = $xml->createElement('description');
$description->appendChild($description_cdata);
$offer->appendChild($description);
$category = $xml->createElement('category',$Categories[$Product['id_category_default']]['path']);
$offer->appendChild($category);
$producer = $xml->createElement('producer',$Product['manufacturer_name']);
$offer->appendChild($producer);
$url = $xml->createElement('url', htmlspecialchars($link->getProductLink($Product['id_product'], $Product['link_rewrite'])));
$offer->appendChild($url);
$image = Image::getCover($Product['id_product']);
if ($image['id_image'])
//$img_url = ''.$this->getShopHost().'img/p/'.$image['id_product'].'-'.$image['id_image'].'-large.jpg';
$img_url = $this->getImageLink($Product['link_rewrite'], $image['id_product'].'-'.$image['id_image'],$this->getXmlImageType());
else
$img_url = "";
$image = $xml->createElement('image',$img_url);
$offer->appendChild($image);
$price = $xml->createElement('price',Product::getPriceStatic($Product['id_product']));
$offer->appendChild($price);
}
}
return $xml;
}
}
/* <?xml version="1.0" encoding="UTF-8"?>
<oferciak>
<offer>
<id><![CDATA[1]]></id>
<name><![CDATA[GeForce 8800GT]]></name>
<description><![CDATA[Zaawansowana karta graficzna]]></description>
<category><![CDATA[Komputery/Karty graficzne/Nvidia/Seria 8800]]></category>
<producer><![CDATA[Nvidia]]></producer>
<url><![CDATA[http://www.przykladowy-sklep.pl/oferta.php?id=1]]></url>
<image><![CDATA[http://www.przykladowy-sklep.pl/zdjecia/produkt_1.jpg]]></image>
<price>510.00</price>
</offer>
<offer>
<id><![CDATA[2]]></id>
<name><![CDATA[HP DeskJet D4260]]></name>
<description><![CDATA[DeskJet D4260 jest przeznaczona dla użytkowników domowych i małych firm]]></description>
<category><![CDATA[Komputery/Drukarki/Atramentowe/HP]]></category>
<producer><![CDATA[HP]]></producer>
<url><![CDATA[http://www.przykladowy-sklep.pl/oferta.php?id=2]]></url>
<image><![CDATA[http://www.przykladowy-sklep.pl/zdjecia/produkt_2.jpg]]></image>
<price>340.00</price>
</offer>
</oferciak>
*/

View File

@@ -0,0 +1,78 @@
<?php
class mod_pricewars_okazje extends Pricewars {
protected function generateXML(){
$link = new Link();
$xml = new DOMDocument();
//$Products = Product::getProducts(Language::getIdByIso("pl"), 0, NULL, 'name', 'ASC');
$Products = $this->getProducts();
$Categories = $this->_getCategoryTree();
if($Products&&$Categories){
$xml->loadXML('<?xml version="1.0" encoding="UTF-8" ?>
<okazje>
<offers/>
</okazje>');
$offers = $xml->getElementsByTagName('offers');
$offers = $offers->item(0);
foreach ($Products AS $Product){
$offer = $xml->createElement('offer');
$offers->appendChild($offer);
$id = $xml->createElement('id',$Product['id_product']);
$offer->appendChild($id);
$name = $xml->createElement('name',self::htmlentities($Product['name']));
$offer->appendChild($name);
$description_cdata = $xml->createCDATASection(strip_tags(html_entity_decode($Product['description_short'],ENT_COMPAT,"UTF-8"),"<br><li><p><ul><tr>"));
$description = $xml->createElement('description');
$description->appendChild($description_cdata);
$offer->appendChild($description);
$category = $xml->createElement('category',$Categories[$Product['id_category_default']]['path']);
$offer->appendChild($category);
//$price = $xml->createElement('price',$this-> getTaxedPrice($Product));
//$offer->appendChild($price);
if (Product::isDiscounted($Product['id_product']))
{
$price = $xml->createElement('price',Product::getPriceStatic($Product['id_product']));
$offer->appendChild($price);
$price = $xml->createElement('old_price',Product::getPriceStatic($Product['id_product'], true, NULL, 2, NULL, false, false));
$offer->appendChild($price);
/// oh watever... niech juz ttaj bedzie ten product::getPriceStatic :)
}
else {
$price = $xml->createElement('price',Product::getPriceStatic($Product['id_product']));
$offer->appendChild($price);
}
$url = $xml->createElement('url', htmlspecialchars($link->getProductLink($Product['id_product'], $Product['link_rewrite'])));
$offer->appendChild($url);
$producer = $xml->createElement('producer',$Product['manufacturer_name']);
$offer->appendChild($producer);
$image = Image::getCover($Product['id_product']);
if ($image['id_image'])
//$img_url = ''.$this->getShopHost().'img/p/'.$image['id_product'].'-'.$image['id_image'].'-large.jpg';
$img_url = $this->getImageLink($Product['link_rewrite'], $image['id_product'].'-'.$image['id_image'],$this->getXmlImageType());
else
$img_url = "";
$image = $xml->createElement('image',$img_url);
$offer->appendChild($image);
}
}
return $xml;
}
}

View File

@@ -0,0 +1,69 @@
<?php
class mod_pricewars_radar extends Pricewars {
protected function generateXML(){
$link = new Link();
$xml = new DOMDocument();
//$Products = Product::getProducts(Language::getIdByIso("pl"), 0, NULL, 'name', 'ASC');
$Products = $this->getProducts();
$Categories = $this->_getCategoryTree();
if($Products&&$Categories){
$xml->loadXML('<?xml version="1.0" encoding="UTF-8"?>
<radar wersja="1.0">
<oferta/>
</radar>');
$oferta = $xml->getElementsByTagName('oferta');
$oferta = $oferta->item(0);
foreach ($Products AS $Product){
$produkt = $xml->createElement('produkt');
$oferta->appendChild($produkt);
$grupa1 = $xml->createElement('grupa1');
$produkt->appendChild($grupa1);
$nazwa = $xml->createElement('nazwa',self::htmlentities($Product['name']));
$grupa1->appendChild($nazwa);
$producent = $xml->createElement('producent',$Product['manufacturer_name']);
$grupa1->appendChild($producent);
$description_cdata = $xml->createCDATASection(strip_tags(html_entity_decode($Product['description_short'],ENT_COMPAT,"UTF-8")));
$opis = $xml->createElement('opis');
$opis->appendChild($description_cdata);
$grupa1->appendChild($opis);
$id = $xml->createElement('id',$Product['id_product']);
$grupa1->appendChild($id);
$url = $xml->createElement('url',htmlspecialchars($link->getProductLink($Product['id_product'], $Product['link_rewrite'])));
$grupa1->appendChild($url);
$image = Image::getCover($Product['id_product']);
if ($image['id_image'])
//$img_url = ''.$this->getShopHost().'img/p/'.$image['id_product'].'-'.$image['id_image'].'-large.jpg';
$img_url = $this->getImageLink($Product['link_rewrite'], $image['id_product'].'-'.$image['id_image'],$this->getXmlImageType());
else
$img_url = "";
$foto = $xml->createElement('foto',$img_url);
$grupa1->appendChild($foto);
$kategoria = $xml->createElement('kategoria',$Categories[$Product['id_category_default']]['path']);
$grupa1->appendChild($kategoria);
$cena = $xml->createElement('cena',$this-> getTaxedPrice($Product));
$grupa1->appendChild($cena);
}
}
return $xml;
}
}

View File

@@ -0,0 +1,128 @@
<?php
class mod_pricewars_skapiec extends Pricewars {
protected function generateXML(){
$link = new Link();
$xml = new DOMDocument();
//$Products = Product::getProductsForSkapiec(Language::getIdByIso("pl"), 0, NULL, 'name', 'ASC');
$Products = $this->getProducts();
$Categories = $this->_getCategoryTree();
if($Products&&$Categories){
$xml->loadXML('<?xml version="1.0" encoding="UTF-8"?>
<xmldata>
<version>12</version>
<header/>
<category/>
<data/>
</xmldata>');
$header = $xml->getElementsByTagName('header');
$header = $header->item(0);
$name = $xml->createElement('name',Configuration::get('PS_SHOP_NAME'));
$header->appendChild($name);
/*
// Wersja 12 już tego nie używa, przynajmniej nie było tego w dokumentacji dostarczonej.
$shopid = $xml->createElement('shopid',Configuration::get('PRICEWARS_SKAPIEC_SHOP_ID') ? Configuration::get('PRICEWARS_SKAPIEC_SHOP_ID') : "");
$header->appendChild($shopid);
*/
$www = $xml->createElement('www',$this->getShopHost());
$header->appendChild($www);
$time = $xml->createElement('time',date('Y-m-d'));
$header->appendChild($time);
$category = $xml->getElementsByTagName('category');
$category = $category->item(0);
foreach($Categories as $catitem){
$cat = $xml->createElement('catitem');
$category->appendChild($cat);
$catid = $xml->createElement('catid',$catitem['id_category']);
$cat->appendChild($catid);
$catname = $xml->createElement('catname',$Categories[$catitem['id_category']]['path']);
$cat->appendChild($catname);
}
$data = $xml->getElementsByTagName('data');
$data = $data->item(0);
foreach ($Products AS $Product){
$item = $xml->createElement('item');
$data->appendChild($item);
$compid = $xml->createElement('compid',$Product['id_product']);
$item->appendChild($compid);
$vendor = $xml->createElement('vendor',$Product['manufacturer_name']);
$item->appendChild($vendor);
$name = $xml->createElement('name', self::htmlentities($Product['name']));
$item->appendChild($name);
$price = $xml->createElement('price',$this-> getTaxedPrice($Product));
$item->appendChild($price);
/*
<partnr>APED:2030-53PLVFY</partnr>
- <!-- tzw PartNumber czyli unikalny kod nadany przez producenta danemu towarowi, pole nie jest obowiazkowe; wartość może byc umieszczona takze w znaczniku NAME
-->
*/
$catid = $xml->createElement('catid',$Product['id_category_default']);
$item->appendChild($catid);
// description
$desc = $xml->createElement('desclong');
$item->appendChild($desc);
$cdata_desc = $xml->createCDATASection(self::htmlentities($Product['description_short']));
$desc->appendChild($cdata_desc);
/*
<desclong>pelny opis towaru w sklepie</desclong>
pole nie jest obowiazkowe
<availability>2</availability>
ilosc dni od zlozenia zamowienia do czasu wyslania towaru, (-1 towar na zamowienie), pole nie jest obowiazkowe
*/
$ean = $xml->createElement('ean',$Product['ean13']);
$item->appendChild($ean);
$image = Image::getCover($Product['id_product']);
if ($image['id_image']) {
$img_url = $this->getImageLink($Product['link_rewrite'], $image['id_product'].'-'.$image['id_image'],$this->getXmlImageType());
$foto = $xml->createElement('foto',$img_url);
$item->appendChild($foto);
}
/*
<ean>1234567890123</ean>
kod EAN/ISBN produktu (pole obowiazkowe dla ksiazek oraz plyt z muzyka)
<url>http://www.sklep.pl/0123abc.php</url>
URL do widoku produktu, pole nie jest obowiazkowe, obecnie url generowany jest dynamicznie na podstawie <compid>
*/
$url = $xml->createElement('url',htmlspecialchars($link->getProductLink($Product['id_product'], $Product['link_rewrite'])));
$item->appendChild($url);
$actionid = isset($Product['id_cennik_offline']) ? $xml->createElement('action',$Product['id_cennik_offline']) : $xml->createElement('action', NULL);
$item->appendChild( $actionid );
}
}
return $xml;
}
}

View File

@@ -0,0 +1,79 @@
<?php
class mod_pricewars_sklepy24 extends Pricewars {
protected function generateXML(){
$link = new Link();
$xml = new DOMDocument();
//$Products = Product::getProducts(Language::getIdByIso("pl"), 0, NULL, 'name', 'ASC');
$Products = $this->getProducts();
$Categories = $this->_getCategoryTree();
if($Products&&$Categories){
$xml->loadXML('<?xml version="1.0" encoding="UTF-8"?>
<products
xmlns="http://www.sklepy24.pl"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sklepy24.pl http://www.sklepy24.pl/formats/products.xsd"
date="' . date('Y-m-d') . '">
</products>');
$offers = $xml->getElementsByTagName('products');
$offers = $offers->item(0);
foreach ($Products AS $Product){
$offer = $xml->createElement('product');
$offers->appendChild($offer);
$id = $xml->createAttribute('id');
$offer->appendChild($id);
$id_text = $xml->createTextNode($Product['id_product']);
$id->appendChild($id_text);
$name_cdata = $xml->createCDATASection(strip_tags(html_entity_decode($Product['name'],ENT_COMPAT,"UTF-8"),"<br><li><p><ul><tr>"));
$name = $xml->createElement('name');
$name-> appendChild($name_cdata);
$offer-> appendChild($name);
$url = $xml->createElement('url',htmlspecialchars($link->getProductLink($Product['id_product'], $Product['link_rewrite'])));
$offer->appendChild($url);
if ($Product['manufacturer_name']==NULL)
$brand = $xml->createElement('brand'," ");
else
$brand = $xml->createElement('brand',$Product['manufacturer_name']);
$offer->appendChild($brand);
$categories = $xml->createElement('categories');
$offer->appendChild($categories);
$category = $xml->createElement('category',$Categories[$Product['id_category_default']]['path']);
$categories->appendChild($category);
$image = Image::getCover($Product['id_product']);
if ($image['id_image'])
$img_url = $this->getImageLink($Product['link_rewrite'], $image['id_product'].'-'.$image['id_image'],$this->getXmlImageType());
else
$img_url = "";
$photo = $xml->createElement('photo',$img_url);
$offer->appendChild($photo);
$description_cdata = $xml->createCDATASection(strip_tags(html_entity_decode($Product['description_short'],ENT_COMPAT,"UTF-8"),"<br><li><p><ul><tr>"));
$description = $xml->createElement('description');
$description->appendChild($description_cdata);
$offer->appendChild($description);
$price = $xml->createElement('price', $this->getTaxedPrice($Product));
$offer->appendChild($price);
}
}
return $xml;
}
}

View File

@@ -0,0 +1,65 @@
<?php
class mod_pricewars_szoker extends Pricewars {
protected function generateXML(){
$link = new Link();
$xml = new DOMDocument();
//$Products = Product::getProducts(Language::getIdByIso("pl"), 0, NULL, 'name', 'ASC');
$Products = $this->getProducts();
$Categories = $this->_getCategoryTree('&gt;');
if($Products&&$Categories){
$xml->loadXML('<?xml version="1.0" encoding="UTF-8"?>
<offers />
');
$offers = $xml->getElementsByTagName('offers');
$offers = $offers->item(0);
foreach ($Products AS $Product){
$offer = $xml->createElement('offer');
$offers->appendChild($offer);
$id = $xml->createElement('id',(int) $Product['id_product']);
$offer->appendChild($id);
$name_cdata = $xml->createCDATASection(self::htmlentities($Product['name']));
$name = $xml->createElement('name');
$name->appendChild($name_cdata);
$offer->appendChild($name);
$description_cdata = $xml->createCDATASection(strip_tags(!empty($Product['description_short']) ? $Product['description_short'] : $Product['description'] ));
$description = $xml->createElement('description');
$description->appendChild($description_cdata);
$offer->appendChild($description);
$category = $xml->createElement('category',$Categories[$Product['id_category_default']]['path']);
$offer->appendChild($category);
$producer = $xml->createElement('producer',$Product['manufacturer_name']);
$offer->appendChild($producer);
$url = $xml->createElement('url', htmlspecialchars($link->getProductLink($Product['id_product'], $Product['link_rewrite'])));
$offer->appendChild($url);
$image = Image::getCover($Product['id_product']);
if ($image['id_image'])
//$img_url = ''.$this->getShopHost().'img/p/'.$image['id_product'].'-'.$image['id_image'].'-large.jpg';
$img_url = $this->getImageLink($Product['link_rewrite'], $image['id_product'].'-'.$image['id_image'],$this->getXmlImageType());
else
$img_url = "";
$image = $xml->createElement('image',$img_url);
$offer->appendChild($image);
$price = $xml->createElement('price',Product::getPriceStatic($Product['id_product']));
$offer->appendChild($price);
}
}
return $xml;
}
}

View File

@@ -0,0 +1,65 @@
<?php
class mod_pricewars_zakupy_onet extends Pricewars {
protected function generateXML(){
$link = new Link();
$xml = new DOMDocument();
//$Products = Product::getProducts(Language::getIdByIso("pl"), 0, NULL, 'name', 'ASC');
$Products = $this->getProducts();
$Categories = $this->_getCategoryTree();
if($Products&&$Categories){
$xml->loadXML('<?xml version="1.0" encoding="UTF-8" ?>
<oferty aktualizacja="N" xmlns="http://www.zakupy.onet.pl/walidacja/oferty-partnerzy.xsd">
</oferty>');
$offers = $xml->getElementsByTagName('oferty');
$offers = $offers->item(0);
foreach ($Products AS $Product){
$offer = $xml->createElement('oferta');
$offers->appendChild($offer);
$id = $xml->createElement('identyfikator',$Product['id_product']);
$offer->appendChild($id);
$name = $xml->createElement('nazwa',self::htmlentities($Product['name']));
$offer->appendChild($name);
$description_cdata = $xml->createCDATASection(strip_tags(html_entity_decode($Product['description_short'],ENT_COMPAT,"UTF-8"),"<br><li><p><ul><tr>"));
$description = $xml->createElement('opis');
$description->appendChild($description_cdata);
$offer->appendChild($description);
$category = $xml->createElement('sciezka_kategorii',$Categories[$Product['id_category_default']]['path']);
$offer->appendChild($category);
$category = $xml->createElement('id_kategorii_sklepu',$Product['id_category_default']);
$offer->appendChild($category);
$price = $xml->createElement('cena',$this-> getTaxedPrice($Product));
$offer->appendChild($price);
$url = $xml->createElement('url', htmlspecialchars($link->getProductLink($Product['id_product'], $Product['link_rewrite'])));
$offer->appendChild($url);
$producer = $xml->createElement('marka_producent',$Product['manufacturer_name']);
$offer->appendChild($producer);
$image = Image::getCover($Product['id_product']);
if ($image['id_image'])
//$img_url = $this->getShopHost().'img/p/'.$image['id_product'].'-'.$image['id_image'].'-large.jpg';
$img_url = $this->getImageLink($Product['link_rewrite'], $image['id_product'].'-'.$image['id_image'], $this->getXmlImageType());
else
$img_url = "";
$image = $xml->createElement('zdjecie',$img_url);
$offer->appendChild($image);
}
}
return $xml;
}
}