scraper Posted September 2, 2012 Share Posted September 2, 2012 (edited) Hi I'm trying to hook the cross selling module to Extra Right (displayRightColumnProduct), but cannot get it to display without also hooking it to Product Footer (displayFooterProduct). This is the module code /** * Returns module content for left column */ public function hookProductFooter($params) { $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT o.id_order FROM '._DB_PREFIX_.'orders o LEFT JOIN '._DB_PREFIX_.'order_detail od ON (od.id_order = o.id_order) WHERE o.valid = 1 AND od.product_id = '.(int)$params['product']->id); if (sizeof($orders)) { $list = ''; foreach ($orders AS $order) $list .= (int)$order['id_order'].','; $list = rtrim($list, ','); $orderProducts = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, product_shop.show_price, cl.link_rewrite category, p.ean13 FROM '._DB_PREFIX_.'order_detail od LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = od.product_id) '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id'.Shop::addSqlRestrictionOnLang('pl').') LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = product_shop.id_category_default'.Shop::addSqlRestrictionOnLang('cl').') LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id) WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$this->context->language->id.' AND cl.id_lang = '.(int)$this->context->language->id.' AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND product_shop.active = 1 ORDER BY RAND() LIMIT 10 '); $taxCalc = Product::getTaxCalculationMethod(); foreach ($orderProducts AS &$orderProduct) { $orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium'); $orderProduct['link'] = $this->context->link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']); if (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND ($taxCalc == 0 OR $taxCalc == 2)) $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], true, NULL); elseif (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND $taxCalc == 1) $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], false, NULL); } $this->smarty->assign(array('order' => false, 'orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), 'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE'))); } return $this->display(__FILE__, 'crossselling.tpl'); } Not even when I copy the above code and swap public function hookProductFooter($params) with public function hookExtraRight($params) does it output anything. I've added <div id="pb-extra-right"> {if isset($HOOK_EXTRA_RIGHT) && $HOOK_EXTRA_RIGHT}{$HOOK_EXTRA_RIGHT}{/if} </div> to product.tpl, which (as i said) displays the module nicely when it is also hooked to the product footer (default hook). What am I missing? I'm new to Prestashop and Smarty, but wth Sure, I could just move the product footer hook to the new location(id=pb-extra-right), but I figure I would be neat to still be able to use it for other modules. Edited September 2, 2012 by scraper (see edit history) Link to comment Share on other sites More sharing options...
sickz Posted September 2, 2012 Share Posted September 2, 2012 (edited) It's not a real fix but if you want to hide it from product footer you can search for "<div id="crossselling">" in "crosselling.tpl and change it to this "<div id="crossselling" style="display:none;"> Ofcourse you have to create a new template for the right block Edited September 2, 2012 by sickz (see edit history) Link to comment Share on other sites More sharing options...
scraper Posted September 3, 2012 Author Share Posted September 3, 2012 It's not a real fix but if you want to hide it from product footer you can search for "<div id="crossselling">" in "crosselling.tpl and change it to this "<div id="crossselling" style="display:none;"> Ofcourse you have to create a new template for the right block Thanks for the suggestion. But, as you said, display:none still loads the code... :| I think I'll just move the product footer hook. If I need a new "product footer hook" I can create a rev2 when that day comes. More suggestions? Link to comment Share on other sites More sharing options...
cedricfontaine Posted February 20, 2013 Share Posted February 20, 2013 Hello, It seems that the hook extra right does not receive the product information in params. So it does not work with the same parameter as in the product footer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now