Jump to content

(MODUL) Zboží 0.1


dinan

Recommended Posts

Omlouvám se, že zakládám topic, ale je to hořák. V tomto modulu mi vše funguje, ale při generování feedu pro heureku to nevyplňuje delivery date (to bych potreboval mit 1 u všeho) a když je zboží ve více kategoriich tak to v feedu oddeluje mezerou a ja bych potřeboval aby to oddeloalo znakem >

Pomohl by mi někdo? Určite to už někdo musel vyřešit.

Moc moc dík

Link to comment
Share on other sites

<?php
$shopUrl = 'http://www.vasedomena.cz';
include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/init.php');
error_reporting(0);
$p=Product::getProducts(3, 0, 0, 'id_product', 'desc', false);
$products=Product::getProductsProperties(3, $p);

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

foreach ($products as $row) {

$kategorie=array();
$category = new Category(intval($row['id_category_default']), intval(3));
while ($category->id <> 1) {
$kategorie[]=$category->hideCategoryPosition($category->name);
$category = new Category(intval($category->id_parent), intval(3));
}

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

'.str_replace("&", "&", $row['manufacturer_name']).'
'.str_replace("&", "&", $row['manufacturer_name']).' '.str_replace("&", "and", strip_tags($row['name'])).'
'.str_replace("&", "and", strip_tags($row['description_short'])).'.'.str_replace("&", "and", strip_tags($row['description'])).'
'.$row['link'].'
'.implode('>',array_reverse($kategorie)).'
http://www.vasedomena.cz/img/p/'.$row['id_product'].'-'.$img['id_image'].'-home.jpg
'.$row['tax_rate'].'
'.($row['price']*1).'
1
0
new
';
}
echo '';
?>

Link to comment
Share on other sites

Vložim sem můj současný feed na heureku a mohl by si me poradit co primo v nem a jak zmenit abych mel delivry time 0 a kategorie oddelene >
Diky

<?php
require_once("cFeed.php");
class FeedHeureka extends cFeed {

public function CreateFeed($products, $feeddir) {
global $link;
global $id_lang;

$output="";
$feedpath =$feeddir."/zbozi_heureka.xml";

if(file_exists($feedpath))
unlink($feedpath);
$fp=fopen($feedpath, "w+");
if(!$fp) {
echo "failed to open ".$feedpath;
}

fputs($fp, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
fputs($fp, "\n");


foreach ($products AS $product)
{
$image = Image::getImages(intval($id_lang), $product['id_product']);
$description=substr($product['description_short'], 0, 510);

$item= "\t\t\n";
$item.= "\t\t\t".htmlspecialchars($product['name'])."\n";
$item.= "\t\t\t".htmlspecialchars($description)."\n";
$item.= "\t\t\t".htmlspecialchars($link->getproductLink($product['id_product'], $product['link_rewrite'], Tools::getValue('id_category')).$affiliate)."\n";
if($image[0]['id_product']) {
$item.="\t\t\t".htmlspecialchars(_PS_BASE_URL_.__PS_BASE_URI__."img/p/".$image[0]['id_product']."-".$image[0]['id_image'])."-small.jpg";
}
$item.= "\t\t\t".htmlspecialchars($product['price'])."\n";
$item.= "\t\t\t".$this->getAvailability($product)."\n";
$item.= "\t\t\t".htmlspecialchars($this->get_categorytext($product))."\n";
$item.="\t\t\n";
fputs($fp, $item);
}
fputs($fp, "");
fclose($fp);
}

private function get_categorytext($product) {
global $id_lang;
$cats= Db::getInstance()->ExecuteS('
SELECT '._DB_PREFIX_.'category_lang.name

FROM
'._DB_PREFIX_.'category_product LEFT JOIN '._DB_PREFIX_.'category_lang ON
'._DB_PREFIX_.'category_product.id_category = '._DB_PREFIX_.'category_lang.id_category
LEFT JOIN '._DB_PREFIX_.'category ON
'._DB_PREFIX_.'category_product.id_category = '._DB_PREFIX_.'category.id_category

WHERE '._DB_PREFIX_.'category_product.id_product = '.intval($product["id_product"])
.' AND '._DB_PREFIX_.'category_lang.id_lang= '.$id_lang
.' AND '._DB_PREFIX_.'category.active= 1 ORDER BY '._DB_PREFIX_.'category.level_depth ASC '
);
$retval="";
foreach($cats as $cat) {
$retval.=$cat["name"]." ";
}
return $retval;
}

}
?>

Link to comment
Share on other sites

$p=Product::getProducts(3, 0, 0, ‘id_product’, ‘desc’, false);

3=cestina pod cislem 3 - zmenit pokud je pod jinym cislem, pripadne zmenit cestu ke config.inc.php a init.php

Jinak funguje, aspon u mne.


Diky uz jsem to rozchodil na solo feedu, jeste to nejak zakomponovat do toho modulu zbozi jak jsem postnul:)
Link to comment
Share on other sites

ten modul nepouzivam, takze nevim... v tom mem feedu jsou kategorie oddelene ">":
’.implode(’>’,array_reverse($kategorie)).’
a delivery napevno nastavene "1":
1

A jeste posledni snad otazka. Adresu toho php souboru staci uvest v heurece jako feed, nebo to musim nekam generovat do souboru s koncovkou xml pro heureku? Pokud ano jak se to udela?
Link to comment
Share on other sites

×
×
  • Create New...