Jump to content

n44ps

Members
  • Posts

    8
  • Joined

  • Last visited

n44ps's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello everyone, It's been a while since I posted my issue. Actually I found what the problem was, so here is the answer. When you want to display your own fields (that you added in the Product Class), it depends on the page you are : Assuming the customer wants the products sorted by suppliers, he's on the page ..yoursite.com/supplier.php?id_supplier=XX So you should modify the Supplier class, the function remain the same for all the class : getProducts(...) You have something like this : /////////////////////////////////////////////////////////////////////////////////////////////// $sql = ' SELECT p.*, pl.`yourownfield`, pl.`yourownfield2`,pl.`yourownfield3`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, s.`name` AS supplier_name, tl.`name` AS tax_name, t.`rate`, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new, (p.`price` * ((100 + (t.`rate`))/100)) AS orderprice, m.`name` AS manufacturer_name FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($id_lang).') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)($id_lang).') LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = '.(int)Country::getDefaultCountryId().' AND tr.`id_state` = 0) LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`) LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)($id_lang).') LEFT JOIN `'._DB_PREFIX_.'supplier` s ON s.`id_supplier` = p.`id_supplier` LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` WHERE p.`id_supplier` = '.(int)($id_supplier).($active ? ' AND p.`active` = 1' : '').' AND p.`id_product` IN ( SELECT cp.`id_product` FROM `'._DB_PREFIX_.'category_group` cg LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)'. ($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').' WHERE cg.`id_group` '.$sqlGroups.' ) ORDER BY '.(($orderBy == 'id_product') ? 'p.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).' LIMIT '.(((int)($p) - 1) * (int)($n)).','.(int)($n); /////////////////////////////////////////////////////////////////////////////////////////////// Add your fields like above. So each time you want to display your own fields in a page, add your code into the getProducts(...) function of this page. I hope everything is clear. Best regards, N44PS
  2. Still supplier_name. In fact I made my own fields in ps_product_lang, like 'vintage' (It's about wine). I can display them in product.tpl {$product->vintage}, I said I wanted to display supplier_name but there are other fields in the same case.
  3. Actually you're right, it works. But it is because it is fetched from Classes/Category.php -> getProducts(), when you have (line 550) "SELECT p.*, pa.`id_product_attribute`, pl.`description`..." You can see that all the information from ps_product are fetched, therefore so is the reference.
  4. I've just done what you told me to, but no results. Then I've deleted "productListAssign()" : the products are still displayed. Seems like all these functions are not used. CategoryController.php, Category.php doesn't change anything to the process displaying the products in our case.
  5. I don't know how to check if there are modules hooked to it, I can find the function though : public function productListAssign() { $hookExecuted = false; Module::hookExec('productListAssign', array('nbProducts' => &$this->nbProducts, 'catProducts' => &$this->cat_products, 'hookExecuted' => &$hookExecuted)); if(!$hookExecuted) // The hook was not executed, standard working { self::$smarty->assign('categoryNameComplement', ''); $this->nbProducts = $this->category->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true); $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts" $this->cat_products = $this->category->getProducts((int)(self::$cookie->id_lang), (int)($this->p), (int)($this->n), $this->orderBy, $this->orderWay); } else // Hook executed, use the override $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts" self::$smarty->assign('nb_products', (int)$this->nbProducts); } Does it help ?
  6. The block layered wasn't turned on. I have lots of module installed but only 3 are hooked and none to 'productListAssign'. Should I unhooked all my module in order to check if there's something wrong ?
  7. Indeed, I'm using 1.4.6.2. And the layered navigation wasn't enabled. I put it on, but still it doesn't work. What's the point using this module ?
  8. Hello everyone, I've been searching information for a while now and I found some answers. Actually, I made all what said this topic (http://www.prestashop.com/forums/topic/77057-solved-how-to-include-supplier-name-in-product-list/) and I really thought it would work but in vain. I can even erase the fonction named getProducts (from Category.php), it still displays the same way. But supplier_name isn't displayed... How is that possible ? I put force_compile to "true" and also reboot MAMP... Thanks for helping me.
×
×
  • Create New...