// Context part 26
This commit is contained in:
@@ -136,7 +136,6 @@ class authorizeAIM extends PaymentModule
|
||||
if (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off' AND Configuration::get('PS_SSL_ENABLED'))
|
||||
{
|
||||
$invoiceAddress = new Address((int)$params['cart']->id_address_invoice);
|
||||
$customer = new Customer((int)$cookie->id_customer);
|
||||
|
||||
$authorizeAIMParams = array();
|
||||
$authorizeAIMParams['x_login'] = Configuration::get('AUTHORIZE_AIM_LOGIN_ID');
|
||||
|
||||
@@ -48,9 +48,9 @@ if (!$authorized)
|
||||
$customer = new Customer((int)$cart->id_customer);
|
||||
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
Tools::redirec('index.php?controller=order&step=1');
|
||||
|
||||
$currency = new Currency(Tools::getValue('currency_payement', false) ? Tools::getValue('currency_payement') : $cookie->id_currency);
|
||||
$currency = Tools::getValue('currency_payement', false) ? new Currency(Tools::getValue('currency_payement')) : Context::getContext()->currency;
|
||||
$total = (float)($cart->getOrderTotal(true, Cart::BOTH));
|
||||
$mailVars = array(
|
||||
'{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'),
|
||||
|
||||
@@ -30,12 +30,12 @@ if ( isset($_POST['ajax_blockcart_display']) || isset($_GET['ajax_blockcart_disp
|
||||
{
|
||||
if (Tools::getValue('ajax_blockcart_display') == 'collapse')
|
||||
{
|
||||
$cookie->ajax_blockcart_display = 'collapsed';
|
||||
Context::getContext()->cookie->ajax_blockcart_display = 'collapsed';
|
||||
die ('collapse status of the blockcart module updated in the cookie');
|
||||
}
|
||||
if (Tools::getValue('ajax_blockcart_display') == 'expand')
|
||||
{
|
||||
$cookie->ajax_blockcart_display = 'expanded';
|
||||
Context::getContext()->cookie->ajax_blockcart_display = 'expanded';
|
||||
die ('expand status of the blockcart module updated in the cookie');
|
||||
}
|
||||
die ('ERROR : bad status setted. Only collapse or expand status of the blockcart module are available.');
|
||||
|
||||
@@ -29,6 +29,7 @@ include_once('../../config/config.inc.php');
|
||||
include_once('../../init.php');
|
||||
include_once('blockcms.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$blockcms = new BlockCms();
|
||||
if (!Tools::isSubmit('secure_key') OR Tools::getValue('secure_key') != $blockcms->secure_key OR !Tools::isSubmit('action'))
|
||||
die(1);
|
||||
@@ -42,7 +43,7 @@ if (Tools::getValue('action') == 'getCms')
|
||||
SELECT * FROM `'._DB_PREFIX_.'cms_category` c
|
||||
JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category`)
|
||||
WHERE c.`id_parent` = '.(int)Tools::getValue('id_cms_category').'
|
||||
AND cl.`id_lang` = '.(int)$cookie->id_lang.'
|
||||
AND cl.`id_lang` = '.(int)$context->language->id.'
|
||||
ORDER BY c.`id_cms_category`');
|
||||
|
||||
$cms_pages = Db::getInstance()->ExecuteS('
|
||||
@@ -50,7 +51,7 @@ if (Tools::getValue('action') == 'getCms')
|
||||
JOIN `'._DB_PREFIX_.'cms_lang` cl ON (c.`id_cms` = cl.`id_cms`)
|
||||
WHERE c.`id_cms_category` = '.(int)Tools::getValue('id_cms_category').'
|
||||
AND c.`active` = 1
|
||||
AND cl.`id_lang` = '.(int)$cookie->id_lang.'
|
||||
AND cl.`id_lang` = '.(int)$context->language->id.'
|
||||
ORDER BY c.`id_cms`');
|
||||
|
||||
if (Tools::getValue('id_cms_block'))
|
||||
|
||||
@@ -54,11 +54,10 @@ class blockcustomerprivacy extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = Language::getLanguages(false);
|
||||
$iso = Language::getIsoById((int)$cookie->id_lang);
|
||||
$iso = $context->language->iso_code;
|
||||
|
||||
if (Tools::isSubmit('submitCustPrivMess'))
|
||||
{
|
||||
@@ -152,16 +151,10 @@ class blockcustomerprivacy extends Module
|
||||
{
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
global $smarty, $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
/* Languages preliminaries */
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = Language::getLanguages(false);
|
||||
$iso = Language::getIsoById((int)($cookie->id_lang));
|
||||
|
||||
$smarty->assign(array(
|
||||
'privacy_message' => Configuration::get('CUSTPRIV_MESSAGE', (int)($cookie->id_lang)),
|
||||
$context->smarty->assign(array(
|
||||
'privacy_message' => Configuration::get('CUSTPRIV_MESSAGE', $context->language->id),
|
||||
'error_message' => $this->l('Please agree with the customer data privacy by ticking the checkbox below.')
|
||||
));
|
||||
return $this->display(__FILE__, 'blockcustomerprivacy.tpl');
|
||||
|
||||
@@ -134,8 +134,8 @@ class BlockLayered extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
$errors = array();
|
||||
$html = '';
|
||||
|
||||
@@ -313,7 +313,7 @@ class BlockLayered extends Module
|
||||
<td>'.(int)$filtersTemplate['id_layered_filter'].'</td>
|
||||
<td style="text-align: left; padding-left: 10px; width: 270px;">'.$filtersTemplate['name'].'</td>
|
||||
<td style="text-align: center;">'.(int)$filtersTemplate['n_categories'].'</td>
|
||||
<td>'.Tools::displayDate($filtersTemplate['date_add'], (int)$cookie->id_lang, true).'</td>
|
||||
<td>'.Tools::displayDate($filtersTemplate['date_add'], (int)$context->language->id, true).'</td>
|
||||
<td>
|
||||
<a href="#" onclick="updElements('.($filtersTemplate['n_categories'] ? 0 : 1).', '.(int)$filtersTemplate['id_layered_filter'].');"><img src="../img/admin/edit.gif" alt="" title="'.$this->l('Edit').'" /></a>
|
||||
<a href="'.$_SERVER['REQUEST_URI'].'&deleteFilterTemplate=1&id_layered_filter='.(int)$filtersTemplate['id_layered_filter'].'" onclick="return confirm(\''.addslashes($this->l('Delete filter template #').(int)$filtersTemplate['id_layered_filter'].$this->l('?')).'\');"><img src="../img/admin/delete.gif" alt="" title="'.$this->l('Delete').'" /></a>
|
||||
@@ -772,7 +772,6 @@ class BlockLayered extends Module
|
||||
LEFT JOIN '._DB_PREFIX_.'category_group cg ON (cg.id_category = c.id_category)
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category)
|
||||
WHERE c.nleft > '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1 AND c.id_parent = '.(int)$category->id.' AND cl.id_lang = '.(int)$context->language->id.'
|
||||
WHERE c.nleft > '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1 AND c.id_parent = '.(int)$category->id.' AND cl.id_lang = '.(int)$cookie->id_lang.'
|
||||
AND cg.id_group '.pSQL(sizeof($groups) ? 'IN ('.implode(',', $groups).')' : '= 1').'
|
||||
GROUP BY c.id_category
|
||||
ORDER BY c.position ASC');
|
||||
@@ -1103,8 +1102,8 @@ class BlockLayered extends Module
|
||||
|
||||
public function ajaxCallBackOffice($categoryBox = array(), $id_layered_filter = NULL)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
if (!empty($id_layered_filter))
|
||||
{
|
||||
$layeredFilter = Db::getInstance()->getRow('SELECT * FROM '._DB_PREFIX_.'layered_filter WHERE id_layered_filter = '.(int)$id_layered_filter);
|
||||
@@ -1124,7 +1123,7 @@ class BlockLayered extends Module
|
||||
LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_attribute = a.id_attribute)
|
||||
LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product_attribute = pac.id_product_attribute)
|
||||
LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = pa.id_product)' : '').'
|
||||
WHERE agl.id_lang = '.(int)$cookie->id_lang.
|
||||
WHERE agl.id_lang = '.(int)$context->language->id.
|
||||
(sizeof($categoryBox) ? ' AND cp.id_category IN ('.implode(',', $categoryBox).')' : '').'
|
||||
GROUP BY ag.id_attribute_group');
|
||||
|
||||
@@ -1135,7 +1134,7 @@ class BlockLayered extends Module
|
||||
'.(sizeof($categoryBox) ? '
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_product fp ON (fp.id_feature = fv.id_feature)
|
||||
LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = fp.id_product)' : '').'
|
||||
WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = '.(int)$cookie->id_lang.
|
||||
WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = '.(int)$context->language->id.
|
||||
(sizeof($categoryBox) ? ' AND cp.id_category IN ('.implode(',', $categoryBox).')' : '').'
|
||||
GROUP BY fl.id_feature');
|
||||
|
||||
|
||||
@@ -68,12 +68,12 @@ class WishList extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'wishlist_email` WHERE `id_wishlist` = '.(int)($this->id));
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'wishlist_product` WHERE `id_wishlist` = '.(int)($this->id));
|
||||
if (isset($cookie->id_wishlist))
|
||||
unset($cookie->id_wishlist);
|
||||
if (isset($context->cookie->id_wishlist))
|
||||
unset($context->cookie->id_wishlist);
|
||||
|
||||
return (parent::delete());
|
||||
}
|
||||
@@ -102,13 +102,13 @@ class WishList extends ObjectModel
|
||||
|
||||
public static function isExistsByNameForUser($name)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT COUNT(*) AS total
|
||||
FROM `'._DB_PREFIX_.'wishlist`
|
||||
WHERE `name` = \''.pSQL($name).'\'
|
||||
AND `id_customer` = '.(int)($cookie->id_customer)
|
||||
AND `id_customer` = '.(int)$context->customer->id
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ require_once(dirname(__FILE__).'/../../init.php');
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
require_once(dirname(__FILE__).'/blockwishlist.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$action = Tools::getValue('action');
|
||||
$add = (!strcmp($action, 'add') ? 1 : 0);
|
||||
$delete = (!strcmp($action, 'delete') ? 1 : 0);
|
||||
@@ -39,39 +40,39 @@ $quantity = (int)(Tools::getValue('quantity'));
|
||||
$id_product_attribute = (int)(Tools::getValue('id_product_attribute'));
|
||||
if (Configuration::get('PS_TOKEN_ENABLE') == 1 AND
|
||||
strcmp(Tools::getToken(false), Tools::getValue('token')) AND
|
||||
$cookie->isLogged() === true)
|
||||
$context->cookie->isLogged() === true)
|
||||
echo Tools::displayError('Invalid token');
|
||||
if ($cookie->isLogged())
|
||||
if ($context->cookie->isLogged())
|
||||
{
|
||||
if ($id_wishlist AND WishList::exists($id_wishlist, $cookie->id_customer) === true)
|
||||
$cookie->id_wishlist = (int)($id_wishlist);
|
||||
if (empty($cookie->id_wishlist) === true OR $cookie->id_wishlist == false)
|
||||
$smarty->assign('error', true);
|
||||
if ($id_wishlist AND WishList::exists($id_wishlist, $context->customer->id) === true)
|
||||
$context->cookie->id_wishlist = (int)($id_wishlist);
|
||||
if (empty($context->cookie->id_wishlist) === true OR $context->cookie->id_wishlist == false)
|
||||
$context->smarty->assign('error', true);
|
||||
if (($add OR $delete) AND empty($id_product) === false)
|
||||
{
|
||||
if(!isset($cookie->id_wishlist) OR $cookie->id_wishlist == '')
|
||||
if(!isset($context->cookie->id_wishlist) OR $context->cookie->id_wishlist == '')
|
||||
{
|
||||
$wishlist = new WishList();
|
||||
$modWishlist = new BlockWishList();
|
||||
$wishlist->name = $modWishlist->default_wishlist_name;
|
||||
$wishlist->id_customer = (int)($cookie->id_customer);
|
||||
$wishlist->id_customer = (int)($context->customer->id);
|
||||
list($us, $s) = explode(' ', microtime());
|
||||
srand($s * $us);
|
||||
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$cookie->id_customer), 0, 16));
|
||||
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$context->customer->id), 0, 16));
|
||||
$wishlist->add();
|
||||
$cookie->id_wishlist = (int)($wishlist->id);
|
||||
$context->cookie->id_wishlist = (int)($wishlist->id);
|
||||
}
|
||||
if ($add AND $quantity)
|
||||
WishList::addProduct($cookie->id_wishlist, $cookie->id_customer, $id_product, $id_product_attribute, $quantity);
|
||||
WishList::addProduct($context->cookie->id_wishlist, $context->customer->id, $id_product, $id_product_attribute, $quantity);
|
||||
else if ($delete)
|
||||
WishList::removeProduct($cookie->id_wishlist, $cookie->id_customer, $id_product, $id_product_attribute);
|
||||
WishList::removeProduct($context->cookie->id_wishlist, $context->customer->id, $id_product, $id_product_attribute);
|
||||
}
|
||||
$smarty->assign('products', WishList::getProductByIdCustomer($cookie->id_wishlist, $cookie->id_customer, $cookie->id_lang, null, true));
|
||||
$context->smarty->assign('products', WishList::getProductByIdCustomer($context->cookie->id_wishlist, $context->customer->id, $context->language->id, null, true));
|
||||
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/blockwishlist-ajax.tpl'))
|
||||
$smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/blockwishlist-ajax.tpl');
|
||||
$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/blockwishlist-ajax.tpl');
|
||||
elseif (Tools::file_exists_cache(dirname(__FILE__).'/blockwishlist-ajax.tpl'))
|
||||
$smarty->display(dirname(__FILE__).'/blockwishlist-ajax.tpl');
|
||||
$context->smarty->display(dirname(__FILE__).'/blockwishlist-ajax.tpl');
|
||||
else
|
||||
echo Tools::displayError('No template found');
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
include_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$errors = array();
|
||||
|
||||
if ($cookie->isLogged())
|
||||
@@ -58,21 +59,21 @@ if ($cookie->isLogged())
|
||||
{
|
||||
$wishlist = new WishList();
|
||||
$wishlist->name = $name;
|
||||
$wishlist->id_customer = (int)$cookie->id_customer;
|
||||
$wishlist->id_customer = (int)$context->customer->id;
|
||||
list($us, $s) = explode(' ', microtime());
|
||||
srand($s * $us);
|
||||
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$cookie->id_customer), 0, 16));
|
||||
$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$context->customer->id), 0, 16));
|
||||
$wishlist->add();
|
||||
Mail::Send((int)($cookie->id_lang), 'wishlink', Mail::l('Your wishlist\'s link'),
|
||||
Mail::Send($context->language->id, 'wishlink', Mail::l('Your wishlist\'s link'),
|
||||
array(
|
||||
'{wishlist}' => $wishlist->name,
|
||||
'{message}' => Tools::getProtocol().htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/blockwishlist/view.php?token='.$wishlist->token),
|
||||
$cookie->email, $cookie->firstname.' '.$cookie->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
$context->customer->email, $context->customer->firstname.' '.$context->customer->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($add)
|
||||
WishList::addCardToWishlist((int)($cookie->id_customer), (int)(Tools::getValue('id_wishlist')), (int)($cookie->id_lang));
|
||||
WishList::addCardToWishlist($context->customer->id, Tools::getValue('id_wishlist'), $context->language->id);
|
||||
else if ($delete AND empty($id_wishlist) === false)
|
||||
{
|
||||
$wishlist = new WishList((int)($id_wishlist));
|
||||
@@ -81,23 +82,23 @@ if ($cookie->isLogged())
|
||||
else
|
||||
$errors[] = Tools::displayError('Cannot delete this wishlist');
|
||||
}
|
||||
$smarty->assign('wishlists', WishList::getByIdCustomer((int)($cookie->id_customer)));
|
||||
$smarty->assign('nbProducts', WishList::getInfosByIdCustomer((int)($cookie->id_customer)));
|
||||
$context->smarty->assign('wishlists', WishList::getByIdCustomer($context->customer->id));
|
||||
$context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($context->customer->id));
|
||||
}
|
||||
else
|
||||
{
|
||||
Tools::redirect('index.php?controller=authentication&back=modules/blockwishlist/mywishlist.php');
|
||||
}
|
||||
|
||||
$smarty->assign(array(
|
||||
'id_customer' => (int)($cookie->id_customer),
|
||||
$context->smarty->assign(array(
|
||||
'id_customer' => (int)$context->customer->id,
|
||||
'errors' => $errors
|
||||
));
|
||||
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl'))
|
||||
$smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl');
|
||||
$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl');
|
||||
elseif (Tools::file_exists_cache(dirname(__FILE__).'/mywishlist.tpl'))
|
||||
$smarty->display(dirname(__FILE__).'/mywishlist.tpl');
|
||||
$context->smarty->display(dirname(__FILE__).'/mywishlist.tpl');
|
||||
else
|
||||
echo Tools::displayError('No template found');
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ require_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
if (Configuration::get('PS_TOKEN_ENABLE') == 1 AND
|
||||
strcmp(Tools::getToken(false), Tools::getValue('token')) AND
|
||||
$cookie->isLogged() === true)
|
||||
$context->cookie->isLogged() === true)
|
||||
exit(Tools::displayError('invalid token',false));
|
||||
|
||||
if ($cookie->isLogged())
|
||||
if ($context->cookie->isLogged())
|
||||
{
|
||||
$id_wishlist = (int)(Tools::getValue('id_wishlist'));
|
||||
if (empty($id_wishlist) === true)
|
||||
@@ -42,15 +42,15 @@ if ($cookie->isLogged())
|
||||
for ($i = 1; empty($_POST['email'.strval($i)]) === false; ++$i)
|
||||
{
|
||||
$to = Tools::getValue('email'.$i);
|
||||
$wishlist = WishList::exists($id_wishlist, $cookie->id_customer, true);
|
||||
$wishlist = WishList::exists($id_wishlist, $context->customer->id, true);
|
||||
if ($wishlist === false)
|
||||
exit(Tools::displayError('Invalid wishlist',false));
|
||||
if (WishList::addEmail($id_wishlist, $to) === false)
|
||||
exit(Tools::displayError('Wishlist send error',false));
|
||||
$toName = strval(Configuration::get('PS_SHOP_NAME'));
|
||||
$customer = new Customer((int)($cookie->id_customer));
|
||||
$customer = $context->customer;
|
||||
if (Validate::isLoadedObject($customer))
|
||||
Mail::Send((int)($cookie->id_lang), 'wishlist', Mail::l('Message from ').$customer->lastname.' '.$customer->firstname,
|
||||
Mail::Send($context->language->id, 'wishlist', Mail::l('Message from ').$customer->lastname.' '.$customer->firstname,
|
||||
array(
|
||||
'{lastname}' => $customer->lastname,
|
||||
'{firstname}' => $customer->firstname,
|
||||
|
||||
@@ -32,6 +32,7 @@ require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../header.php');
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$token = Tools::getValue('token');
|
||||
if (empty($token) === false)
|
||||
{
|
||||
@@ -39,22 +40,22 @@ if (empty($token) === false)
|
||||
if (empty($result) === true || $result === false)
|
||||
$errors[] = Tools::displayError('Invalid wishlist token');
|
||||
WishList::refreshWishList($wishlist['id_wishlist']);
|
||||
$products = WishList::getProductByIdCustomer((int)($wishlist['id_wishlist']), (int)($wishlist['id_customer']), (int)($cookie->id_lang), null, true);
|
||||
$products = WishList::getProductByIdCustomer((int)($wishlist['id_wishlist']), (int)($wishlist['id_customer']), $context->language->id, null, true);
|
||||
for ($i = 0; $i < sizeof($products); ++$i)
|
||||
{
|
||||
$obj = new Product((int)($products[$i]['id_product']), false, (int)($cookie->id_lang));
|
||||
$obj = new Product($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'])
|
||||
@@ -64,13 +65,13 @@ if (empty($token) === false)
|
||||
}
|
||||
}
|
||||
if (!isset($products[$i]['cover']))
|
||||
$products[$i]['cover'] = Language::getIsoById((int)($cookie->id_lang)).'-default';
|
||||
$products[$i]['cover'] = $context->language->iso_code.'-default';
|
||||
}
|
||||
}
|
||||
}
|
||||
WishList::incCounter((int)($wishlist['id_wishlist']));
|
||||
$ajax = Configuration::get('PS_BLOCK_CART_AJAX');
|
||||
$smarty->assign(array (
|
||||
$context->context->smarty->assign(array (
|
||||
'current_wishlist' => $wishlist,
|
||||
'token' => $token,
|
||||
'ajax' => ((isset($ajax) AND (int)($ajax) == 1) ? '1' : '0'),
|
||||
@@ -79,9 +80,9 @@ if (empty($token) === false)
|
||||
}
|
||||
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/view.tpl'))
|
||||
$smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/view.tpl');
|
||||
$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/view.tpl');
|
||||
elseif (Tools::file_exists_cache(dirname(__FILE__).'/view.tpl'))
|
||||
$smarty->display(dirname(__FILE__).'/view.tpl');
|
||||
$context->smarty->display(dirname(__FILE__).'/view.tpl');
|
||||
else
|
||||
echo Tools::displayError('No template found');
|
||||
|
||||
|
||||
@@ -178,8 +178,6 @@ class CarrierCompare extends Module
|
||||
*/
|
||||
private function isModuleAvailable()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$fileName = basename($_SERVER['SCRIPT_FILENAME']);
|
||||
/**
|
||||
* This module is only available on standard order process because
|
||||
@@ -191,7 +189,7 @@ class CarrierCompare extends Module
|
||||
* If visitor is logged, the module isn't available on Front office,
|
||||
* we use the account informations for carrier selection and taxes.
|
||||
*/
|
||||
if ($cookie->id_customer)
|
||||
if (Context::getContext()->customer->id)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
include(dirname(__FILE__).'/cheque.php');
|
||||
|
||||
if (!$cookie->isLogged(true))
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
Tools::redirect('index.php?controller=authentication&back=order.php');
|
||||
|
||||
$cheque = new Cheque();
|
||||
|
||||
@@ -29,6 +29,8 @@ include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
include(dirname(__FILE__).'/cheque.php');
|
||||
|
||||
$context = Context::getContext();
|
||||
$cart = $context->cart;
|
||||
$cheque = new Cheque();
|
||||
|
||||
if ($cart->id_customer == 0 OR $cart->id_address_delivery == 0 OR $cart->id_address_invoice == 0 OR !$cheque->active)
|
||||
@@ -45,12 +47,12 @@ foreach (Module::getPaymentModules() as $module)
|
||||
if (!$authorized)
|
||||
die(Tools::displayError('This payment method is not available.'));
|
||||
|
||||
$customer = new Customer((int)$cart->id_customer);
|
||||
$customer = new Customer($cart->id_customer);
|
||||
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
|
||||
$currency = new Currency((int)(Tools::isSubmit('currency_payement') ? Tools::getValue('currency_payement') : $cookie->id_currency));
|
||||
$currency = Tools::isSubmit('currency_payement') ? new Currency(Tools::getValue('currency_payement')) : $context->currency;
|
||||
$total = (float)$cart->getOrderTotal(true, Cart::BOTH);
|
||||
|
||||
$mailVars = array(
|
||||
|
||||
@@ -87,9 +87,7 @@ class DejalaCarrierUtils
|
||||
}
|
||||
|
||||
public static function getCarrierByName($name) {
|
||||
global $cookie ;
|
||||
|
||||
$carriers = Carrier::getCarriers((int)$cookie->id_lang, true, false, false, NULL, ALL_CARRIERS);
|
||||
$carriers = Carrier::getCarriers(Context::getContext()->language->id, true, false, false, NULL, ALL_CARRIERS);
|
||||
foreach($carriers as $carrier)
|
||||
if (!$carrier['deleted'] AND $carrier['external_module_name'] == $name)
|
||||
return new Carrier((int)$carrier['id_carrier']) ;
|
||||
|
||||
@@ -117,7 +117,7 @@ class Editorial extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
/* display the module name */
|
||||
$this->_html = '<h2>'.$this->displayName.'</h2>';
|
||||
@@ -132,7 +132,7 @@ class Editorial extends Module
|
||||
{
|
||||
unlink(dirname(__FILE__).'/homepage_logo.jpg');
|
||||
Configuration::updateValue('EDITORIAL_IMAGE_DISABLE', 1);
|
||||
Tools::redirectAdmin('index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin('index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$context->employee->id));
|
||||
}
|
||||
$this->_html .= $errors;
|
||||
}
|
||||
@@ -180,17 +180,15 @@ class Editorial extends Module
|
||||
|
||||
private function _displayForm()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
/* Languages preliminaries */
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = Language::getLanguages(false);
|
||||
$iso = Language::getIsoById((int)($cookie->id_lang));
|
||||
$iso = $context->language->iso_code;
|
||||
$divLangName = 'title¤subheading¤cpara¤logo_subheading';
|
||||
|
||||
$editorial = new EditorialClass(1);
|
||||
// TinyMCE
|
||||
global $cookie;
|
||||
$iso = Language::getIsoById((int)($cookie->id_lang));
|
||||
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
|
||||
$ad = dirname($_SERVER["PHP_SELF"]);
|
||||
$this->_html .= '
|
||||
@@ -296,15 +294,15 @@ class Editorial extends Module
|
||||
|
||||
public function hookHome($params)
|
||||
{
|
||||
global $cookie, $smarty;
|
||||
|
||||
$editorial = new EditorialClass(1, (int)$cookie->id_lang);
|
||||
$smarty->assign(array(
|
||||
$context = Context::getContext();
|
||||
|
||||
$editorial = new EditorialClass(1, $context->language->id);
|
||||
$context->smarty->assign(array(
|
||||
'editorial' => $editorial,
|
||||
'default_lang' => (int)$cookie->id_lang,
|
||||
'default_lang' => (int)$context->language->id,
|
||||
'image_width' => Configuration::get('EDITORIAL_IMAGE_WIDTH'),
|
||||
'image_height' => Configuration::get('EDITORIAL_IMAGE_HEIGHT'),
|
||||
'id_lang' => $cookie->id_lang,
|
||||
'id_lang' => $context->language->id,
|
||||
'homepage_logo' => !Configuration::get('EDITORIAL_IMAGE_DISABLE') && file_exists('modules/editorial/homepage_logo.jpg'),
|
||||
'image_path' => $this->_path.'homepage_logo.jpg'
|
||||
));
|
||||
|
||||
@@ -37,7 +37,6 @@ class AdminEnvoiMoinsCher extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie;
|
||||
$emc = new Envoimoinscher();
|
||||
echo '<h2>'.$emc->lang('List of orders to export').'</h2>';
|
||||
if (Tools::isSubmit('submitExport'))
|
||||
@@ -83,7 +82,7 @@ class AdminEnvoiMoinsCher extends AdminTab
|
||||
else
|
||||
echo '<h2 style="color:red">'.$emc->lang('Please configure this module in order').'</h2>';
|
||||
}
|
||||
echo '<br><p><a href="index.php?tab=AdminModules&configure=envoimoinscher&token='.Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)($cookie->id_employee)).'" class="button">
|
||||
echo '<br><p><a href="index.php?tab=AdminModules&configure=envoimoinscher&token='.Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$this->context->employee->id).'" class="button">
|
||||
' . $emc->lang('Change configuration') . '</a></p>';
|
||||
}
|
||||
|
||||
@@ -113,7 +112,6 @@ class AdminEnvoiMoinsCher extends AdminTab
|
||||
|
||||
private function displayOrders($orders)
|
||||
{
|
||||
global $cookie;
|
||||
echo '<table cellspacing="0" cellpadding="0" class="table" align="center" style="margin:10px 0px 0px 25px;">
|
||||
<tr>
|
||||
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'ordersBox[]\', this.checked)" /></th>
|
||||
@@ -148,7 +146,7 @@ class AdminEnvoiMoinsCher extends AdminTab
|
||||
echo '</select>
|
||||
</td>
|
||||
<td>'.envoimoinscher::selectNature(Configuration::get('EMC_CONTENT'),(int)($order['id_order'])).'</td>
|
||||
<td align="center"><a href="index.php?tab=AdminOrders&id_order='.(int)($order['id_order']).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'">
|
||||
<td align="center"><a href="index.php?tab=AdminOrders&id_order='.(int)($order['id_order']).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id).'">
|
||||
<img border="0" title="'.$emc->lang('View').'" alt="'.$emc->lang('View').'" src="'._PS_IMG_.'admin/details.gif"/></a></td>
|
||||
</tr>';
|
||||
}
|
||||
@@ -161,7 +159,6 @@ class AdminEnvoiMoinsCher extends AdminTab
|
||||
|
||||
private function getOrderDetails($id_order)
|
||||
{
|
||||
global $cookie;
|
||||
$confs = Configuration::getMultiple(array('EMC_LOGIN', 'PS_SHOP_NAME', 'EMC_GENDER', 'EMC_FIRST_NAME', 'EMC_LAST_NAME', 'EMC_ADDRESS',
|
||||
'EMC_ZIP_CODE', 'EMC_CITY', 'EMC_COUNTRY', 'EMC_PHONE', 'EMC_EMAIL', 'EMC_EMAILS'));
|
||||
$orderDetails = array();
|
||||
@@ -218,7 +215,7 @@ class AdminEnvoiMoinsCher extends AdminTab
|
||||
$orderDelivery['adresse'] = htmlspecialchars($adresseDelivery->address1, ENT_COMPAT, 'UTF-8');
|
||||
$orderDelivery['codepostal'] = htmlspecialchars($adresseDelivery->postcode, ENT_COMPAT, 'UTF-8');
|
||||
$orderDelivery['ville'] = htmlspecialchars($adresseDelivery->city, ENT_COMPAT, 'UTF-8');
|
||||
$orderDelivery['pz_id'] = Country::getIsoById(Country::getIdByName((int)($cookie->id_lang),$adresseDelivery->country));
|
||||
$orderDelivery['pz_id'] = Country::getIsoById(Country::getIdByName($this->context->language->id, $adresseDelivery->country));
|
||||
if (isset($adresseDelivery->phone))
|
||||
$orderDelivery['tel'] = htmlspecialchars($adresseDelivery->phone, ENT_COMPAT, 'UTF-8');
|
||||
else
|
||||
@@ -226,13 +223,11 @@ class AdminEnvoiMoinsCher extends AdminTab
|
||||
$orderDelivery['email'] = htmlspecialchars($customer->email, ENT_COMPAT, 'UTF-8');
|
||||
|
||||
$orderDetails['destinataire'] = $orderDelivery;
|
||||
//d($orderDetails);
|
||||
return $orderDetails;
|
||||
}
|
||||
|
||||
private function getFeatures($id)
|
||||
{
|
||||
global $cookie;
|
||||
$featuresTab = array();
|
||||
$confs = Configuration::getMultiple(array('EMC_WIDTH', 'EMC_HEIGHT', 'EMC_DEPTH'));
|
||||
$features = Product::getFeaturesStatic((int)$id);
|
||||
@@ -242,15 +237,15 @@ class AdminEnvoiMoinsCher extends AdminTab
|
||||
{
|
||||
case $confs['EMC_WIDTH'] :
|
||||
$featureValue = new FeatureValue((int)($feature['id_feature_value']));
|
||||
$featuresTab['largeur'] = $featureValue->value[(int)($cookie->id_lang)];
|
||||
$featuresTab['largeur'] = $featureValue->value[(int)$this->context->language->id];
|
||||
break;
|
||||
case $confs['EMC_HEIGHT'] :
|
||||
$featureValue = new FeatureValue((int)($feature['id_feature_value']));
|
||||
$featuresTab['hauteur'] = $featureValue->value[(int)($cookie->id_lang)];
|
||||
$featuresTab['hauteur'] = $featureValue->value[(int)$this->context->language->id];
|
||||
break;
|
||||
case $confs['EMC_DEPTH'] :
|
||||
$featureValue = new FeatureValue((int)($feature['id_feature_value']));
|
||||
$featuresTab['longueur'] = $featureValue->value[(int)($cookie->id_lang)];
|
||||
$featuresTab['longueur'] = $featureValue->value[(int)$this->context->language->id];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user