// Context part 26
This commit is contained in:
@@ -31,8 +31,8 @@ $useSSL = true;
|
||||
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
if ($cookie->isLogged())
|
||||
$context = Context::getContext();
|
||||
if ($context->cookie->isLogged())
|
||||
{
|
||||
$action = Tools::getValue('action');
|
||||
$id_wishlist = (int)Tools::getValue('id_wishlist');
|
||||
@@ -51,26 +51,26 @@ if ($cookie->isLogged())
|
||||
else
|
||||
{
|
||||
if (!strcmp($action, 'delete'))
|
||||
WishList::removeProduct($id_wishlist, (int)($cookie->id_customer), $id_product, $id_product_attribute);
|
||||
WishList::removeProduct($id_wishlist, (int)$context->customer->id, $id_product, $id_product_attribute);
|
||||
|
||||
$products = WishList::getProductByIdCustomer($id_wishlist, $cookie->id_customer, $cookie->id_lang);
|
||||
$products = WishList::getProductByIdCustomer($id_wishlist, $context->customer->id, $context->language->id);
|
||||
$bought = WishList::getBoughtProduct($id_wishlist);
|
||||
|
||||
for ($i = 0; $i < sizeof($products); ++$i)
|
||||
{
|
||||
$obj = new Product((int)($products[$i]['id_product']), false, (int)($cookie->id_lang));
|
||||
$obj = new Product((int)($products[$i]['id_product']), false, $context->language->id);
|
||||
if (!Validate::isLoadedObject($obj))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
if ($products[$i]['id_product_attribute'] != 0)
|
||||
{
|
||||
$combination_imgs = $obj->getCombinationImages((int)($cookie->id_lang));
|
||||
$combination_imgs = $obj->getCombinationImages($context->language->id);
|
||||
$products[$i]['cover'] = $obj->id.'-'.$combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$images = $obj->getImages((int)($cookie->id_lang));
|
||||
$images = $obj->getImages($context->language->id);
|
||||
foreach ($images AS $k => $image)
|
||||
if ($image['cover'])
|
||||
{
|
||||
@@ -79,7 +79,7 @@ if ($cookie->isLogged())
|
||||
}
|
||||
}
|
||||
if (!isset($products[$i]['cover']))
|
||||
$products[$i]['cover'] = Language::getIsoById($cookie->id_lang).'-default';
|
||||
$products[$i]['cover'] = $context->language->iso_code.'-default';
|
||||
}
|
||||
$products[$i]['bought'] = false;
|
||||
for ($j = 0, $k = 0; $j < sizeof($bought); ++$j)
|
||||
@@ -95,7 +95,7 @@ if ($cookie->isLogged())
|
||||
foreach ($products as $product)
|
||||
if (sizeof($product['bought']))
|
||||
$productBoughts[] = $product;
|
||||
$smarty->assign(array(
|
||||
$context->smarty->assign(array(
|
||||
'products' => $products,
|
||||
'productsBoughts' => $productBoughts,
|
||||
'id_wishlist' => $id_wishlist,
|
||||
@@ -104,9 +104,9 @@ if ($cookie->isLogged())
|
||||
));
|
||||
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/managewishlist.tpl'))
|
||||
$smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/managewishlist.tpl');
|
||||
$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/managewishlist.tpl');
|
||||
elseif (Tools::file_exists_cache(dirname(__FILE__).'/managewishlist.tpl'))
|
||||
$smarty->display(dirname(__FILE__).'/managewishlist.tpl');
|
||||
$context->smarty->display(dirname(__FILE__).'/managewishlist.tpl');
|
||||
else
|
||||
echo Tools::displayError('No template found');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user