// Context part 11

This commit is contained in:
tDidierjean
2011-07-18 15:50:58 +00:00
parent 4b7dee58b7
commit 6551a3ece7
60 changed files with 378 additions and 520 deletions
+5 -5
View File
@@ -105,7 +105,7 @@ class CrossSelling extends Module
*/
public function hookProductFooter($params)
{
global $smarty, $cookie, $link;
$context = Context::getContext();
$orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT o.id_order
@@ -127,7 +127,7 @@ class CrossSelling extends Module
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id)
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default)
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id)
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)($cookie->id_lang).' AND cl.id_lang = '.(int)($cookie->id_lang).'
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$context->language->id.' AND cl.id_lang = '.(int)$context->language->id.'
AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND p.active = 1
ORDER BY RAND()
LIMIT 10');
@@ -135,15 +135,15 @@ class CrossSelling extends Module
$taxCalc = Product::getTaxCalculationMethod();
foreach ($orderProducts AS &$orderProduct)
{
$orderProduct['image'] = $link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium');
$orderProduct['link'] = $link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']);
$orderProduct['image'] = $context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium');
$orderProduct['link'] = $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);
}
$smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0),
$context->controller->smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0),
'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE')));
}
return $this->display(__FILE__, 'crossselling.tpl');