// Context part 11
This commit is contained in:
@@ -65,15 +65,15 @@ class authorizeAIM extends PaymentModule
|
||||
|
||||
public function hookOrderConfirmation($params)
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
if ($params['objOrder']->module != $this->name)
|
||||
return;
|
||||
|
||||
if ($params['objOrder']->getCurrentState() != _PS_OS_ERROR_)
|
||||
$smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id)));
|
||||
$context->controller->smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id)));
|
||||
else
|
||||
$smarty->assign('status', 'failed');
|
||||
$context->controller->smarty->assign('status', 'failed');
|
||||
|
||||
return $this->display(__FILE__, 'hookorderconfirmation.tpl');
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class authorizeAIM extends PaymentModule
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
global $cookie, $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
if (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off' AND Configuration::get('PS_SSL_ENABLED'))
|
||||
{
|
||||
@@ -156,8 +156,8 @@ class authorizeAIM extends PaymentModule
|
||||
$authorizeAIMParams['x_amount'] = number_format($params['cart']->getOrderTotal(true, 3), 2, '.', '');
|
||||
$authorizeAIMParams['x_address'] = $invoiceAddress->address1.' '.$invoiceAddress->address2;
|
||||
$authorizeAIMParams['x_zip'] = $invoiceAddress->postcode;
|
||||
$authorizeAIMParams['x_first_name'] = $customer->firstname;
|
||||
$authorizeAIMParams['x_last_name'] = $customer->lastname;
|
||||
$authorizeAIMParams['x_first_name'] = $context->customer->firstname;
|
||||
$authorizeAIMParams['x_last_name'] = $context->customer->lastname;
|
||||
|
||||
$isFailed = Tools::getValue('aimerror');
|
||||
|
||||
@@ -167,9 +167,9 @@ class authorizeAIM extends PaymentModule
|
||||
$cards['discover'] = Configuration::get('AUTHORIZE_AIM_CARD_DISCOVER') == 'on' ? 1 : 0;
|
||||
$cards['ax'] = Configuration::get('AUTHORIZE_AIM_CARD_AX') == 'on' ? 1 : 0;
|
||||
|
||||
$smarty->assign('p', $authorizeAIMParams);
|
||||
$smarty->assign('cards', $cards);
|
||||
$smarty->assign('isFailed', $isFailed);
|
||||
$context->controller->smarty->assign('p', $authorizeAIMParams);
|
||||
$context->controller->smarty->assign('cards', $cards);
|
||||
$context->controller->smarty->assign('isFailed', $isFailed);
|
||||
|
||||
return $this->display(__FILE__, 'authorizeaim.tpl');
|
||||
}
|
||||
|
||||
@@ -169,9 +169,9 @@ class BankWire extends PaymentModule
|
||||
if (!$this->_checkCurrency($cart))
|
||||
Tools::redirect('index.php?controller=order');
|
||||
|
||||
global $cookie, $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'nbProducts' => $cart->nbProducts(),
|
||||
'cust_currency' => $cart->id_currency,
|
||||
'currencies' => $this->getCurrency((int)$cart->id_currency),
|
||||
@@ -190,9 +190,9 @@ class BankWire extends PaymentModule
|
||||
if (!$this->_checkCurrency($params['cart']))
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'this_path' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
|
||||
));
|
||||
@@ -204,10 +204,10 @@ class BankWire extends PaymentModule
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
$state = $params['objOrder']->getCurrentState();
|
||||
if ($state == _PS_OS_BANKWIRE_ OR $state == _PS_OS_OUTOFSTOCK_)
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
|
||||
'bankwireDetails' => nl2br2($this->details),
|
||||
'bankwireAddress' => nl2br2($this->address),
|
||||
@@ -216,7 +216,7 @@ class BankWire extends PaymentModule
|
||||
'id_order' => $params['objOrder']->id
|
||||
));
|
||||
else
|
||||
$smarty->assign('status', 'failed');
|
||||
$context->controller->smarty->assign('status', 'failed');
|
||||
return $this->display(__FILE__, 'payment_return.tpl');
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class BirthdayPresent extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
$context = Context::getContext();
|
||||
|
||||
if (Tools::isSubmit('submitBirthday'))
|
||||
{
|
||||
@@ -57,7 +57,7 @@ class BirthdayPresent extends Module
|
||||
Configuration::updateValue('BIRTHDAY_DISCOUNT_TYPE', (int)(Tools::getValue('id_discount_type')));
|
||||
Configuration::updateValue('BIRTHDAY_DISCOUNT_VALUE', (float)(Tools::getValue('discount_value')));
|
||||
Configuration::updateValue('BIRTHDAY_MINIMAL_ORDER', (float)(Tools::getValue('minimal_order')));
|
||||
Tools::redirectAdmin($currentIndex.'&configure=birthdaypresent&token='.Tools::getValue('token').'&conf=4');
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&configure=birthdaypresent&token='.Tools::getValue('token').'&conf=4');
|
||||
}
|
||||
|
||||
$this->_html = '
|
||||
@@ -73,7 +73,7 @@ class BirthdayPresent extends Module
|
||||
<label>'.$this->l('Type').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="id_discount_type">';
|
||||
$discountTypes = Discount::getDiscountTypes((int)($cookie->id_lang));
|
||||
$discountTypes = Discount::getDiscountTypes($context->language->id);
|
||||
foreach ($discountTypes AS $discountType)
|
||||
$this->_html .= '<option value="'.(int)($discountType['id_discount_type']).'"'.((Configuration::get('BIRTHDAY_DISCOUNT_TYPE') == $discountType['id_discount_type']) ? ' selected="selected"' : '').'>'.$discountType['name'].'</option>';
|
||||
$this->_html .= '
|
||||
|
||||
@@ -112,8 +112,6 @@ class BlockAdvertising extends Module
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$errors = '';
|
||||
if (Tools::isSubmit('submitDeleteImgConf'))
|
||||
$this->_deleteCurrentImg();
|
||||
@@ -167,7 +165,7 @@ class BlockAdvertising extends Module
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
global $protocol_content;
|
||||
$context = Context::getContext();
|
||||
|
||||
$this->postProcess();
|
||||
$output = '';
|
||||
@@ -177,7 +175,7 @@ class BlockAdvertising extends Module
|
||||
<a href="'.$this->adv_link.'" target="_blank" title="'.$this->adv_title.'">';
|
||||
if ($this->adv_img)
|
||||
{
|
||||
$output .= '<img src="'.$protocol_content.$this->adv_img.'" alt="'.$this->adv_title.'" title="'.$this->adv_title.'" style="height:163px;margin-left: 100px;width:163px"/>';
|
||||
$output .= '<img src="'.$context->link->protocol_content.$this->adv_img.'" alt="'.$this->adv_title.'" title="'.$this->adv_title.'" style="height:163px;margin-left: 100px;width:163px"/>';
|
||||
$output .= '<input class="button" type="submit" name="submitDeleteImgConf" value="'.$this->l('Delete image').'" style=""/>';
|
||||
}
|
||||
else
|
||||
|
||||
@@ -99,7 +99,7 @@ class BlockBestSellers extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
$currency = new Currency((int)($params['cookie']->id_currency));
|
||||
$bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 5);
|
||||
if (!$bestsellers AND !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY'))
|
||||
@@ -110,7 +110,7 @@ class BlockBestSellers extends Module
|
||||
$bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product'])), $currency);
|
||||
$best_sellers[] = $bestseller;
|
||||
}
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'best_sellers' => $best_sellers,
|
||||
'mediumSize' => Image::getSize('medium')));
|
||||
return $this->display(__FILE__, 'blockbestsellers.tpl');
|
||||
|
||||
@@ -24,13 +24,7 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
global $cookie;
|
||||
|
||||
include(dirname(__FILE__).'/blockcart.php');
|
||||
|
||||
$cart = new Cart((int)($cookie->id_cart));
|
||||
$cart->id_lang = (int)($cookie->id_lang);
|
||||
|
||||
$context = Context::getContext();
|
||||
$blockCart = new BlockCart();
|
||||
echo $blockCart->hookAjaxCall(array('cookie' => $cookie, 'cart' => $cart));
|
||||
echo $blockCart->hookAjaxCall(array('cookie' => $context->cookie, 'cart' => $context->cart));
|
||||
@@ -46,7 +46,8 @@ class BlockCart extends Module
|
||||
|
||||
public function smartyAssigns(&$smarty, &$params)
|
||||
{
|
||||
global $errors, $cookie;
|
||||
global $errors;
|
||||
$context = Context::getContext();
|
||||
|
||||
// Set currency
|
||||
if (!(int)($params['cart']->id_currency))
|
||||
@@ -99,7 +100,7 @@ class BlockCart extends Module
|
||||
));
|
||||
if (sizeof($errors))
|
||||
$smarty->assign('errors', $errors);
|
||||
if(isset($cookie->ajax_blockcart_display))
|
||||
if(isset($context->cookie->ajax_blockcart_display))
|
||||
$smarty->assign('colapseExpandStatus', $cookie->ajax_blockcart_display);
|
||||
}
|
||||
|
||||
@@ -159,9 +160,9 @@ class BlockCart extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return;
|
||||
|
||||
global $smarty;
|
||||
$smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false);
|
||||
$this->smartyAssigns($smarty, $params);
|
||||
$context = Context::getContext();
|
||||
$context->controller->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false);
|
||||
$this->smartyAssigns($context->controller->smarty, $params);
|
||||
return $this->display(__FILE__, 'blockcart.tpl');
|
||||
}
|
||||
|
||||
@@ -175,8 +176,8 @@ class BlockCart extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return;
|
||||
|
||||
global $smarty;
|
||||
$this->smartyAssigns($smarty, $params);
|
||||
$context = Context::getContext();
|
||||
$this->smartyAssigns($context->controller->smarty, $params);
|
||||
$res = $this->display(__FILE__, 'blockcart-json.tpl');
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ class BlockCategories extends Module
|
||||
|
||||
public function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0)
|
||||
{
|
||||
global $link;
|
||||
$context = Context::getContext();
|
||||
|
||||
$children = array();
|
||||
if (isset($resultParents[$id_category]) AND sizeof($resultParents[$id_category]) AND ($maxDepth == 0 OR $currentDepth < $maxDepth))
|
||||
@@ -132,7 +132,7 @@ class BlockCategories extends Module
|
||||
$children[] = $this->getTree($resultParents, $resultIds, $maxDepth, $subcat['id_category'], $currentDepth + 1);
|
||||
if (!isset($resultIds[$id_category]))
|
||||
return false;
|
||||
$return = array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']),
|
||||
$return = array('id' => $id_category, 'link' => $context->link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']),
|
||||
'name' => $resultIds[$id_category]['name'], 'desc'=> $resultIds[$id_category]['description'],
|
||||
'children' => $children);
|
||||
return $return;
|
||||
|
||||
@@ -115,14 +115,14 @@ class BlockCms extends Module
|
||||
|
||||
private function getBlocksCMS($location)
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
return Db::getInstance()->ExecuteS('
|
||||
SELECT bc.`id_cms_block`, bcl.`name` block_name, ccl.`name` category_name, bc.`position`, bc.`id_cms_category`, bc.`display_store`
|
||||
FROM `'._DB_PREFIX_.'cms_block` bc
|
||||
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl ON (bc.`id_cms_category` = ccl.`id_cms_category`)
|
||||
INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl ON (bc.`id_cms_block` = bcl.`id_cms_block`)
|
||||
WHERE ccl.`id_lang` = '.(int)$cookie->id_lang.' AND bc.`location` = '.(int)$location.' AND bcl.`id_lang` = '.(int)$cookie->id_lang.'
|
||||
WHERE ccl.`id_lang` = '.(int)$context->language->id.' AND bc.`location` = '.(int)$location.' AND bcl.`id_lang` = '.(int)$context->language->id.'
|
||||
ORDER BY bc.`position`');
|
||||
}
|
||||
|
||||
@@ -299,8 +299,7 @@ class BlockCms extends Module
|
||||
|
||||
private function _displayForm()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$cms_blocks_left = $this->getBlocksCMS(0);
|
||||
$cms_blocks_right = $this->getBlocksCMS(1);
|
||||
|
||||
@@ -311,7 +310,7 @@ class BlockCms extends Module
|
||||
<fieldset>
|
||||
<legend><img src="'._PS_BASE_URL_.__PS_BASE_URI__.'modules/'.$this->name.'/logo.gif" alt="" /> '.$this->l('CMS block configuration').'</legend>
|
||||
|
||||
<p><a href="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&addBlockCMS"><img src="'._PS_ADMIN_IMG_.'add.gif" alt="" /> '.$this->l('Add a new CMS block').'</a></p>';
|
||||
<p><a href="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&addBlockCMS"><img src="'._PS_ADMIN_IMG_.'add.gif" alt="" /> '.$this->l('Add a new CMS block').'</a></p>';
|
||||
|
||||
$this->_html .= '<div style="width:440px; float:left; margin-right:10px;" ><h3>'.$this->l('List of Left CMS blocks').'</h3>';
|
||||
if (sizeof($cms_blocks_left))
|
||||
@@ -337,14 +336,14 @@ class BlockCms extends Module
|
||||
<td width="30%" class="center">'.(empty($cms_block['block_name']) ? $cms_block['category_name'] : $cms_block['block_name']).'</td>
|
||||
<td width="30%" class="center">'.$cms_block['category_name'].'</td>
|
||||
<td class="center pointer dragHandle">
|
||||
<a'.(($cms_block['position'] == (sizeof($cms_blocks_left) - 1) OR sizeof($cms_blocks_left) == 1) ? ' style="display: none;"' : '').' href="'.$currentIndex.'&configure=blockcms&id_cms_block='.$cms_block['id_cms_block'].'&way=1&position='.(int)($cms_block['position'] + 1).'&location=0&token='.Tools::getAdminTokenLite('AdminModules').'">
|
||||
<a'.(($cms_block['position'] == (sizeof($cms_blocks_left) - 1) OR sizeof($cms_blocks_left) == 1) ? ' style="display: none;"' : '').' href="'.AdminTab::$currentIndex.'&configure=blockcms&id_cms_block='.$cms_block['id_cms_block'].'&way=1&position='.(int)($cms_block['position'] + 1).'&location=0&token='.Tools::getAdminTokenLite('AdminModules').'">
|
||||
<img src="../img/admin/down.gif" alt="'.$this->l('Down').'" title="'.$this->l('Down').'" /></a>
|
||||
<a'.($cms_block['position'] == 0 ? ' style="display: none;"' : '').' href="'.$currentIndex.'&configure=blockcms&id_cms_block='.$cms_block['id_cms_block'].'&way=0&position='.(int)($cms_block['position'] - 1).'&location=0&token='.Tools::getAdminTokenLite('AdminModules').'">
|
||||
<a'.($cms_block['position'] == 0 ? ' style="display: none;"' : '').' href="'.AdminTab::$currentIndex.'&configure=blockcms&id_cms_block='.$cms_block['id_cms_block'].'&way=0&position='.(int)($cms_block['position'] - 1).'&location=0&token='.Tools::getAdminTokenLite('AdminModules').'">
|
||||
<img src="../img/admin/up.gif" alt="'.$this->l('Up').'" title="'.$this->l('Up').'" /></a>
|
||||
</td>
|
||||
<td width="10%" class="center">
|
||||
<a href="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&editBlockCMS&id_cms_block='.(int)($cms_block['id_cms_block']).'" title="'.$this->l('Edit').'"><img src="'._PS_ADMIN_IMG_.'edit.gif" alt="" /></a>
|
||||
<a href="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteBlockCMS&id_cms_block='.(int)($cms_block['id_cms_block']).'" title="'.$this->l('Delete').'"><img src="'._PS_ADMIN_IMG_.'delete.gif" alt="" /></a>
|
||||
<a href="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&editBlockCMS&id_cms_block='.(int)($cms_block['id_cms_block']).'" title="'.$this->l('Edit').'"><img src="'._PS_ADMIN_IMG_.'edit.gif" alt="" /></a>
|
||||
<a href="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteBlockCMS&id_cms_block='.(int)($cms_block['id_cms_block']).'" title="'.$this->l('Delete').'"><img src="'._PS_ADMIN_IMG_.'delete.gif" alt="" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
@@ -380,14 +379,14 @@ class BlockCms extends Module
|
||||
<td width="30%" class="center">'.(empty($cms_block['block_name']) ? $cms_block['category_name'] : $cms_block['block_name']).'</td>
|
||||
<td width="30%" class="center">'.$cms_block['category_name'].'</td>
|
||||
<td class="center pointer dragHandle">
|
||||
<a'.(($cms_block['position'] == (sizeof($cms_blocks_right) - 1) OR sizeof($cms_blocks_right) == 1) ? ' style="display: none;"' : '').' href="'.$currentIndex.'&configure=blockcms&id_cms_block='.$cms_block['id_cms_block'].'&way=1&position='.(int)($cms_block['position'] + 1).'&location=1&token='.Tools::getAdminTokenLite('AdminModules').'">
|
||||
<a'.(($cms_block['position'] == (sizeof($cms_blocks_right) - 1) OR sizeof($cms_blocks_right) == 1) ? ' style="display: none;"' : '').' href="'.AdminTab::$currentIndex.'&configure=blockcms&id_cms_block='.$cms_block['id_cms_block'].'&way=1&position='.(int)($cms_block['position'] + 1).'&location=1&token='.Tools::getAdminTokenLite('AdminModules').'">
|
||||
<img src="../img/admin/down.gif" alt="'.$this->l('Down').'" title="'.$this->l('Down').'" /></a>
|
||||
<a'.($cms_block['position'] == 0 ? ' style="display: none;"' : '').' href="'.$currentIndex.'&configure=blockcms&id_cms_block='.$cms_block['id_cms_block'].'&way=0&position='.(int)($cms_block['position'] - 1).'&location=1&token='.Tools::getAdminTokenLite('AdminModules').'">
|
||||
<a'.($cms_block['position'] == 0 ? ' style="display: none;"' : '').' href="'.AdminTab::$currentIndex.'&configure=blockcms&id_cms_block='.$cms_block['id_cms_block'].'&way=0&position='.(int)($cms_block['position'] - 1).'&location=1&token='.Tools::getAdminTokenLite('AdminModules').'">
|
||||
<img src="../img/admin/up.gif" alt="'.$this->l('Up').'" title="'.$this->l('Up').'" /></a>
|
||||
</td>
|
||||
<td width="10%" class="center">
|
||||
<a href="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&editBlockCMS&id_cms_block='.(int)($cms_block['id_cms_block']).'" title="'.$this->l('Edit').'"><img src="'._PS_ADMIN_IMG_.'edit.gif" alt="" /></a>
|
||||
<a href="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteBlockCMS&id_cms_block='.(int)($cms_block['id_cms_block']).'" title="'.$this->l('Delete').'"><img src="'._PS_ADMIN_IMG_.'delete.gif" alt="" /></a>
|
||||
<a href="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&editBlockCMS&id_cms_block='.(int)($cms_block['id_cms_block']).'" title="'.$this->l('Edit').'"><img src="'._PS_ADMIN_IMG_.'edit.gif" alt="" /></a>
|
||||
<a href="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteBlockCMS&id_cms_block='.(int)($cms_block['id_cms_block']).'" title="'.$this->l('Delete').'"><img src="'._PS_ADMIN_IMG_.'delete.gif" alt="" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
@@ -410,7 +409,7 @@ class BlockCms extends Module
|
||||
<th width="3%">'.$this->l('ID').'</th>
|
||||
<th width="94%">'.$this->l('Name').'</th>
|
||||
</tr>';
|
||||
$this->displayRecurseCheckboxes(CMSCategory::getRecurseCategory($cookie->id_lang), explode('|', Configuration::get('FOOTER_CMS')));
|
||||
$this->displayRecurseCheckboxes(CMSCategory::getRecurseCategory($context->language->id), explode('|', Configuration::get('FOOTER_CMS')));
|
||||
$this->_html .= '
|
||||
</table>
|
||||
<p class="center"><input type="submit" class="button" name="submitFooterCMS" value="'.$this->l('Save').'" /></p>
|
||||
@@ -420,8 +419,7 @@ class BlockCms extends Module
|
||||
|
||||
private function _displayAddForm()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$defaultLanguage = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
$languages = Language::getLanguages(false);
|
||||
$divLangName = 'name';
|
||||
@@ -460,7 +458,7 @@ class BlockCms extends Module
|
||||
<label for="id_category">'.$this->l('Choose a CMS category:').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="id_category" id="id_category" onchange="CMSCategory_js($(this).val(), \''.$this->secure_key.'\')">';
|
||||
$categories = CMSCategory::getCategories((int)($cookie->id_lang), false);
|
||||
$categories = CMSCategory::getCategories($context->language->id, false);
|
||||
$this->_html .= CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, ($cmsBlock != NULL ? $cmsBlock[0]['id_cms_category'] : 1), 1);
|
||||
$this->_html .= '
|
||||
</select>
|
||||
@@ -487,7 +485,7 @@ class BlockCms extends Module
|
||||
$this->_html .= '<div id="cms_subcategories"></div>
|
||||
<p class="center">
|
||||
<input type="submit" class="button" name="submitBlockCMS" value="'.$this->l('Save').'" />
|
||||
<a class="button" style="position:relative; padding:3px 3px 4px 3px; top:1px" href="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'">'.$this->l('Cancel').'</a>
|
||||
<a class="button" style="position:relative; padding:3px 3px 4px 3px; top:1px" href="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'">'.$this->l('Cancel').'</a>
|
||||
</p>';
|
||||
|
||||
$this->_html .= '
|
||||
@@ -568,13 +566,11 @@ class BlockCms extends Module
|
||||
SET `position` = '.((int)Tools::getValue('position')).'
|
||||
WHERE `id_cms_block` = '.(int)Tools::getValue('id_cms_block'));
|
||||
}
|
||||
Tools::redirectAdmin($currentIndex.'index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules'));
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules'));
|
||||
}
|
||||
|
||||
private function _postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('submitBlockCMS'))
|
||||
{
|
||||
$position = Db::getInstance()->getValue('
|
||||
@@ -641,9 +637,9 @@ class BlockCms extends Module
|
||||
VALUES('.(int)$id_cms_block.', '.(int)$cms_properties[1].', '.(int)$cms_properties[0].')');
|
||||
}
|
||||
if (Tools::isSubmit('addBlockCMS'))
|
||||
Tools::redirectAdmin($currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&addBlockCMSConfirmation');
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&addBlockCMSConfirmation');
|
||||
elseif (Tools::isSubmit('editBlockCMS'))
|
||||
Tools::redirectAdmin($currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&editBlockCMSConfirmation');
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&editBlockCMSConfirmation');
|
||||
}
|
||||
elseif (Tools::isSubmit('deleteBlockCMS') AND Tools::getValue('id_cms_block'))
|
||||
{
|
||||
@@ -664,7 +660,7 @@ class BlockCms extends Module
|
||||
DELETE FROM `'._DB_PREFIX_.'cms_block_page`
|
||||
WHERE `id_cms_block` = '.(int)(Tools::getValue('id_cms_block')));
|
||||
|
||||
Tools::redirectAdmin($currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteBlockCMSConfirmation');
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteBlockCMSConfirmation');
|
||||
}
|
||||
else
|
||||
$this->_html .= $this->displayError($this->l('Error: you are trying to delete a non-existent block cms'));
|
||||
@@ -705,10 +701,9 @@ class BlockCms extends Module
|
||||
|
||||
public function hookLeftColumn()
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
$context = Context::getContext();
|
||||
$cms_titles = self::getCMStitles(self::LEFT_COLUMN);
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'block' => 1,
|
||||
'cms_titles' => $cms_titles,
|
||||
'theme_dir' => _PS_THEME_DIR_
|
||||
@@ -718,10 +713,10 @@ class BlockCms extends Module
|
||||
|
||||
public function hookRightColumn()
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$cms_titles = self::getCMStitles(self::RIGHT_COLUMN);
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'block' => 1,
|
||||
'cms_titles' => $cms_titles,
|
||||
'theme_dir' => _PS_THEME_DIR_
|
||||
@@ -731,12 +726,12 @@ class BlockCms extends Module
|
||||
|
||||
public function hookFooter()
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
if (Configuration::get('FOOTER_BLOCK_ACTIVATION'))
|
||||
{
|
||||
$cms_titles = self::getCMStitlesFooter();
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'block' => 0,
|
||||
'cmslinks' => $cms_titles,
|
||||
'theme_dir' => _PS_THEME_DIR_,
|
||||
|
||||
@@ -60,13 +60,13 @@ class BlockCurrencies extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$id_current_shop = $this->shopID;
|
||||
$currencies = Currency::getCurrencies(false, 1, $id_current_shop);
|
||||
if (!sizeof($currencies))
|
||||
return '';
|
||||
$smarty->assign('currencies', $currencies);
|
||||
$context->controller->smarty->assign('currencies', $currencies);
|
||||
return $this->display(__FILE__, 'blockcurrencies.tpl');
|
||||
}
|
||||
|
||||
|
||||
@@ -57,12 +57,12 @@ class BlockLanguages extends Module
|
||||
*/
|
||||
function hookTop($params)
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$languages = Language::getLanguages(true, $this->shopID);
|
||||
if (!sizeof($languages))
|
||||
return '';
|
||||
$smarty->assign('languages', $languages);
|
||||
$context->controller->smarty->assign('languages', $languages);
|
||||
return $this->display(__FILE__, 'blocklanguages.tpl');
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
* International Registred Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
global $cookie;
|
||||
|
||||
include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../init.php');
|
||||
include(dirname(__FILE__).'/blocklayered.php');
|
||||
|
||||
@@ -405,8 +405,7 @@ class BlockLayered extends Module
|
||||
|
||||
public function generateFiltersBlock($selectedFilters = array())
|
||||
{
|
||||
global $smarty, $link, $cookie;
|
||||
$id_lang = (int)$cookie->id_lang;
|
||||
$context = Context::getContext();
|
||||
|
||||
/* If the current category isn't defined of if it's homepage, we have nothing to display */
|
||||
$id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1));
|
||||
@@ -420,7 +419,7 @@ class BlockLayered extends Module
|
||||
SELECT c.id_category, c.id_parent, cl.name
|
||||
FROM '._DB_PREFIX_.'category c
|
||||
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)$cookie->id_lang.'
|
||||
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.'
|
||||
ORDER BY c.position ASC');
|
||||
|
||||
$whereC = ' cp.`id_category` = '.(int)$id_parent.' OR ';
|
||||
@@ -483,7 +482,7 @@ class BlockLayered extends Module
|
||||
SELECT fvl.id_feature_value, fvl.value
|
||||
FROM '._DB_PREFIX_.'feature_value fv
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fv.id_feature_value)
|
||||
WHERE (fv.custom IS NULL OR fv.custom = 0) AND fv.id_feature = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND fvl.id_lang = '.(int)$id_lang);
|
||||
WHERE (fv.custom IS NULL OR fv.custom = 0) AND fv.id_feature = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND fvl.id_lang = '.(int)$context->language->id);
|
||||
|
||||
break;
|
||||
|
||||
@@ -494,7 +493,7 @@ class BlockLayered extends Module
|
||||
SELECT al.id_attribute, al.name, a.color
|
||||
FROM '._DB_PREFIX_.'attribute a
|
||||
LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON (al.id_attribute = a.id_attribute)
|
||||
WHERE a.id_attribute_group = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND al.id_lang = '.(int)$id_lang);
|
||||
WHERE a.id_attribute_group = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND al.id_lang = '.(int)$context->language->id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -505,7 +504,7 @@ class BlockLayered extends Module
|
||||
$fNames = Db::getInstance()->ExecuteS('
|
||||
SELECT id_feature, name
|
||||
FROM '._DB_PREFIX_.'feature_lang
|
||||
WHERE id_lang = '.(int)$cookie->id_lang.' AND id_feature IN ('.implode(',', $f).')');
|
||||
WHERE id_lang = '.(int)$context->language->id.' AND id_feature IN ('.implode(',', $f).')');
|
||||
$fNameByID = array();
|
||||
foreach ($fNames AS $fName)
|
||||
$fNameByID[(int)$fName['id_feature']] = $fName['name'];
|
||||
@@ -518,7 +517,7 @@ class BlockLayered extends Module
|
||||
SELECT ag.id_attribute_group, agl.public_name, ag.is_color_group
|
||||
FROM '._DB_PREFIX_.'attribute_group ag
|
||||
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.id_attribute_group = ag.id_attribute_group)
|
||||
WHERE agl.id_lang = '.(int)$cookie->id_lang.' AND ag.id_attribute_group IN ('.implode(',', $a).')');
|
||||
WHERE agl.id_lang = '.(int)$context->language->id.' AND ag.id_attribute_group IN ('.implode(',', $a).')');
|
||||
|
||||
$aNameByID = $colorGroups = array();
|
||||
foreach ($aNames AS $aName)
|
||||
@@ -714,9 +713,9 @@ class BlockLayered extends Module
|
||||
foreach ($_GET as $key => $val)
|
||||
$params .= $key.'='.$val.'&';
|
||||
|
||||
$share_url = $link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$cookie->id_lang], (int)$cookie->id_lang).rtrim($params, '&');
|
||||
$share_url = $context->link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$context->language->id], $context->language->id).rtrim($params, '&');
|
||||
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'display_share' => (int)Configuration::get('PS_LAYERED_SHARE'),
|
||||
'share_url' => $this->getShortLink($share_url),
|
||||
'layered_use_checkboxes' => (int)Configuration::get('PS_LAYERED_NAVIGATION_CHECKBOXES'),
|
||||
@@ -731,11 +730,11 @@ class BlockLayered extends Module
|
||||
|
||||
public function ajaxCall()
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
$selectedFilters = $this->getSelectedFilters();
|
||||
$products = $this->getProductByFilters($selectedFilters);
|
||||
$products = Product::getProductsProperties((int)$cookie->id_lang, $products);
|
||||
$products = Product::getProductsProperties($context->language->id, $products);
|
||||
$nbProducts = $this->nbr_products;
|
||||
$range = 2; /* how many pages around page selected */
|
||||
|
||||
@@ -757,7 +756,7 @@ class BlockLayered extends Module
|
||||
if ($stop > $pages_nb)
|
||||
$stop = (int)($pages_nb);
|
||||
|
||||
$smarty->assign('nb_products', $nbProducts);
|
||||
$context->controller->smarty->assign('nb_products', $nbProducts);
|
||||
$pagination_infos = array(
|
||||
'pages_nb' => (int)($pages_nb),
|
||||
'p' => (int)($p),
|
||||
@@ -767,15 +766,15 @@ class BlockLayered extends Module
|
||||
'stop' => (int)($stop),
|
||||
'nArray' => $nArray = (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 10 ? array((int)(Configuration::get('PS_PRODUCTS_PER_PAGE')), 10, 20, 50) : array(10, 20, 50)
|
||||
);
|
||||
$smarty->assign($pagination_infos);
|
||||
$context->controller->smarty->assign($pagination_infos);
|
||||
|
||||
$smarty->assign('products', $products);
|
||||
$context->controller->smarty->assign('products', $products);
|
||||
|
||||
/* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
|
||||
return Tools::jsonEncode(array(
|
||||
'filtersBlock' => $this->generateFiltersBlock($selectedFilters),
|
||||
'productList' => $smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'),
|
||||
'pagination' => $smarty->fetch(_PS_THEME_DIR_.'pagination.tpl')
|
||||
'productList' => $context->controller->smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'),
|
||||
'pagination' => $context->controller->smarty->fetch(_PS_THEME_DIR_.'pagination.tpl')
|
||||
));
|
||||
// return '<div id="layered_ajax_column">'.$this->generateFiltersBlock($selectedFilters).'</div><div id="layered_ajax_products">'.$smarty->fetch(_PS_THEME_DIR_.'product-list.tpl').'</div>';
|
||||
}
|
||||
|
||||
@@ -83,14 +83,14 @@ class BlockLink extends Module
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
global $cookie, $smarty;
|
||||
$context = Context::getContext();
|
||||
$links = $this->getLinks();
|
||||
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'blocklink_links' => $links,
|
||||
'title' => Configuration::get('PS_BLOCKLINK_TITLE', $cookie->id_lang),
|
||||
'title' => Configuration::get('PS_BLOCKLINK_TITLE', $context->language->id),
|
||||
'url' => Configuration::get('PS_BLOCKLINK_URL'),
|
||||
'lang' => 'text_'.$cookie->id_lang
|
||||
'lang' => 'text_'.$context->language->id
|
||||
));
|
||||
if (!$links)
|
||||
return false;
|
||||
@@ -255,7 +255,6 @@ class BlockLink extends Module
|
||||
|
||||
private function _displayForm()
|
||||
{
|
||||
global $cookie;
|
||||
/* Language */
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = Language::getLanguages(false);
|
||||
@@ -329,15 +328,14 @@ class BlockLink extends Module
|
||||
private function _list()
|
||||
{
|
||||
$links = $this->getLinks();
|
||||
|
||||
global $currentIndex, $cookie, $adminObj;
|
||||
$context = Context::getContext();
|
||||
$languages = Language::getLanguages();
|
||||
if ($links)
|
||||
{
|
||||
$this->_html .= '
|
||||
<script type="text/javascript">
|
||||
var currentUrl = \''.$currentIndex.'&configure='.$this->name.'\';
|
||||
var token=\''.$adminObj->token.'\';
|
||||
var currentUrl = \''.AdminTab::$currentIndex.'&configure='.$this->name.'\';
|
||||
var token=\''.$context->tab->token.'\';
|
||||
var links = new Array();';
|
||||
foreach ($links AS $link)
|
||||
{
|
||||
@@ -371,7 +369,7 @@ class BlockLink extends Module
|
||||
$this->_html .= '
|
||||
<tr>
|
||||
<td>'.$link['id'].'</td>
|
||||
<td>'.$link['text_'.$cookie->id_lang].'</td>
|
||||
<td>'.$link['text_'.$context->language->id].'</td>
|
||||
<td>'.$link['url'].'</td>
|
||||
<td>
|
||||
<img src="../img/admin/edit.gif" alt="" title="" onclick="linkEdition('.$link['id'].')" style="cursor: pointer" />
|
||||
|
||||
@@ -54,11 +54,11 @@ class BlockManufacturer extends Module
|
||||
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
global $smarty, $link;
|
||||
$context = Context::getContext();
|
||||
//$getNbProducts = false, $id_lang = 0, $active = true, $p = false, $n = false, $all_group = false, $id_shop = false
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'manufacturers' => Manufacturer::getManufacturers(false, 0, true, false, false, false, $this->shopGroupID),
|
||||
'link' => $link,
|
||||
'link' => $context->link,
|
||||
'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
|
||||
'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'),
|
||||
'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'),
|
||||
|
||||
@@ -58,11 +58,10 @@ class BlockMyAccount extends Module
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (!$params['cookie']->isLogged())
|
||||
return false;
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')),
|
||||
'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN')),
|
||||
'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock')
|
||||
|
||||
@@ -96,12 +96,11 @@ class BlockNewProducts extends Module
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
$context = Context::getContext();
|
||||
$newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR')));
|
||||
if (!$newProducts AND !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
|
||||
return;
|
||||
$smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));
|
||||
$context->controller->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));
|
||||
|
||||
return $this->display(__FILE__, 'blocknewproducts.tpl');
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@ class Blocknewsletter extends Module
|
||||
*/
|
||||
private function newsletterRegistration()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
if (empty($_POST['email']) OR !Validate::isEmail($_POST['email']))
|
||||
return $this->error = $this->l('Invalid e-mail address');
|
||||
|
||||
@@ -194,11 +195,9 @@ class Blocknewsletter extends Module
|
||||
/* If the user ins't a customer */
|
||||
elseif ($registerStatus == -1)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$sql = 'INSERT INTO '._DB_PREFIX_.'newsletter (id_shop, id_group_shop, email, newsletter_date_add, ip_registration_newsletter, http_referer)
|
||||
VALUES ('.$this->shopID.', '.$this->shopGroupID.', \''.pSQL($_POST['email']).'\', NOW(), \''.pSQL(Tools::getRemoteAddr()).'\',
|
||||
(SELECT c.http_referer FROM '._DB_PREFIX_.'connections c WHERE c.id_guest = '.(int)($cookie->id_guest).' ORDER BY c.date_add DESC LIMIT 1)
|
||||
(SELECT c.http_referer FROM '._DB_PREFIX_.'connections c WHERE c.id_guest = '.(int)$context->customer->id.' ORDER BY c.date_add DESC LIMIT 1)
|
||||
)';
|
||||
if (!Db::getInstance()->Execute($sql))
|
||||
return $this->error = $this->l('Error during subscription');
|
||||
@@ -224,10 +223,9 @@ class Blocknewsletter extends Module
|
||||
|
||||
private function sendVoucher($email)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
if ($discount = Configuration::get('NW_VOUCHER_CODE'))
|
||||
return Mail::Send((int)($cookie->id_lang), 'newsletter_voucher', Mail::l('Newsletter voucher'), array('{discount}' => $discount), $email, NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
return Mail::Send($context->language->id, 'newsletter_voucher', Mail::l('Newsletter voucher'), array('{discount}' => $discount), $email, NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -238,14 +236,14 @@ class Blocknewsletter extends Module
|
||||
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
if (Tools::isSubmit('submitNewsletter'))
|
||||
{
|
||||
$this->newsletterRegistration();
|
||||
if ($this->error)
|
||||
{
|
||||
$smarty->assign(array('color' => 'red',
|
||||
$context->controller->smarty->assign(array('color' => 'red',
|
||||
'msg' => $this->error,
|
||||
'nw_value' => isset($_POST['email']) ? pSQL($_POST['email']) : false,
|
||||
'nw_error' => true,
|
||||
@@ -254,27 +252,15 @@ class Blocknewsletter extends Module
|
||||
elseif ($this->valid)
|
||||
{
|
||||
if (Configuration::get('NW_CONFIRMATION_EMAIL') AND isset($_POST['action']) AND (int)($_POST['action']) == 0)
|
||||
Mail::Send((int)($params['cookie']->id_lang), 'newsletter_conf', Mail::l('Newsletter confirmation'), array(), pSQL($_POST['email']), NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
$smarty->assign(array('color' => 'green',
|
||||
Mail::Send($params['cookie']->id_lang, 'newsletter_conf', Mail::l('Newsletter confirmation'), array(), pSQL($_POST['email']), NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
$context->controller->smarty->assign(array('color' => 'green',
|
||||
'msg' => $this->valid,
|
||||
'nw_error' => false));
|
||||
}
|
||||
}
|
||||
$smarty->assign('this_path', $this->_path);
|
||||
$context->controller->smarty->assign('this_path', $this->_path);
|
||||
return $this->display(__FILE__, 'blocknewsletter.tpl');
|
||||
}
|
||||
|
||||
public function confirmation()
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
return $this->display(__FILE__, 'newsletter.tpl');
|
||||
}
|
||||
|
||||
public function externalNewsletter(/*$params*/)
|
||||
{
|
||||
return $this->hookLeftColumn($params);
|
||||
}
|
||||
|
||||
function hookHeader($params)
|
||||
{
|
||||
|
||||
@@ -64,8 +64,7 @@ class BlockPaymentLogo extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$html = '
|
||||
<h2>'.$this->l('Payment logo').'</h2>
|
||||
';
|
||||
@@ -77,7 +76,7 @@ class BlockPaymentLogo extends Module
|
||||
$html .= $this->displayConfirmation($this->l('Settings are updated'));
|
||||
}
|
||||
|
||||
$cmss = CMS::listCms((int)($cookie->id_lang));
|
||||
$cmss = CMS::listCms($context->language->id);
|
||||
|
||||
if (!sizeof($cmss))
|
||||
$html .= $this->displayError($this->l('No CMS page is available'));
|
||||
@@ -113,14 +112,14 @@ class BlockPaymentLogo extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
|
||||
global $smarty, $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
if (!Configuration::get('PS_PAYMENT_LOGO_CMS_ID'))
|
||||
return;
|
||||
$cms = new CMS((int)(Configuration::get('PS_PAYMENT_LOGO_CMS_ID')), (int)($cookie->id_lang));
|
||||
$cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $context->language->id);
|
||||
if (!Validate::isLoadedObject($cms))
|
||||
return;
|
||||
$smarty->assign('cms_payement_logo', $cms);
|
||||
$context->controller->smarty->assign('cms_payement_logo', $cms);
|
||||
return $this->display(__FILE__, 'blockpaymentlogo.tpl');
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ class Blockrss extends Module
|
||||
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
// Conf
|
||||
$title = strval(Configuration::get('RSS_FEED_TITLE'));
|
||||
@@ -148,7 +148,7 @@ class Blockrss extends Module
|
||||
$rss_links[] = array('title' => $item->title, 'url' => $item->link);
|
||||
|
||||
// Display smarty
|
||||
$smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links));
|
||||
$context->controller->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links));
|
||||
|
||||
return $this->display(__FILE__, 'blockrss.tpl');
|
||||
}
|
||||
|
||||
@@ -86,10 +86,10 @@ class BlockSpecials extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
if (!$special = Product::getRandomSpecial((int)($params['cookie']->id_lang), false, false, $this->shopID) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY'))
|
||||
return;
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'special' => $special,
|
||||
'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2),
|
||||
'mediumSize' => Image::getSize('medium')
|
||||
|
||||
@@ -63,9 +63,10 @@ class BlockStore extends Module
|
||||
|
||||
function hookRightColumn($params)
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG'));
|
||||
|
||||
$context->controller->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG'));
|
||||
return $this->display(__FILE__, 'blockstore.tpl');
|
||||
}
|
||||
|
||||
|
||||
@@ -60,10 +60,10 @@ class BlockSupplier extends Module
|
||||
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
global $smarty, $link;
|
||||
$smarty->assign(array(
|
||||
$context = Context::getContext();
|
||||
$context->controller->smarty->assign(array(
|
||||
'suppliers' => Supplier::getSuppliers(false),
|
||||
'link' => $link,
|
||||
'link' => $context->link,
|
||||
'text_list' => Configuration::get('SUPPLIER_DISPLAY_TEXT'),
|
||||
'text_list_nb' => Configuration::get('SUPPLIER_DISPLAY_TEXT_NB'),
|
||||
'form_list' => Configuration::get('SUPPLIER_DISPLAY_FORM'),
|
||||
|
||||
@@ -100,14 +100,14 @@ class BlockTags extends Module
|
||||
*/
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$tags = Tag::getMainTags((int)($params['cookie']->id_lang), (int)(Configuration::get('BLOCKTAGS_NBR')));
|
||||
if (!sizeof($tags))
|
||||
return false;
|
||||
foreach ($tags AS &$tag)
|
||||
$tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']);
|
||||
$smarty->assign('tags', $tags);
|
||||
$context->controller->smarty->assign('tags', $tags);
|
||||
|
||||
return $this->display(__FILE__, 'blocktags.tpl');
|
||||
}
|
||||
|
||||
@@ -59,14 +59,14 @@ class BlockUserInfo extends Module
|
||||
{
|
||||
if (!$this->active)
|
||||
return;
|
||||
global $smarty, $cookie, $cart;
|
||||
$smarty->assign(array(
|
||||
'cart' => $cart,
|
||||
'cart_qties' => $cart->nbProducts(),
|
||||
'logged' => $cookie->isLogged(),
|
||||
'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
|
||||
'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
|
||||
'lastName' => ($cookie->logged ? $cookie->customer_lastname : false),
|
||||
$context = Context::getContext();
|
||||
$context->controller->smarty->assign(array(
|
||||
'cart' => $context->cart,
|
||||
'cart_qties' => $context->cart->nbProducts(),
|
||||
'logged' => $context->cookie->isLogged(),
|
||||
'customerName' => ($context->cookie->logged ? $context->customer->first_name.' '.$context->customer->lastname : false),
|
||||
'firstName' => ($context->cookie->logged ? $context->customer->firstname : false),
|
||||
'lastName' => ($context->cookie->logged ? $context->customer->lastname : false),
|
||||
'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
|
||||
));
|
||||
return $this->display(__FILE__, 'blockuserinfo.tpl');
|
||||
|
||||
@@ -93,8 +93,7 @@ class BlockViewed extends Module
|
||||
|
||||
function hookRightColumn($params)
|
||||
{
|
||||
global $link, $smarty, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$id_product = (int)(Tools::getValue('id_product'));
|
||||
$productsViewed = (isset($params['cookie']->viewed) AND !empty($params['cookie']->viewed)) ? array_slice(explode(',', $params['cookie']->viewed), 0, Configuration::get('PRODUCTS_VIEWED_NBR')) : array();
|
||||
|
||||
@@ -154,7 +153,7 @@ class BlockViewed extends Module
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = cp.`id_category`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer_group` cug ON (cug.`id_group` = cg.`id_group`)
|
||||
WHERE p.`id_product` = '.(int)($id_product).'
|
||||
'.($cookie->id_customer ? 'AND cug.`id_customer` = '.(int)($cookie->id_customer) :
|
||||
'.($context->customer->id ? 'AND cug.`id_customer` = '.(int)$context->customer->id :
|
||||
'AND cg.`id_group` = 1')
|
||||
);
|
||||
if ($result['total'])
|
||||
@@ -168,7 +167,7 @@ class BlockViewed extends Module
|
||||
if (!sizeof($productsViewedObj))
|
||||
return ;
|
||||
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'productsViewedObj' => $productsViewedObj,
|
||||
'mediumSize' => Image::getSize('medium')));
|
||||
|
||||
|
||||
@@ -108,8 +108,6 @@ class BlockWishList extends Module
|
||||
|
||||
private function _displayFormView()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$customers = Customer::getCustomers();
|
||||
if (!sizeof($customers))
|
||||
return;
|
||||
@@ -178,7 +176,8 @@ class BlockWishList extends Module
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
global $smarty, $errors;
|
||||
global $errors;
|
||||
$context = Context::getContext();
|
||||
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
if ($params['cookie']->isLogged())
|
||||
@@ -197,7 +196,7 @@ class BlockWishList extends Module
|
||||
}
|
||||
else
|
||||
$id_wishlist = $params['cookie']->id_wishlist;
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'id_wishlist' => $id_wishlist,
|
||||
'isLogged' => true,
|
||||
'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $params['cookie']->id_customer, $params['cookie']->id_lang, null, true)),
|
||||
@@ -205,7 +204,7 @@ class BlockWishList extends Module
|
||||
'ptoken' => Tools::getToken(false)));
|
||||
}
|
||||
else
|
||||
$smarty->assign(array('wishlist_products' => false, 'wishlists' => false));
|
||||
$context->controller->smarty->assign(array('wishlist_products' => false, 'wishlists' => false));
|
||||
return ($this->display(__FILE__, 'blockwishlist.tpl'));
|
||||
}
|
||||
|
||||
@@ -216,15 +215,13 @@ class BlockWishList extends Module
|
||||
|
||||
public function hookProductActions($params)
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
$smarty->assign('id_product', (int)(Tools::getValue('id_product')));
|
||||
$context = Context::getContext();
|
||||
$context->controller->smarty->assign('id_product', (int)(Tools::getValue('id_product')));
|
||||
return ($this->display(__FILE__, 'blockwishlist-extra.tpl'));
|
||||
}
|
||||
|
||||
public function hookCustomerAccount($params)
|
||||
{
|
||||
global $smarty;
|
||||
return $this->display(__FILE__, 'my-account.tpl');
|
||||
}
|
||||
|
||||
@@ -235,19 +232,19 @@ class BlockWishList extends Module
|
||||
|
||||
private function _displayProducts($id_wishlist)
|
||||
{
|
||||
global $cookie, $link;
|
||||
$context = Context::getContext();
|
||||
include_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
$wishlist = new WishList((int)($id_wishlist));
|
||||
$products = WishList::getProductByIdCustomer((int)($id_wishlist), (int)($wishlist->id_customer), (int)($cookie->id_lang));
|
||||
$wishlist = new WishList($id_wishlist);
|
||||
$products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $context->language->id);
|
||||
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
|
||||
{
|
||||
$images = $obj->getImages((int)($cookie->id_lang));
|
||||
$images = $obj->getImages($context->language->id);
|
||||
foreach ($images AS $k => $image)
|
||||
{
|
||||
if ($image['cover'])
|
||||
@@ -257,7 +254,7 @@ class BlockWishList extends Module
|
||||
}
|
||||
}
|
||||
if (!isset($products[$i]['cover']))
|
||||
$products[$i]['cover'] = Language::getIsoById((int)($cookie->id_lang)).'-default';
|
||||
$products[$i]['cover'] = $context->language->iso_code.'-default';
|
||||
}
|
||||
}
|
||||
$this->_html .= '
|
||||
|
||||
@@ -66,21 +66,20 @@ class CarrierCompare extends Module
|
||||
*/
|
||||
public function hookShoppingCart($params)
|
||||
{
|
||||
global $cookie, $smarty, $currency;
|
||||
|
||||
if ($cookie->id_customer)
|
||||
$context = Context::getContext();
|
||||
if ($context->customer->id)
|
||||
return;
|
||||
|
||||
$smarty->assign(array(
|
||||
'countries' => Country::getCountries((int)$cookie->id_lang),
|
||||
$context->controller->smarty->assign(array(
|
||||
'countries' => Country::getCountries($context->language->id),
|
||||
'id_carrier' => ($params['cart']->id_carrier ? $params['cart']->id_carrier : Configuration::get('PS_CARRIER_DEFAULT')),
|
||||
'id_country' => (isset($cookie->id_country) ? $cookie->id_country : Configuration::get('PS_COUNTRY_DEFAULT')),
|
||||
'id_state' => (isset($cookie->id_state) ? $cookie->id_state : 0),
|
||||
'zipcode' => (isset($cookie->postcode) ? $cookie->postcode : ''),
|
||||
'currencySign' => $currency->sign,
|
||||
'currencyRate' => $currency->conversion_rate,
|
||||
'currencyFormat' => $currency->format,
|
||||
'currencyBlank' => $currency->blank
|
||||
'id_country' => (isset($context->customer->geoloc_id_country) ? $context->customer->geoloc_id_country : Configuration::get('PS_COUNTRY_DEFAULT')),
|
||||
'id_state' => (isset($context->customer->geoloc_id_state) ? $context->customer->geoloc_id_state : 0),
|
||||
'zipcode' => (isset($context->customer->geoloc_postcode) ? $context->customer->geoloc_postcode : ''),
|
||||
'currencySign' => $context->currency->sign,
|
||||
'currencyRate' => $context->currency->conversion_rate,
|
||||
'currencyFormat' => $context->currency->format,
|
||||
'currencyBlank' => $context->currency->blank
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'carriercompare.tpl');
|
||||
@@ -102,8 +101,6 @@ class CarrierCompare extends Module
|
||||
*/
|
||||
public function getCarriersListByIdZone($id_country, $id_state = 0)
|
||||
{
|
||||
global $cart, $smarty;
|
||||
|
||||
$id_zone = 0;
|
||||
if ($id_state != 0)
|
||||
$id_zone = State::getIdZone($id_state);
|
||||
@@ -117,8 +114,7 @@ class CarrierCompare extends Module
|
||||
|
||||
public function saveSelection($id_country, $id_state, $zipcode, $id_carrier)
|
||||
{
|
||||
global $cart, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$errors = array();
|
||||
|
||||
if (!Validate::isInt($id_state))
|
||||
@@ -144,11 +140,11 @@ class CarrierCompare extends Module
|
||||
if (sizeof($errors))
|
||||
return $errors;
|
||||
|
||||
$cookie->id_country = $id_country;
|
||||
$cookie->id_state = $id_state;
|
||||
$cookie->postcode = $zipcode;
|
||||
$cart->id_carrier = $id_carrier;
|
||||
if (!$cart->update())
|
||||
$context->cookie->id_country = $id_country;
|
||||
$context->cookie->id_state = $id_state;
|
||||
$context->cookie->postcode = $zipcode;
|
||||
$context->cart->id_carrier = $id_carrier;
|
||||
if (!$context->cart->update())
|
||||
return array($this->l('Can\'t update the cart'));
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -58,8 +58,7 @@ class CashOnDelivery extends PaymentModule
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
|
||||
$context = Context::getContext();
|
||||
// Check if cart has product download
|
||||
foreach ($params['cart']->getProducts() AS $product)
|
||||
{
|
||||
@@ -68,7 +67,7 @@ class CashOnDelivery extends PaymentModule
|
||||
return false;
|
||||
}
|
||||
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'this_path' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
|
||||
));
|
||||
|
||||
@@ -166,10 +166,10 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
public function createDisposition($cart)
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
$currency = new Currency((int)($cart->id_currency));
|
||||
$language = $this->_getSupportedLanguageIsoById((int)($cookie->id_lang));
|
||||
$language = $this->_getSupportedLanguageIsoById($context->language->id);
|
||||
$mid = Configuration::get($this->prefix.'MERCHANT_ID_'.$currency->iso_code);
|
||||
$mtid = $cart->id.'-'.time();
|
||||
$amount = number_format((float)($cart->getOrderTotal(true, Cart::BOTH)), 2, '.','');
|
||||
@@ -353,14 +353,14 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
private function _displayInfos()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
return '<fieldset id="infos_cashticket">
|
||||
<legend><img src="'._MODULE_DIR_.$this->name.'/img/payment-small.png" alt="" />'.$this->displayName.'</legend>
|
||||
<center><img src="'._MODULE_DIR_.$this->name.'/img/payment.png" alt="" class="logo" /></center>
|
||||
'.$this->getL('introduction').'
|
||||
<br /><br />
|
||||
<a style="color: blue; text-decoration: underline" href="'.$this->_getRegisterLink((int)$cookie->id_lang).'">'.$this->getL('register').'</a>
|
||||
<a style="color: blue; text-decoration: underline" href="'.$this->_getRegisterLink($context->language->id).'">'.$this->getL('register').'</a>
|
||||
</fieldset>
|
||||
<div class="clear" /><br />';
|
||||
}
|
||||
@@ -534,7 +534,7 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
// check currency
|
||||
$currency = new Currency((int)($params['cart']->id_currency));
|
||||
@@ -555,7 +555,7 @@ abstract class PrepaidServices extends PaymentModule
|
||||
if ($amount > $this->max_amount)
|
||||
return false;
|
||||
|
||||
$smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
|
||||
$context->controller->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
|
||||
'payment_name' => $this->displayName,
|
||||
'module_name' => $this->name));
|
||||
|
||||
@@ -565,19 +565,19 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
public function hookPaymentReturn($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
if ($params['objOrder']->module != $this->name)
|
||||
return;
|
||||
|
||||
$smarty->assign('payment_name', $this->displayName);
|
||||
$context->controller->smarty->assign('payment_name', $this->displayName);
|
||||
return $this->display(__FILE__, $this->name.'-confirmation.tpl');
|
||||
}
|
||||
|
||||
|
||||
public function hookAdminOrder($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
$context = Context::getContext();
|
||||
$error = 0;
|
||||
$order = new Order((int)($params['id_order']));
|
||||
|
||||
@@ -593,12 +593,12 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
// check disposition state
|
||||
$res = PrepaidServicesAPI::getSerialNumbers($this->getAPIConfiguration($disposition['currency']), Configuration::get($this->prefix.'MERCHANT_ID_'.$disposition['currency']), $disposition['mtid'], $disposition['currency']);
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$currency = $context->currency;
|
||||
|
||||
// if the disposition is not "active"
|
||||
if ($res[5] != PrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PrepaidServicesAPI::DISPOSITION_DEBITED)
|
||||
{
|
||||
$smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
|
||||
$context->controller->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
|
||||
return $this->display($this->module_dir.'/'.$this->name, 'disposition-error.tpl');
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ abstract class PrepaidServices extends PaymentModule
|
||||
if (Tools::getIsset('pp_error'))
|
||||
$error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error'));
|
||||
|
||||
$smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
|
||||
$context->controller->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
|
||||
'payment_name' => $order->payment,
|
||||
'error' => $error_msg,
|
||||
'currency' => $currency->getSign('right'),
|
||||
|
||||
@@ -155,14 +155,14 @@ class Cheque extends PaymentModule
|
||||
if (!$this->_checkCurrency($cart))
|
||||
Tools::redirect('index.php?controller=order');
|
||||
|
||||
global $cookie, $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'nbProducts' => $cart->nbProducts(),
|
||||
'cust_currency' => $cart->id_currency,
|
||||
'currencies' => $this->getCurrency((int)$cart->id_currency),
|
||||
'total' => $cart->getOrderTotal(true, Cart::BOTH),
|
||||
'isoCode' => Language::getIsoById((int)($cookie->id_lang)),
|
||||
'isoCode' => $context->language->iso_code,
|
||||
'chequeName' => $this->chequeName,
|
||||
'chequeAddress' => nl2br2($this->address),
|
||||
'this_path' => $this->_path,
|
||||
@@ -179,9 +179,8 @@ class Cheque extends PaymentModule
|
||||
if (!$this->_checkCurrency($params['cart']))
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
|
||||
$smarty->assign(array(
|
||||
$context = Context::getContext();
|
||||
$context->controller->smarty->assign(array(
|
||||
'this_path' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
|
||||
));
|
||||
@@ -193,10 +192,10 @@ class Cheque extends PaymentModule
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
$state = $params['objOrder']->getCurrentState();
|
||||
if ($state == _PS_OS_CHEQUE_ OR $state == _PS_OS_OUTOFSTOCK_)
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
|
||||
'chequeName' => $this->chequeName,
|
||||
'chequeAddress' => nl2br2($this->address),
|
||||
@@ -204,7 +203,7 @@ class Cheque extends PaymentModule
|
||||
'id_order' => $params['objOrder']->id
|
||||
));
|
||||
else
|
||||
$smarty->assign('status', 'failed');
|
||||
$context->controller->smarty->assign('status', 'failed');
|
||||
return $this->display(__FILE__, 'payment_return.tpl');
|
||||
}
|
||||
|
||||
@@ -212,7 +211,6 @@ class Cheque extends PaymentModule
|
||||
{
|
||||
$currency_order = new Currency((int)($cart->id_currency));
|
||||
$currencies_module = $this->getCurrency((int)$cart->id_currency);
|
||||
$currency_default = Configuration::get('PS_CURRENCY_DEFAULT');
|
||||
|
||||
if (is_array($currencies_module))
|
||||
foreach ($currencies_module AS $currency_module)
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -98,8 +98,7 @@ class DateOfDelivery extends Module
|
||||
|
||||
public function hookBeforeCarrier($params)
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (!sizeof($params['carriers']))
|
||||
return false;
|
||||
|
||||
@@ -112,7 +111,7 @@ class DateOfDelivery extends Module
|
||||
foreach ($params['carriers'] as $carrier)
|
||||
$datesDelivery[(int)($carrier['id_carrier'])] = $this->_getDatesOfDelivery((int)($carrier['id_carrier']), $oos);
|
||||
|
||||
$smarty->assign(array(
|
||||
$context->controller->smarty->assign(array(
|
||||
'datesDelivery' => $datesDelivery,
|
||||
'id_carrier' => ($params['cart']->id_carrier ? (int)($params['cart']->id_carrier) : (int)(Configuration::get('PS_CARRIER_DEFAULT')))
|
||||
));
|
||||
@@ -122,7 +121,7 @@ class DateOfDelivery extends Module
|
||||
|
||||
public function hookOrderDetailDisplayed($params)
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$oos = false; // For out of stock management
|
||||
foreach ($params['order']->getProducts() as $product)
|
||||
@@ -135,15 +134,13 @@ class DateOfDelivery extends Module
|
||||
if (!is_array($datesDelivery) OR !sizeof($datesDelivery))
|
||||
return ;
|
||||
|
||||
$smarty->assign('datesDelivery', $datesDelivery);
|
||||
$context->controller->smarty->assign('datesDelivery', $datesDelivery);
|
||||
|
||||
return $this->display(__FILE__, 'orderDetail.tpl');
|
||||
}
|
||||
|
||||
private function _postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$errors = array();
|
||||
if (Tools::isSubmit('submitMoreOptions'))
|
||||
{
|
||||
@@ -182,7 +179,7 @@ class DateOfDelivery extends Module
|
||||
INSERT INTO `'._DB_PREFIX_.'dateofdelivery_carrier_rule`(`id_carrier`, `minimal_time`, `maximal_time`, `delivery_saturday`, `delivery_sunday`)
|
||||
VALUES ('.(int)($carrier->id).', '.(int)(Tools::getValue('minimal_time')).', '.(int)(Tools::getValue('maximal_time')).', '.(int)(Tools::isSubmit('delivery_saturday')).', '.(int)(Tools::isSubmit('delivery_sunday')).')
|
||||
'))
|
||||
Tools::redirectAdmin($currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&confirmAddCarrierRule');
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&confirmAddCarrierRule');
|
||||
else
|
||||
$this->_html .= $this->displayError($this->l('An error occurred on adding of carrier rule.'));
|
||||
}
|
||||
@@ -193,7 +190,7 @@ class DateOfDelivery extends Module
|
||||
SET `id_carrier` = '.(int)($carrier->id).', `minimal_time` = '.(int)(Tools::getValue('minimal_time')).', `maximal_time` = '.(int)(Tools::getValue('maximal_time')).', `delivery_saturday` = '.(int)(Tools::isSubmit('delivery_saturday')).', `delivery_sunday` = '.(int)(Tools::isSubmit('delivery_sunday')).'
|
||||
WHERE `id_carrier_rule` = '.(int)(Tools::getValue('id_carrier_rule'))
|
||||
))
|
||||
Tools::redirectAdmin($currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&confirmEditCarrierRule');
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&confirmEditCarrierRule');
|
||||
else
|
||||
$this->_html .= $this->displayError($this->l('An error occurred on updating of carrier rule.'));
|
||||
}
|
||||
@@ -218,13 +215,11 @@ class DateOfDelivery extends Module
|
||||
|
||||
private function _setConfigurationForm()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$this->_html .= '
|
||||
<fieldset>
|
||||
<legend><img src="'._PS_BASE_URL_.__PS_BASE_URI__.'modules/'.$this->name.'/img/time.png" alt="" /> '.$this->l('Carrier configuration').'</legend>
|
||||
|
||||
<p><a href="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&addCarrierRule"><img src="'._PS_BASE_URL_.__PS_BASE_URI__.'modules/'.$this->name.'/img/time_add.png" alt="" /> '.$this->l('Add a new carrier rule').'</a></p>
|
||||
<p><a href="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&addCarrierRule"><img src="'._PS_BASE_URL_.__PS_BASE_URI__.'modules/'.$this->name.'/img/time_add.png" alt="" /> '.$this->l('Add a new carrier rule').'</a></p>
|
||||
|
||||
<h3>'.$this->l('List of carrier rules').'</h3>';
|
||||
|
||||
@@ -267,8 +262,8 @@ class DateOfDelivery extends Module
|
||||
$this->_html .= '
|
||||
</td>
|
||||
<td width="10%" class="center">
|
||||
<a href="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&editCarrierRule&id_carrier_rule='.(int)($rule['id_carrier_rule']).'" title="'.$this->l('Edit').'"><img src="'._PS_ADMIN_IMG_.'edit.gif" alt="" /></a>
|
||||
<a href="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteCarrierRule&id_carrier_rule='.(int)($rule['id_carrier_rule']).'" title="'.$this->l('Delete').'"><img src="'._PS_ADMIN_IMG_.'delete.gif" alt="" /></a>
|
||||
<a href="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&editCarrierRule&id_carrier_rule='.(int)($rule['id_carrier_rule']).'" title="'.$this->l('Edit').'"><img src="'._PS_ADMIN_IMG_.'edit.gif" alt="" /></a>
|
||||
<a href="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteCarrierRule&id_carrier_rule='.(int)($rule['id_carrier_rule']).'" title="'.$this->l('Delete').'"><img src="'._PS_ADMIN_IMG_.'delete.gif" alt="" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
@@ -283,7 +278,7 @@ class DateOfDelivery extends Module
|
||||
$this->_html .= '
|
||||
</fieldset>
|
||||
<br />
|
||||
<form method="POST" action="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'">
|
||||
<form method="POST" action="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'">
|
||||
<fieldset style="width:500px;">
|
||||
<legend><img src="'._PS_BASE_URL_.__PS_BASE_URI__.'modules/'.$this->name.'/img/time.png" alt="" /> '.$this->l('More options').'</legend>
|
||||
|
||||
@@ -317,11 +312,11 @@ class DateOfDelivery extends Module
|
||||
|
||||
private function _setCarrierRuleForm()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
$carriers = Carrier::getCarriers((int)($cookie->id_lang), true , false,false, NULL, ALL_CARRIERS);
|
||||
if (Tools::isSubmit('editCarrierRule') AND $this->_isCarrierRuleExists((int)(Tools::getValue('id_carrier_rule'))))
|
||||
$carrier_rule = $this->_getCarrierRule((int)(Tools::getValue('id_carrier_rule')));
|
||||
$carriers = Carrier::getCarriers($context->language->id, true , false,false, NULL, ALL_CARRIERS);
|
||||
if (Tools::isSubmit('editCarrierRule') AND $this->_isCarrierRuleExists(Tools::getValue('id_carrier_rule')))
|
||||
$carrier_rule = $this->_getCarrierRule(Tools::getValue('id_carrier_rule'));
|
||||
|
||||
$this->_html .= '
|
||||
<form method="POST" action="'.$_SERVER['REQUEST_URI'].'">
|
||||
@@ -365,7 +360,7 @@ class DateOfDelivery extends Module
|
||||
</div>
|
||||
|
||||
<p class="center"><input type="submit" class="button" name="submitCarrierRule" value="'.$this->l('Save').'" /></p>
|
||||
<p class="center"><a href="'.$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'">'.$this->l('Cancel').'</a></p>
|
||||
<p class="center"><a href="'.AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'">'.$this->l('Cancel').'</a></p>
|
||||
';
|
||||
|
||||
$this->_html .= '
|
||||
|
||||
+70
-75
@@ -33,7 +33,7 @@ class Dejala extends CarrierModule
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie ;
|
||||
$context = Context::getContext();
|
||||
|
||||
//TODO Iso code of countries where the module can be used, if none module available for all countries
|
||||
$this->limited_countries = array('fr');
|
||||
@@ -41,7 +41,7 @@ class Dejala extends CarrierModule
|
||||
$this->tab = 'shipping_logistics';
|
||||
$this->version = 1.4;
|
||||
$this->internal_version = '1.3';
|
||||
$this->id_lang = (!isset($cookie) OR !is_object($cookie)) ? (int)(Configuration::get('PS_LANG_DEFAULT')) : (int)($cookie->id_lang);
|
||||
$this->id_lang = $context->language->id;
|
||||
$this->wday_labels = array($this->l('Sunday'), $this->l('Monday'), $this->l('Tuesday'), $this->l('Wednesday'), $this->l('Thursday'), $this->l('Friday'), $this->l('Saturday'));
|
||||
|
||||
parent::__construct();
|
||||
@@ -122,12 +122,12 @@ class Dejala extends CarrierModule
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
|
||||
$context = Context::getContext();
|
||||
// If Dejala is default carrier, try to set another one as default
|
||||
$djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ;
|
||||
if (Configuration::get('PS_CARRIER_DEFAULT') == (int)($djlCarrier->id))
|
||||
{
|
||||
$carriers = Carrier::getCarriers($cookie->id_lang, true, false, false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
$carriers = Carrier::getCarriers($context->language->id, true, false, false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
foreach($carriers as $carrier)
|
||||
{
|
||||
if ($carrier['active'] AND !$carrier['deleted'] AND ($carrier['external_module_name'] != $this->name))
|
||||
@@ -231,7 +231,7 @@ class Dejala extends CarrierModule
|
||||
**/
|
||||
public function _postProcess()
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$errors = array();
|
||||
$method = Tools::getValue('method');
|
||||
@@ -392,9 +392,9 @@ class Dejala extends CarrierModule
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $smarty;
|
||||
$context = Context::getContext();
|
||||
|
||||
$smarty->assign('country', $this->dejalaConfig->country);
|
||||
//$context->controller->smarty->assign('country', $this->dejalaConfig->country);
|
||||
$output = $this->display(__FILE__, 'dejala_header.tpl');
|
||||
if (!empty($_POST))
|
||||
{
|
||||
@@ -420,18 +420,18 @@ class Dejala extends CarrierModule
|
||||
|
||||
public function displayForm()
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
$errors = array();
|
||||
$outputMain = '';
|
||||
$smarty->assign("djl_mode", $this->dejalaConfig->mode);
|
||||
$smarty->assign("disabled", '');
|
||||
$context->controller->smarty->assign("djl_mode", $this->dejalaConfig->mode);
|
||||
$context->controller->smarty->assign("disabled", '');
|
||||
if ($this->dejalaConfig->mode == 'PROD')
|
||||
$smarty->assign("disabled", 'disabled="disabled"');
|
||||
$context->controller->smarty->assign("disabled", 'disabled="disabled"');
|
||||
if (true !== extension_loaded('curl'))
|
||||
{
|
||||
$errors[] = $this->l('This module requires php extension cURL to function properly. Please install the php extension "cURL" first.');
|
||||
$smarty->assign("disabled", 'disabled="disabled"');
|
||||
$context->controller->smarty->assign("disabled", 'disabled="disabled"');
|
||||
}
|
||||
|
||||
$registered = TRUE;
|
||||
@@ -453,7 +453,7 @@ class Dejala extends CarrierModule
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign("registered", $registered?"1":"0");
|
||||
$context->controller->smarty->assign("registered", $registered?"1":"0");
|
||||
|
||||
|
||||
if (!isset($_GET['cat']) || ($_GET['cat']==='home') || ($_GET['cat']===''))
|
||||
@@ -461,19 +461,19 @@ class Dejala extends CarrierModule
|
||||
else
|
||||
$currentTab=$_GET['cat'];
|
||||
|
||||
$smarty->assign("currentTab", $currentTab);
|
||||
$smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']);
|
||||
$smarty->assign("formAction", $_SERVER['REQUEST_URI']);
|
||||
$context->controller->smarty->assign("currentTab", $currentTab);
|
||||
$context->controller->smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']);
|
||||
$context->controller->smarty->assign("formAction", $_SERVER['REQUEST_URI']);
|
||||
$outputMenu = $this->display(__FILE__, 'dejala_menu.tpl');
|
||||
|
||||
if ($currentTab==='home')
|
||||
{
|
||||
$smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8'));
|
||||
$context->controller->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8'));
|
||||
if ($registered)
|
||||
{
|
||||
$smarty->assign("visibility_status", $this->dejalaConfig->visibility_status);
|
||||
$smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list);
|
||||
$smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8'));
|
||||
$context->controller->smarty->assign("visibility_status", $this->dejalaConfig->visibility_status);
|
||||
$context->controller->smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list);
|
||||
$context->controller->smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8'));
|
||||
$smartifyErrors = $this->smartyfyStoreAttributes();
|
||||
if (isset($smartifyErrors) && count($smartifyErrors))
|
||||
$errors = $smartifyErrors;
|
||||
@@ -483,7 +483,7 @@ class Dejala extends CarrierModule
|
||||
$shopName = Configuration::get('PS_SHOP_NAME');
|
||||
if (strlen($shopName) >= 15)
|
||||
$shopName = substr($shopName, 0, 15);
|
||||
$smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8'));
|
||||
$context->controller->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8'));
|
||||
}
|
||||
$outputMain = $this->display(__FILE__, 'dejala_home.tpl');
|
||||
}
|
||||
@@ -496,7 +496,7 @@ class Dejala extends CarrierModule
|
||||
{
|
||||
foreach ($contacts as $contactName=>$contactData) {
|
||||
foreach ($contactData as $key=>$value) {
|
||||
$smarty->assign($contactName.'_'.$key, $value);
|
||||
$context->controller->smarty->assign($contactName.'_'.$key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,7 +510,7 @@ class Dejala extends CarrierModule
|
||||
if ('200' == $responseArray['status'])
|
||||
{
|
||||
foreach ($location as $key=>$value)
|
||||
$smarty->assign($key, $value);
|
||||
$context->controller->smarty->assign($key, $value);
|
||||
|
||||
$outputMain = $this->display(__FILE__, 'dejala_location.tpl');
|
||||
}
|
||||
@@ -523,7 +523,7 @@ class Dejala extends CarrierModule
|
||||
if ('200' == $responseArray['status'])
|
||||
{
|
||||
foreach ($processes as $key=>$value)
|
||||
$smarty->assign($key, $value);
|
||||
$context->controller->smarty->assign($key, $value);
|
||||
|
||||
$outputMain = $this->display(__FILE__, 'dejala_processes.tpl');
|
||||
}
|
||||
@@ -544,7 +544,7 @@ class Dejala extends CarrierModule
|
||||
$product['public_price'] = number_format(round($product['price'] + $product['margin'], 2), 2, '.', '');
|
||||
$product['public_price_notax'] = number_format(round($product['public_price']/$vat_factor, 2), 2, '.', '');
|
||||
}
|
||||
$smarty->assign('products', $products);
|
||||
$context->controller->smarty->assign('products', $products);
|
||||
$outputMain = $this->display(__FILE__, 'dejala_products.tpl');
|
||||
}
|
||||
}
|
||||
@@ -582,10 +582,10 @@ class Dejala extends CarrierModule
|
||||
$delivery['delivery_time'] = date('H\hi', $delivery['delivery_utc']);
|
||||
}
|
||||
}
|
||||
$smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php');
|
||||
$smarty->assign('defaultDateFrom', date('01/m/Y'));
|
||||
$smarty->assign('defaultDateTo', date('d/m/Y'));
|
||||
$smarty->assign('deliveries', $deliveries);
|
||||
$context->controller->smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php');
|
||||
$context->controller->smarty->assign('defaultDateFrom', date('01/m/Y'));
|
||||
$context->controller->smarty->assign('defaultDateTo', date('d/m/Y'));
|
||||
$context->controller->smarty->assign('deliveries', $deliveries);
|
||||
$outputMain = $this->display(__FILE__, 'dejala_deliveries.tpl');
|
||||
}
|
||||
}
|
||||
@@ -608,9 +608,9 @@ class Dejala extends CarrierModule
|
||||
$m_status['checked'] = '0';
|
||||
$orderStatuses[] = $m_status;
|
||||
}
|
||||
$smarty->assign('statuses', $orderStatuses);
|
||||
$context->controller->smarty->assign('statuses', $orderStatuses);
|
||||
|
||||
$smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses);
|
||||
$context->controller->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses);
|
||||
$outputMain = $this->display(__FILE__, 'dejala_technical_options.tpl');
|
||||
}
|
||||
|
||||
@@ -630,8 +630,7 @@ class Dejala extends CarrierModule
|
||||
// put in smarty context store attributes
|
||||
function smartyfyStoreAttributes()
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
$context = Context::getContext();
|
||||
$errors = array();
|
||||
$djlUtil = new DejalaUtils();
|
||||
$storeAttrs = array();
|
||||
@@ -640,20 +639,20 @@ class Dejala extends CarrierModule
|
||||
$errors[] = $this->l('An error occurred while getting store, please try again later or contact Dejala.com');
|
||||
else
|
||||
{
|
||||
$smarty->assign("account_balance", $storeAttrs['account_balance']);
|
||||
$smarty->assign("store_name", $storeAttrs['name']);
|
||||
$context->controller->smarty->assign("account_balance", $storeAttrs['account_balance']);
|
||||
$context->controller->smarty->assign("store_name", $storeAttrs['name']);
|
||||
|
||||
// Check if account exists in production
|
||||
$responsePing = $djlUtil->ping($this->dejalaConfig, 'PROD');
|
||||
if ('200' == $responsePing['status'])
|
||||
$smarty->assign('isLiveReady', '1');
|
||||
$context->controller->smarty->assign('isLiveReady', '1');
|
||||
else
|
||||
{
|
||||
$smarty->assign('isLiveReady', '0');
|
||||
$context->controller->smarty->assign('isLiveReady', '0');
|
||||
if (isset($storeAttrs['attributes']) && isset($storeAttrs['attributes']['request_live']) && ($storeAttrs['attributes']['request_live']=='true'))
|
||||
$smarty->assign('isLiveRequested', '1');
|
||||
$context->controller->smarty->assign('isLiveRequested', '1');
|
||||
else
|
||||
$smarty->assign('isLiveRequested', '0');
|
||||
$context->controller->smarty->assign('isLiveRequested', '0');
|
||||
}
|
||||
}
|
||||
return ($errors);
|
||||
@@ -661,15 +660,12 @@ class Dejala extends CarrierModule
|
||||
|
||||
|
||||
function getOrderStates(){
|
||||
global $cookie;
|
||||
|
||||
$states = OrderState::getOrderStates($this->id_lang);
|
||||
return ($states);
|
||||
}
|
||||
|
||||
function displayDeliveryOptions(){
|
||||
global $smarty;
|
||||
|
||||
$context = Context::getContext();
|
||||
/*
|
||||
Au moment du choix du créneau
|
||||
Pour déterminer le créneau de départ proposé :
|
||||
@@ -686,26 +682,26 @@ class Dejala extends CarrierModule
|
||||
$response = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
|
||||
if ($response['status'] == 200)
|
||||
{
|
||||
$smarty->assign('nb_days', $store['attributes']['nb_days_displayed']);
|
||||
$smarty->assign('delivery_delay', $store['attributes']['delivery_delay']);
|
||||
$context->controller->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']);
|
||||
$context->controller->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']);
|
||||
if (isset($store['attributes']['delivery_partial']))
|
||||
$smarty->assign('delivery_partial', $store['attributes']['delivery_partial']);
|
||||
$context->controller->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']);
|
||||
}
|
||||
|
||||
$wday_selected = array(1, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
$smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
||||
$smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
||||
$smarty->assign("weekdayLabels", $this->wday_labels);
|
||||
$smarty->assign("weekdaySelected", $wday_selected);
|
||||
$context->controller->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
||||
$context->controller->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
||||
$context->controller->smarty->assign("weekdayLabels", $this->wday_labels);
|
||||
$context->controller->smarty->assign("weekdaySelected", $wday_selected);
|
||||
|
||||
|
||||
$calendar = array();
|
||||
$response = $djlUtil->getStoreCalendar($this->dejalaConfig, $calendar);
|
||||
if ($response['status'] == 200)
|
||||
{
|
||||
$smarty->assign("calendar", $calendar);
|
||||
$smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl");
|
||||
$context->controller->smarty->assign("calendar", $calendar);
|
||||
$context->controller->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl");
|
||||
}
|
||||
$output = $output . $this->display(__FILE__, 'dejala_delivery_options.tpl');
|
||||
|
||||
@@ -737,10 +733,9 @@ class Dejala extends CarrierModule
|
||||
*/
|
||||
public function hookExtraCarrier($params)
|
||||
{
|
||||
global $smarty, $defaultCountry;
|
||||
$context = Context::getContext();
|
||||
|
||||
$cart = $params['cart'];
|
||||
$cookie = $params['cookie'];
|
||||
|
||||
$this->hooklog("ExtraCarrier", $params);
|
||||
|
||||
@@ -748,9 +743,9 @@ class Dejala extends CarrierModule
|
||||
if ($this->dejalaConfig->visibility_status == "invisible")
|
||||
return ;
|
||||
|
||||
if (($this->dejalaConfig->visibility_status == "visible_limited") && ((int)($cookie->id_customer) > 0))
|
||||
if (($this->dejalaConfig->visibility_status == "visible_limited") && ((int)$context->customer->id > 0))
|
||||
{
|
||||
$customer = new Customer((int)($cookie->id_customer));
|
||||
$customer = $context->customer;
|
||||
if (!in_array($customer->email, preg_split("/[\s,]+/", $this->dejalaConfig->visible_users_list)))
|
||||
return ;
|
||||
}
|
||||
@@ -776,7 +771,7 @@ class Dejala extends CarrierModule
|
||||
if (isset($cart->id_address_delivery) AND $cart->id_address_delivery)
|
||||
$id_zone = (int)Address::getZoneById((int)($cart->id_address_delivery));
|
||||
else
|
||||
$id_zone = (int)$defaultCountry->id_zone;
|
||||
$id_zone = (int)$context->country->id_zone;
|
||||
|
||||
$djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ;
|
||||
|
||||
@@ -876,8 +871,8 @@ class Dejala extends CarrierModule
|
||||
|
||||
|
||||
$this->mylog("date$=" . $this->logValue($dates,1));
|
||||
$smarty->assign('nb_days', $nbDeliveryDates);
|
||||
$smarty->assign('dates', $dates);
|
||||
$context->controller->smarty->assign('nb_days', $nbDeliveryDates);
|
||||
$context->controller->smarty->assign('dates', $dates);
|
||||
for ($i=0; $i < 24; $i++)
|
||||
{
|
||||
$endHour = (($i+$electedProduct['timelimit'])%24);
|
||||
@@ -885,10 +880,10 @@ class Dejala extends CarrierModule
|
||||
$endHour = 24;
|
||||
$hourLabels[] = $i . 'h-' . $endHour . 'h';
|
||||
}
|
||||
$smarty->assign('hourLabels', $hourLabels);
|
||||
$context->controller->smarty->assign('hourLabels', $hourLabels);
|
||||
|
||||
$smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
||||
$smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
||||
$context->controller->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
||||
$context->controller->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
||||
|
||||
$this->mylog("electedCarrier->id=" . $this->logValue($djlCarrier->id));
|
||||
$mCarrier = $djlCarrier;
|
||||
@@ -901,9 +896,9 @@ class Dejala extends CarrierModule
|
||||
|
||||
$resultsArray[] = $row;
|
||||
|
||||
$smarty->assign('carriers', $resultsArray);
|
||||
$smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ;
|
||||
$smarty->assign('product', $electedProduct);
|
||||
$context->controller->smarty->assign('carriers', $resultsArray);
|
||||
$context->controller->smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ;
|
||||
$context->controller->smarty->assign('product', $electedProduct);
|
||||
|
||||
|
||||
$djlCart = new DejalaCart($cart->id);
|
||||
@@ -920,21 +915,21 @@ class Dejala extends CarrierModule
|
||||
{
|
||||
if ($l_date['value'] == $deliveryDateSelected)
|
||||
{
|
||||
$smarty->assign("deliveryDateIndexSelected", $l_key);
|
||||
$smarty->assign("deliveryDateSelected", $deliveryDateSelected);
|
||||
$smarty->assign("deliveryHourSelected", $m_hour);
|
||||
$context->controller->smarty->assign("deliveryDateIndexSelected", $l_key);
|
||||
$context->controller->smarty->assign("deliveryDateSelected", $deliveryDateSelected);
|
||||
$context->controller->smarty->assign("deliveryHourSelected", $m_hour);
|
||||
$setDefaultDate = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($setDefaultDate)
|
||||
{
|
||||
$smarty->assign("deliveryDateIndexSelected", 0);
|
||||
$smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc));
|
||||
$smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc)));
|
||||
$context->controller->smarty->assign("deliveryDateIndexSelected", 0);
|
||||
$context->controller->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc));
|
||||
$context->controller->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc)));
|
||||
}
|
||||
|
||||
$smarty->assign("isCartOutOfStock", $isCartOutOfStock);
|
||||
$context->controller->smarty->assign("isCartOutOfStock", $isCartOutOfStock);
|
||||
if (!$isCartOutOfStock)
|
||||
{
|
||||
$buffer = $this->display(__FILE__, 'dejala_carrier.tpl');
|
||||
@@ -942,7 +937,7 @@ class Dejala extends CarrierModule
|
||||
}
|
||||
else
|
||||
{
|
||||
$smarty->assign('nostock_info', $this->l('I will select my shipping date when my product is available.'));
|
||||
$context->controller->smarty->assign('nostock_info', $this->l('I will select my shipping date when my product is available.'));
|
||||
$buffer = $this->display(__FILE__, 'dejala_carrier_nostock.tpl');
|
||||
}
|
||||
return $buffer;
|
||||
@@ -1030,7 +1025,7 @@ class Dejala extends CarrierModule
|
||||
public function hookProcessCarrier($params)
|
||||
{
|
||||
// FO: Temporary. Necessary to go around the product's cart re-instanciation bug.
|
||||
global $cart ;
|
||||
$context = Context::getContext();
|
||||
|
||||
$cartParams = $params['cart'];
|
||||
$this->hooklog("processCarrier", $params) ;
|
||||
@@ -1078,7 +1073,7 @@ class Dejala extends CarrierModule
|
||||
}
|
||||
|
||||
// FO: VERY DIRTY HACK.... Re-assign the global cart to what it was before.
|
||||
$cart = $cartParams ;
|
||||
$context->cart = $cartParams ;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user