danielle85 Posted January 21, 2014 Share Posted January 21, 2014 Graag wil ik de categorie en subcategorie in de feed hebben, maar dit krijg ik niet voor elkaar. Kan iemand mij helpen? Ik heb nu in rss.php: <?php /* * 2007-2011 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 1.4 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ include(dirname(__FILE__).'/../../config/config.inc.php'); require_once(dirname(__FILE__).'/../../init.php'); // Get data $number = ((int)(Tools::getValue('n')) ? (int)(Tools::getValue('n')) : 10); $orderByValues = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity'); $orderWayValues = array(0 => 'ASC', 1 => 'DESC'); $orderBy = Tools::strtolower(Tools::getValue('orderby', $orderByValues[(int)(Configuration::get('PS_PRODUCTS_ORDER_BY'))])); $orderWay = Tools::strtoupper(Tools::getValue('orderway', $orderWayValues[(int)(Configuration::get('PS_PRODUCTS_ORDER_WAY'))])); if (!in_array($orderBy, $orderByValues)) $orderBy = $orderByValues[0]; if (!in_array($orderWay, $orderWayValues)) $orderWay = $orderWayValues[0]; $id_category = ((int)(Tools::getValue('id_category')) ? (int)(Tools::getValue('id_category')) : 1); $products = Product::getProducts((int)($cookie->id_lang), 0, NULL, 'id_product', 'ASC'); $currency = new Currency((int)($cookie->id_currency)); $affiliate = (Tools::getValue('ac') ? '?ac='.(int)(Tools::getValue('ac')) : ''); $id_category = ((int)(Tools::getValue('id_category')) ? (int)(Tools::getValue('id_category')) : 1); // Send feed header("Content-Type:text/xml; charset=utf-8"); echo '<?xml version="1.0" encoding="UTF-8"?>'."\n"; ?> <catalogus> <?php foreach ($products AS $product) { if ($product['active'] == 1){ $image = Image::getImages((int)($cookie->id_lang), $product['id_product']); echo "\t\t<product>\n"; // & in titel naar & omzetten echo "\t\t\t<Title>".str_replace("&", "&" , $product['name'])."</Title>\n"; echo "\t\t\t<Beschrijving>".str_replace("&", "&" , $product['description'])."</Beschrijving>\n"; echo "\t\t\t<Prijs>".html_entity_decode(Tools::displayPrice(Product::getPriceStatic($product['id_product']), $currency), ENT_COMPAT, 'UTF-8')."</Prijs>\n"; echo "\t\t\t<Categorie>"; $cats = Product::getProductCategories($product['id_product']); foreach ($cats AS $cat) { //home category niet tonen if($cat != 1){ $catnames = Category::getSimpleCategories($cookie->id_lang); foreach ($catnames as $catname){ if ($catname['id_category'] == $cat) echo $catname['name']; [spam-filter]} echo "</Categorie>\n"; echo "\t\t\t<Image-locatie>"; $cdata = true; if (is_array($image) AND sizeof($image)) { echo _PS_BASE_URL_.__PS_BASE_URI__."img/p/".$image[0]['id_product']."-".$image[0]['id_image']."-home.jpg"; $cdata = false; } echo "</Image-locatie>\n"; echo "\t\t\t<Portokosten>"; echo "0"; echo "</Portokosten>\n"; echo "\t\t\t<Levertijd>"; echo "1-2 werkdagen"; echo "</Levertijd>\n"; echo "\t\t\t<Winkelproductcode>"; echo $product['id_product']; echo "</Winkelproductcode>\n"; echo "\t\t\t<Deeplink>".htmlspecialchars($link->getproductLink($product['id_product'], $product['link_rewrite'], Category::getLinkRewrite((int)($product['id_category_default']), $cookie->id_lang))).$affiliate."</Deeplink>\n"; echo "\t\t\t<Geslacht>"; echo "Dames"; echo "</Geslacht>\n"; echo "\t\t</product>\n"; } } ?> </catalogus> Maar als ik dit gebruik krijg ik de foutmelding: This page contains the following errors:error on line 7 at column 27: xmlParseEntityRef: no name Below is a rendering of the page up to the first error. Weet iemand hoe ik de categorie en subcategorie kan weergeven in een feed? Alvast bednakt. Link to comment Share on other sites More sharing options...
danielle85 Posted January 29, 2014 Author Share Posted January 29, 2014 (edited) Moet ik nog verbinding maken met de tabel ps_category_lang? De categorie staat wel in de deeplink, dus het moet niet moeilijk zijn. Ik krijg het alleen niet voor elkaar om hem normaal weer te geven in de feed, evenals de subcategorie. Ik heb Prestashop 1.4.7.3. Edited January 29, 2014 by danielle85 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts