// Context part 12

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7649 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-07-19 09:28:11 +00:00
parent 8a0a62ae03
commit 89213e18e5
53 changed files with 184 additions and 196 deletions
-1
View File
@@ -95,5 +95,4 @@ $context->link = $link;
$context->language = $language; $context->language = $language;
$context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$context->country = $defaultCountry; $context->country = $defaultCountry;
$context->smarty = $smarty;
$context->shop = new Shop(Shop::getContextID()); $context->shop = new Shop(Shop::getContextID());
+1 -1
View File
@@ -550,7 +550,7 @@ class AdminCustomerThreads extends AdminTab
<td align="center"><a href="?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td> <td align="center"><a href="?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
</tr>'; </tr>';
echo '</table> echo '</table>
<h3 style="color:green;font-weight:700;margin-top:10px">'.$this->l('Validated Orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, new Currency(Configuration::get('PS_CURRENCY_DEFAULT'))).'</h3> <h3 style="color:green;font-weight:700;margin-top:10px">'.$this->l('Validated Orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, $context->currency).'</h3>
</div>'; </div>';
} }
} }
+2 -2
View File
@@ -330,7 +330,7 @@ class AdminOrders extends AdminTab
$this->_errors[] = Tools::displayError('Cannot generate voucher'); $this->_errors[] = Tools::displayError('Cannot generate voucher');
else else
{ {
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $currency = $context->currency;
$params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false); $params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false);
$params['{voucher_num}'] = $voucher->name; $params['{voucher_num}'] = $voucher->name;
@Mail::Send((int)($order->id_lang), 'voucher', Mail::l('New voucher regarding your order'), $params, $customer->email, $customer->firstname.' '.$customer->lastname); @Mail::Send((int)($order->id_lang), 'voucher', Mail::l('New voucher regarding your order'), $params, $customer->email, $customer->firstname.' '.$customer->lastname);
@@ -472,7 +472,7 @@ class AdminOrders extends AdminTab
$messages = Message::getMessagesByOrderId($order->id, true); $messages = Message::getMessagesByOrderId($order->id, true);
$states = OrderState::getOrderStates($context->language->id); $states = OrderState::getOrderStates($context->language->id);
$currency = new Currency($order->id_currency); $currency = new Currency($order->id_currency);
$currentLanguage = new Language($context->language->id); $currentLanguage = $context->language;
$currentState = OrderHistory::getLastOrderState($order->id); $currentState = OrderHistory::getLastOrderState($order->id);
$sources = ConnectionsSource::getOrderSources($order->id); $sources = ConnectionsSource::getOrderSources($order->id);
$cart = Cart::getCartByOrderId($order->id); $cart = Cart::getCartByOrderId($order->id);
+1 -2
View File
@@ -451,8 +451,7 @@ class AdminPreferences extends AdminTab
break; break;
case 'price': case 'price':
$default_currency = new Currency((int)(Configuration::get("PS_CURRENCY_DEFAULT"))); echo $context->currency->getSign('left').'<input type="'.$field['type'].'" size="'.(isset($field['size']) ? (int)($field['size']) : 5).'" name="'.$key.'" value="'.($field['type'] == 'password' ? '' : htmlentities($val, ENT_COMPAT, 'UTF-8')).'" '.(($isDisabled) ? 'disabled="disabled"' : '').' />'.$context->currency->getSign('right').' '.$this->l('(tax excl.)');
echo $default_currency->getSign('left').'<input type="'.$field['type'].'" size="'.(isset($field['size']) ? (int)($field['size']) : 5).'" name="'.$key.'" value="'.($field['type'] == 'password' ? '' : htmlentities($val, ENT_COMPAT, 'UTF-8')).'" '.(($isDisabled) ? 'disabled="disabled"' : '').' />'.$default_currency->getSign('right').' '.$this->l('(tax excl.)');
break; break;
case 'textLang': case 'textLang':
+2 -2
View File
@@ -1522,7 +1522,7 @@ class AdminProducts extends AdminTab
if (!($obj = $this->loadObject(true))) if (!($obj = $this->loadObject(true)))
return; return;
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $currency = $context->currency;
if ($obj->id) if ($obj->id)
self::$currentIndex .= '&id_product='.$obj->id; self::$currentIndex .= '&id_product='.$obj->id;
@@ -3126,7 +3126,7 @@ class AdminProducts extends AdminTab
$attributes = Attribute::getAttributes($context->language->id, true); $attributes = Attribute::getAttributes($context->language->id, true);
foreach ($attributes AS $k => $attribute) foreach ($attributes AS $k => $attribute)
$attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name']; $attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $currency = $context->currency;
$attributes_groups = AttributeGroup::getAttributesGroups($context->language->id); $attributes_groups = AttributeGroup::getAttributesGroups($context->language->id);
+2 -2
View File
@@ -440,8 +440,8 @@ class AdminReferrers extends AdminTab
public function displayListContent($token = NULL) public function displayListContent($token = NULL)
{ {
$context = Context::getContext();
$irow = 0; $irow = 0;
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
if ($this->_list) if ($this->_list)
foreach ($this->_list AS $tr) foreach ($this->_list AS $tr)
{ {
@@ -452,7 +452,7 @@ class AdminReferrers extends AdminTab
{ {
echo '<td onclick="showProductLines('.$id.');" class="pointer '.(isset($params['align']) ? $params['align'] : '').'">'.(isset($params['prefix']) ? $params['prefix'] : ''); echo '<td onclick="showProductLines('.$id.');" class="pointer '.(isset($params['align']) ? $params['align'] : '').'">'.(isset($params['prefix']) ? $params['prefix'] : '');
if (isset($tr[$key]) AND isset($params['price'])) if (isset($tr[$key]) AND isset($params['price']))
echo Tools::displayPrice($tr[$key], $currency); echo Tools::displayPrice($tr[$key], $context->currency);
elseif (isset($tr[$key])) elseif (isset($tr[$key]))
echo $tr[$key]; echo $tr[$key];
else else
+1 -2
View File
@@ -190,7 +190,6 @@ class AdminSearch extends AdminTab
{ {
$context = Context::getContext(); $context = Context::getContext();
self::$currentIndex = 'index.php'; self::$currentIndex = 'index.php';
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$query = trim(Tools::getValue('bo_query')); $query = trim(Tools::getValue('bo_query'));
$nbCategories = $nbProducts = $nbCustomers = 0; $nbCategories = $nbProducts = $nbCustomers = 0;
@@ -223,7 +222,7 @@ class AdminSearch extends AdminTab
<td align="center">'.($product['manufacturer_name'] != NULL ? stripslashes($product['manufacturer_name']) : '--').'</td> <td align="center">'.($product['manufacturer_name'] != NULL ? stripslashes($product['manufacturer_name']) : '--').'</td>
<td>'.$product['reference'].'</td> <td>'.$product['reference'].'</td>
<td><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($product['nameh']).'</a></td> <td><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($product['nameh']).'</a></td>
<td>'.Tools::displayPrice($product['price'], $currency).'</td> <td>'.Tools::displayPrice($product['price'], $context->currency).'</td>
<td>'.stripslashes($product['tax_name']).'</td> <td>'.stripslashes($product['tax_name']).'</td>
<td align="center">'.$product['quantity'].'</td> <td align="center">'.$product['quantity'].'</td>
<td align="center">'.$product['weight'].' '.Configuration::get('PS_WEIGHT_UNIT').'</td> <td align="center">'.$product['weight'].' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
+4 -7
View File
@@ -33,11 +33,9 @@ class AdminShipping extends AdminTab
public function __construct() public function __construct()
{ {
$this->table = 'delivery'; $this->table = 'delivery';
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$this->_fieldsHandling = array( $this->_fieldsHandling = array(
'PS_SHIPPING_HANDLING' => array('title' => $this->l('Handling charges'), 'suffix' => $currency, 'validation' => 'isPrice', 'cast' => 'floatval'), 'PS_SHIPPING_HANDLING' => array('title' => $this->l('Handling charges'), 'suffix' => $context->currency, 'validation' => 'isPrice', 'cast' => 'floatval'),
'PS_SHIPPING_FREE_PRICE' => array('title' => $this->l('Free shipping starts at'), 'suffix' => $currency, 'validation' => 'isPrice', 'cast' => 'floatval'), 'PS_SHIPPING_FREE_PRICE' => array('title' => $this->l('Free shipping starts at'), 'suffix' => $context->currency, 'validation' => 'isPrice', 'cast' => 'floatval'),
'PS_SHIPPING_FREE_WEIGHT' => array('title' => $this->l('Free shipping starts at'), 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'validation' => 'isUnsignedFloat', 'cast' => 'floatval'), 'PS_SHIPPING_FREE_WEIGHT' => array('title' => $this->l('Free shipping starts at'), 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'validation' => 'isUnsignedFloat', 'cast' => 'floatval'),
'PS_SHIPPING_METHOD' => array('title' => $this->l('Billing'), 'validation' => 'isBool', 'cast' => 'intval')); 'PS_SHIPPING_METHOD' => array('title' => $this->l('Billing'), 'validation' => 'isBool', 'cast' => 'intval'));
@@ -193,7 +191,7 @@ class AdminShipping extends AdminTab
{ {
$carrierArray = array(); $carrierArray = array();
$id_carrier = Tools::getValue('id_carrier'); $id_carrier = Tools::getValue('id_carrier');
$carriers = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); $carriers = Carrier::getCarriers(Configuration::get('PS_LANG_DEFAULT'), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
foreach ($carriers AS $carrier) foreach ($carriers AS $carrier)
if (!$carrier['is_free']) if (!$carrier['is_free'])
$carrierArray[] = array( $carrierArray[] = array(
@@ -227,8 +225,7 @@ class AdminShipping extends AdminTab
<tr> <tr>
<th>'.$this->l('Zone / Range').'</th>'; <th>'.$this->l('Zone / Range').'</th>';
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $currency = $context->currency;
$rangeObj = $carrierSelected->getRangeObject(); $rangeObj = $carrierSelected->getRangeObject();
$rangeTable = $carrierSelected->getRangeTable(); $rangeTable = $carrierSelected->getRangeTable();
$suffix = $carrierSelected->getRangeSuffix(); $suffix = $carrierSelected->getRangeSuffix();
+2 -4
View File
@@ -149,7 +149,6 @@ class AdminTracking extends AdminTab
'status' => array('title' => $this->l('Status')), 'status' => array('title' => $this->l('Status')),
'action' => array('title' => $this->l('Actions')) 'action' => array('title' => $this->l('Actions'))
)); ));
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
echo ' echo '
<table class="table" cellpadding="0" cellspacing="0"> <table class="table" cellpadding="0" cellspacing="0">
<tr>'; <tr>';
@@ -169,7 +168,7 @@ class AdminTracking extends AdminTab
<td align="center">'.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').'</td> <td align="center">'.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').'</td>
<td>'.$product->reference.'</td> <td>'.$product->reference.'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($product->name).'</a></td> <td><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($product->name).'</a></td>
<td>'.Tools::displayPrice($product->getPrice(), $currency).'</td> <td>'.Tools::displayPrice($product->getPrice(), $context->currency).'</td>
<td>'.(float)$taxrate.'% </td> <td>'.(float)$taxrate.'% </td>
<td align="center">'.$product->quantity.'</td> <td align="center">'.$product->quantity.'</td>
<td align="center">'.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').'</td> <td align="center">'.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
@@ -209,7 +208,6 @@ class AdminTracking extends AdminTab
'action' => array('title' => $this->l('Actions')) 'action' => array('title' => $this->l('Actions'))
)); ));
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
echo ' echo '
<table class="table" cellpadding="0" cellspacing="0"> <table class="table" cellpadding="0" cellspacing="0">
<tr>'; <tr>';
@@ -241,7 +239,7 @@ class AdminTracking extends AdminTab
<td align="center">'.($prod['manufacturer_name'] != NULL ? stripslashes($prod['manufacturer_name']) : '--').'</td> <td align="center">'.($prod['manufacturer_name'] != NULL ? stripslashes($prod['manufacturer_name']) : '--').'</td>
<td>'.$prod['reference'].'</td> <td>'.$prod['reference'].'</td>
<td><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.'</a></td> <td><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">'.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.'</a></td>
<td>'.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $currency).'</td> <td>'.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $context->currency).'</td>
<td>'.(float)$taxrate.'% </td> <td>'.(float)$taxrate.'% </td>
<td align="center">'.$prod['quantity'].'</td> <td align="center">'.$prod['quantity'].'</td>
<td align="center">'.($prod['weight'] + $prod['product_weight']).' '.Configuration::get('PS_WEIGHT_UNIT').'</td> <td align="center">'.($prod['weight'] + $prod['product_weight']).' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
+1 -3
View File
@@ -1469,8 +1469,6 @@ abstract class AdminTabCore
* active : allow to toggle status * active : allow to toggle status
*/ */
$context = Context::getContext(); $context = Context::getContext();
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$id_category = 1; // default categ $id_category = 1; // default categ
$irow = 0; $irow = 0;
@@ -1543,7 +1541,7 @@ abstract class AdminTabCore
elseif (isset($params['icon']) AND (isset($params['icon'][$tr[$key]]) OR isset($params['icon']['default']))) elseif (isset($params['icon']) AND (isset($params['icon'][$tr[$key]]) OR isset($params['icon']['default'])))
echo '<img src="../img/admin/'.(isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'].'" alt="'.$tr[$key]).'" title="'.$tr[$key].'" />'; echo '<img src="../img/admin/'.(isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'].'" alt="'.$tr[$key]).'" title="'.$tr[$key].'" />';
elseif (isset($params['price'])) elseif (isset($params['price']))
echo Tools::displayPrice($tr[$key], (isset($params['currency']) ? Currency::getCurrencyInstance((int)($tr['id_currency'])) : $currency), false); echo Tools::displayPrice($tr[$key], (isset($params['currency']) ? Currency::getCurrencyInstance($tr['id_currency']) : $context->currency), false);
elseif (isset($params['float'])) elseif (isset($params['float']))
echo rtrim(rtrim($tr[$key], '0'), '.'); echo rtrim(rtrim($tr[$key], '0'), '.');
elseif (isset($params['type']) AND $params['type'] == 'date') elseif (isset($params['type']) AND $params['type'] == 'date')
+4 -5
View File
@@ -684,14 +684,13 @@ class CarrierCore extends ObjectModel
return false; return false;
} }
public function getRangeSuffix() public function getRangeSuffix($context = null)
{ {
if (!$context)
$context = Context::getContext();
$suffix = Configuration::get('PS_WEIGHT_UNIT'); $suffix = Configuration::get('PS_WEIGHT_UNIT');
if ($this->getShippingMethod() == Carrier::SHIPPING_METHOD_PRICE) if ($this->getShippingMethod() == Carrier::SHIPPING_METHOD_PRICE)
{ $suffix = $context->currency->sign;
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$suffix = $currency->sign;
}
return $suffix; return $suffix;
} }
+3
View File
@@ -66,6 +66,9 @@ class ContextCore
/** @var Shop */ /** @var Shop */
public $shop; public $shop;
/** @var Smarty */
public $smarty;
/** /**
* Get a singleton context * Get a singleton context
* *
+1 -1
View File
@@ -366,7 +366,7 @@ class CurrencyCore extends ObjectModel
static public function getCurrencyInstance($id) static public function getCurrencyInstance($id)
{ {
if (!array_key_exists($id, self::$currencies)) if (!array_key_exists($id, self::$currencies))
self::$currencies[(int)($id)] = new Currency((int)($id)); self::$currencies[(int)($id)] = new Currency($id);
return self::$currencies[(int)($id)]; return self::$currencies[(int)($id)];
} }
} }
+1 -1
View File
@@ -138,7 +138,7 @@ class FrontControllerCore
/* Cart already exists */ /* Cart already exists */
if ((int)$cookie->id_cart) if ((int)$cookie->id_cart)
{ {
$cart = new Cart((int)$cookie->id_cart); $cart = new Cart($cookie->id_cart);
if ($cart->OrderExists()) if ($cart->OrderExists())
unset($cookie->id_cart, $cart, $cookie->checkedTOS); unset($cookie->id_cart, $cart, $cookie->checkedTOS);
/* Delete product of cart, if user can't make an order from his country */ /* Delete product of cart, if user can't make an order from his country */
+6 -6
View File
@@ -1084,16 +1084,16 @@ abstract class ModuleCore
$previousTemplate = $context->smarty->currentTemplate; $previousTemplate = $context->smarty->currentTemplate;
$context->smarty->currentTemplate = substr(basename($template), 0, -4); $context->smarty->currentTemplate = substr(basename($template), 0, -4);
} }
$context->controller->smarty->assign('module_dir', __PS_BASE_URI__.'modules/'.basename($file, '.php').'/'); $context->smarty->assign('module_dir', __PS_BASE_URI__.'modules/'.basename($file, '.php').'/');
if (($overloaded = self::_isTemplateOverloadedStatic(basename($file, '.php'), $template)) === NULL) if (($overloaded = self::_isTemplateOverloadedStatic(basename($file, '.php'), $template)) === NULL)
$result = Tools::displayError('No template found for module').' '.basename($file,'.php'); $result = Tools::displayError('No template found for module').' '.basename($file,'.php');
else else
{ {
$context->controller->smarty->assign('module_template_dir', ($overloaded ? _THEME_DIR_ : __PS_BASE_URI__).'modules/'.basename($file, '.php').'/'); $context->smarty->assign('module_template_dir', ($overloaded ? _THEME_DIR_ : __PS_BASE_URI__).'modules/'.basename($file, '.php').'/');
$result = $context->controller->smarty->fetch(($overloaded ? _PS_THEME_DIR_.'modules/'.basename($file, '.php') : _PS_MODULE_DIR_.basename($file, '.php')).'/'.$template, $cacheId, $compileId); $result = $context->smarty->fetch(($overloaded ? _PS_THEME_DIR_.'modules/'.basename($file, '.php') : _PS_MODULE_DIR_.basename($file, '.php')).'/'.$template, $cacheId, $compileId);
} }
if (Configuration::get('PS_FORCE_SMARTY_2')) /* Keep a backward compatibility for Smarty v2 */ if (Configuration::get('PS_FORCE_SMARTY_2')) /* Keep a backward compatibility for Smarty v2 */
$context->controller->smarty->currentTemplate = $previousTemplate; $context->smarty->currentTemplate = $previousTemplate;
return $result; return $result;
} }
@@ -1108,10 +1108,10 @@ abstract class ModuleCore
/* Use Smarty 3 API calls */ /* Use Smarty 3 API calls */
if (!Configuration::get('PS_FORCE_SMARTY_2')) /* PHP version > 5.1.2 */ if (!Configuration::get('PS_FORCE_SMARTY_2')) /* PHP version > 5.1.2 */
return $context->controller->smarty->isCached($this->_getApplicableTemplateDir($template).$template, $cacheId, $compileId); return $context->smarty->isCached($this->_getApplicableTemplateDir($template).$template, $cacheId, $compileId);
/* or keep a backward compatibility if PHP version < 5.1.2 */ /* or keep a backward compatibility if PHP version < 5.1.2 */
else else
return $context->controller->smarty->is_cached($this->_getApplicableTemplateDir($template).$template, $cacheId, $compileId); return $context->smarty->is_cached($this->_getApplicableTemplateDir($template).$template, $cacheId, $compileId);
} }
protected function _clearCache($template, $cacheId = NULL, $compileId = NULL) protected function _clearCache($template, $cacheId = NULL, $compileId = NULL)
+1
View File
@@ -122,6 +122,7 @@ if (function_exists('date_default_timezone_set'))
/* Smarty */ /* Smarty */
require_once(dirname(__FILE__).'/smarty.config.inc.php'); require_once(dirname(__FILE__).'/smarty.config.inc.php');
Context::getContext()->smarty = $smarty;
/* Possible value are true, false, 'URL' /* Possible value are true, false, 'URL'
(for 'URL' append SMARTY_DEBUG as a parameter to the url) (for 'URL' append SMARTY_DEBUG as a parameter to the url)
default is false for production environment */ default is false for production environment */
+4 -5
View File
@@ -45,7 +45,7 @@ class AddressControllerCore extends FrontController
public function preProcess() public function preProcess()
{ {
parent::preProcess(); parent::preProcess();
$context = Context::getContext();
if ($back = Tools::getValue('back')) if ($back = Tools::getValue('back'))
$this->smarty->assign('back', Tools::safeOutput($back)); $this->smarty->assign('back', Tools::safeOutput($back));
if ($mod = Tools::getValue('mod')) if ($mod = Tools::getValue('mod'))
@@ -202,11 +202,10 @@ class AddressControllerCore extends FrontController
} }
elseif (!$id_address) elseif (!$id_address)
{ {
$customer = new Customer((int)(self::$cookie->id_customer)); if (Validate::isLoadedObject($context->customer))
if (Validate::isLoadedObject($customer))
{ {
$_POST['firstname'] = $customer->firstname; $_POST['firstname'] = $context->customer->firstname;
$_POST['lastname'] = $customer->lastname; $_POST['lastname'] = $context->customer->lastname;
} }
} }
if (Tools::isSubmit('ajax') AND sizeof($this->errors)) if (Tools::isSubmit('ajax') AND sizeof($this->errors))
+6 -7
View File
@@ -50,15 +50,15 @@ class AddressesControllerCore extends FrontController
$multipleAddressesFormated = array(); $multipleAddressesFormated = array();
$ordered_fields = array(); $ordered_fields = array();
$customer = new Customer((int)(self::$cookie->id_customer)); $customer = $context->customer;
if (!Validate::isLoadedObject($customer)) if (!Validate::isLoadedObject($customer))
die(Tools::displayError('Customer not found')); die(Tools::displayError('Customer not found'));
// Retro Compatibility Theme < 1.4.1 // Retro Compatibility Theme < 1.4.1
$this->smarty->assign('addresses', $customer->getAddresses((int)(self::$cookie->id_lang))); $this->smarty->assign('addresses', $customer->getAddresses($context->language->id));
$customerAddressesDetailed = $customer->getAddresses((int)(self::$cookie->id_lang)); $customerAddressesDetailed = $customer->getAddresses($context->language->id);
$total = 0; $total = 0;
foreach($customerAddressesDetailed as $addressDetailed) foreach($customerAddressesDetailed as $addressDetailed)
@@ -74,12 +74,12 @@ class AddressesControllerCore extends FrontController
++$total; ++$total;
// Retro theme < 1.4.2 // Retro theme < 1.4.2
$ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country']); $ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country']);
} }
// Retro theme 1.4.2 // Retro theme 1.4.2
if (($key = array_search('Country:name', $ordered_fields))) if (($key = array_search('Country:name', $ordered_fields)))
$ordered_fields[$key] = 'country'; $ordered_fields[$key] = 'country';
$this->smarty->assign('addresses_style', array( $this->smarty->assign('addresses_style', array(
'company' => 'address_company' 'company' => 'address_company'
@@ -98,7 +98,6 @@ class AddressesControllerCore extends FrontController
$this->smarty->assign(array( $this->smarty->assign(array(
'multipleAddresses' => $multipleAddressesFormated, 'multipleAddresses' => $multipleAddressesFormated,
'ordered_fields' => $ordered_fields)); 'ordered_fields' => $ordered_fields));
unset($customer);
} }
public function displayContent() public function displayContent()
+4 -6
View File
@@ -31,6 +31,7 @@ class CartControllerCore extends FrontController
{ {
$this->init(); $this->init();
$this->preProcess(); $this->preProcess();
$context = Context::getContext();
if (Tools::getValue('ajax') == 'true') if (Tools::getValue('ajax') == 'true')
{ {
@@ -38,15 +39,12 @@ class CartControllerCore extends FrontController
{ {
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1)
{ {
if (self::$cookie->id_customer) if (Validate::isLoadedObject($context->customer))
{ $groups = $context->customer->getGroups();
$customer = new Customer((int)(self::$cookie->id_customer));
$groups = $customer->getGroups();
}
else else
$groups = array(1); $groups = array(1);
if ((int)self::$cart->id_address_delivery) if ((int)self::$cart->id_address_delivery)
$deliveryAddress = new Address((int)self::$cart->id_address_delivery); $deliveryAddress = new Address(self::$cart->id_address_delivery);
$result = array('carriers' => Carrier::getCarriersForOrder((int)Country::getIdZone((isset($deliveryAddress) AND (int)$deliveryAddress->id) ? (int)$deliveryAddress->id_country : (int)Configuration::get('PS_COUNTRY_DEFAULT')), $groups)); $result = array('carriers' => Carrier::getCarriersForOrder((int)Country::getIdZone((isset($deliveryAddress) AND (int)$deliveryAddress->id) ? (int)$deliveryAddress->id_country : (int)Configuration::get('PS_COUNTRY_DEFAULT')), $groups));
} }
$result['summary'] = self::$cart->getSummaryDetails(); $result['summary'] = self::$cart->getSummaryDetails();
+5 -5
View File
@@ -71,9 +71,9 @@ class authorizeAIM extends PaymentModule
return; return;
if ($params['objOrder']->getCurrentState() != _PS_OS_ERROR_) if ($params['objOrder']->getCurrentState() != _PS_OS_ERROR_)
$context->controller->smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id))); $context->smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id)));
else else
$context->controller->smarty->assign('status', 'failed'); $context->smarty->assign('status', 'failed');
return $this->display(__FILE__, 'hookorderconfirmation.tpl'); return $this->display(__FILE__, 'hookorderconfirmation.tpl');
} }
@@ -167,9 +167,9 @@ class authorizeAIM extends PaymentModule
$cards['discover'] = Configuration::get('AUTHORIZE_AIM_CARD_DISCOVER') == 'on' ? 1 : 0; $cards['discover'] = Configuration::get('AUTHORIZE_AIM_CARD_DISCOVER') == 'on' ? 1 : 0;
$cards['ax'] = Configuration::get('AUTHORIZE_AIM_CARD_AX') == 'on' ? 1 : 0; $cards['ax'] = Configuration::get('AUTHORIZE_AIM_CARD_AX') == 'on' ? 1 : 0;
$context->controller->smarty->assign('p', $authorizeAIMParams); $context->smarty->assign('p', $authorizeAIMParams);
$context->controller->smarty->assign('cards', $cards); $context->smarty->assign('cards', $cards);
$context->controller->smarty->assign('isFailed', $isFailed); $context->smarty->assign('isFailed', $isFailed);
return $this->display(__FILE__, 'authorizeaim.tpl'); return $this->display(__FILE__, 'authorizeaim.tpl');
} }
+4 -4
View File
@@ -171,7 +171,7 @@ class BankWire extends PaymentModule
$context = Context::getContext(); $context = Context::getContext();
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'nbProducts' => $cart->nbProducts(), 'nbProducts' => $cart->nbProducts(),
'cust_currency' => $cart->id_currency, 'cust_currency' => $cart->id_currency,
'currencies' => $this->getCurrency((int)$cart->id_currency), 'currencies' => $this->getCurrency((int)$cart->id_currency),
@@ -192,7 +192,7 @@ class BankWire extends PaymentModule
$context = Context::getContext(); $context = Context::getContext();
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'this_path' => $this->_path, 'this_path' => $this->_path,
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
)); ));
@@ -207,7 +207,7 @@ class BankWire extends PaymentModule
$context = Context::getContext(); $context = Context::getContext();
$state = $params['objOrder']->getCurrentState(); $state = $params['objOrder']->getCurrentState();
if ($state == _PS_OS_BANKWIRE_ OR $state == _PS_OS_OUTOFSTOCK_) if ($state == _PS_OS_BANKWIRE_ OR $state == _PS_OS_OUTOFSTOCK_)
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
'bankwireDetails' => nl2br2($this->details), 'bankwireDetails' => nl2br2($this->details),
'bankwireAddress' => nl2br2($this->address), 'bankwireAddress' => nl2br2($this->address),
@@ -216,7 +216,7 @@ class BankWire extends PaymentModule
'id_order' => $params['objOrder']->id 'id_order' => $params['objOrder']->id
)); ));
else else
$context->controller->smarty->assign('status', 'failed'); $context->smarty->assign('status', 'failed');
return $this->display(__FILE__, 'payment_return.tpl'); return $this->display(__FILE__, 'payment_return.tpl');
} }
@@ -210,9 +210,9 @@ class BlockAdvertising extends Module
{ {
$context = Context::getContext(); $context = Context::getContext();
$context->controller->addCSS($this->_path.'blockadvertising.css', 'all'); $context->controller->addCSS($this->_path.'blockadvertising.css', 'all');
$context->controller->smarty->assign('image', $context->link->protocol_content.$this->adv_img); $context->smarty->assign('image', $context->link->protocol_content.$this->adv_img);
$context->controller->smarty->assign('adv_link', $this->adv_link); $context->smarty->assign('adv_link', $this->adv_link);
$context->controller->smarty->assign('adv_title', $this->adv_title); $context->smarty->assign('adv_title', $this->adv_title);
return $this->display(__FILE__, 'blockadvertising.tpl'); return $this->display(__FILE__, 'blockadvertising.tpl');
} }
@@ -110,7 +110,7 @@ class BlockBestSellers extends Module
$bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product'])), $currency); $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product'])), $currency);
$best_sellers[] = $bestseller; $best_sellers[] = $bestseller;
} }
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'best_sellers' => $best_sellers, 'best_sellers' => $best_sellers,
'mediumSize' => Image::getSize('medium'))); 'mediumSize' => Image::getSize('medium')));
return $this->display(__FILE__, 'blockbestsellers.tpl'); return $this->display(__FILE__, 'blockbestsellers.tpl');
+3 -3
View File
@@ -161,8 +161,8 @@ class BlockCart extends Module
return; return;
$context = Context::getContext(); $context = Context::getContext();
$context->controller->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false); $context->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false);
$this->smartyAssigns($context->controller->smarty, $params); $this->smartyAssigns($context->smarty, $params);
return $this->display(__FILE__, 'blockcart.tpl'); return $this->display(__FILE__, 'blockcart.tpl');
} }
@@ -177,7 +177,7 @@ class BlockCart extends Module
return; return;
$context = Context::getContext(); $context = Context::getContext();
$this->smartyAssigns($context->controller->smarty, $params); $this->smartyAssigns($context->smarty, $params);
$res = $this->display(__FILE__, 'blockcart-json.tpl'); $res = $this->display(__FILE__, 'blockcart-json.tpl');
return $res; return $res;
} }
+16 -17
View File
@@ -186,11 +186,10 @@ class BlockCategories extends Module
if ($blockCategTree['id'] != $shopcurrentroot) if ($blockCategTree['id'] != $shopcurrentroot)
$blockCategTree = $this->cleanTree($blockCategTree['children']); $blockCategTree = $this->cleanTree($blockCategTree['children']);
$isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false); $isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false);
if (Tools::isSubmit('id_category')) if (Tools::isSubmit('id_category'))
{ {
$context->cookie->last_visited_category = $id_category; $context->cookie->last_visited_category = $id_category;
$context->controller->smarty->assign('currentCategoryId', $context->cookie->last_visited_category); $context->smarty->assign('currentCategoryId', $context->cookie->last_visited_category);
} }
if (Tools::isSubmit('id_product')) if (Tools::isSubmit('id_product'))
{ {
@@ -200,17 +199,17 @@ class BlockCategories extends Module
if (isset($product) AND Validate::isLoadedObject($product)) if (isset($product) AND Validate::isLoadedObject($product))
$context->cookie->last_visited_category = (int)($product->id_category_default); $context->cookie->last_visited_category = (int)($product->id_category_default);
} }
$context->controller->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category)); $context->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category));
} }
$context->controller->smarty->assign('blockCategTree', $blockCategTree); $context->smarty->assign('blockCategTree', $blockCategTree);
if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories.tpl')) if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories.tpl'))
$context->controller->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); $context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl');
else else
$context->controller->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); $context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
$context->controller->smarty->assign('isDhtml', $isDhtml); $context->smarty->assign('isDhtml', $isDhtml);
} }
$context->controller->smarty->cache_lifetime = 31536000; // 1 Year $context->smarty->cache_lifetime = 31536000; // 1 Year
$display = $this->display(__FILE__, 'blockcategories.tpl', $smartyCacheId); $display = $this->display(__FILE__, 'blockcategories.tpl', $smartyCacheId);
Tools::restoreCacheSettings(); Tools::restoreCacheSettings();
return $display; return $display;
@@ -258,8 +257,8 @@ class BlockCategories extends Module
$nbrColumns=3; $nbrColumns=3;
$numberColumn = abs(sizeof($result)/$nbrColumns); $numberColumn = abs(sizeof($result)/$nbrColumns);
$widthColumn= floor(100/$nbrColumns); $widthColumn= floor(100/$nbrColumns);
$context->controller->smarty->assign('numberColumn', $numberColumn); $context->smarty->assign('numberColumn', $numberColumn);
$context->controller->smarty->assign('widthColumn', $widthColumn); $context->smarty->assign('widthColumn', $widthColumn);
$blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH')); $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH'));
unset($resultParents); unset($resultParents);
@@ -274,7 +273,7 @@ class BlockCategories extends Module
if (Tools::isSubmit('id_category')) if (Tools::isSubmit('id_category'))
{ {
$context->cookie->last_visited_category = $id_category; $context->cookie->last_visited_category = $id_category;
$context->controller->smarty->assign('currentCategoryId', $context->cookie->last_visited_category); $context->smarty->assign('currentCategoryId', $context->cookie->last_visited_category);
} }
if (Tools::isSubmit('id_product')) if (Tools::isSubmit('id_product'))
{ {
@@ -284,17 +283,17 @@ class BlockCategories extends Module
if (isset($product) AND Validate::isLoadedObject($product)) if (isset($product) AND Validate::isLoadedObject($product))
$context->cookie->last_visited_category = (int)($product->id_category_default); $context->cookie->last_visited_category = (int)($product->id_category_default);
} }
$context->controller->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category)); $context->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category));
} }
$context->controller->smarty->assign('blockCategTree', $blockCategTree); $context->smarty->assign('blockCategTree', $blockCategTree);
if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories_footer.tpl')) if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories_footer.tpl'))
$context->controller->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); $context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl');
else else
$context->controller->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); $context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
$context->controller->smarty->assign('isDhtml', $isDhtml); $context->smarty->assign('isDhtml', $isDhtml);
} }
$context->controller->smarty->cache_lifetime = 31536000; // 1 Year $context->smarty->cache_lifetime = 31536000; // 1 Year
$display = $this->display(__FILE__, 'blockcategories_footer.tpl', $smartyCacheId); $display = $this->display(__FILE__, 'blockcategories_footer.tpl', $smartyCacheId);
Tools::restoreCacheSettings(); Tools::restoreCacheSettings();
return $display; return $display;
+3 -3
View File
@@ -703,7 +703,7 @@ class BlockCms extends Module
{ {
$context = Context::getContext(); $context = Context::getContext();
$cms_titles = self::getCMStitles(self::LEFT_COLUMN); $cms_titles = self::getCMStitles(self::LEFT_COLUMN);
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'block' => 1, 'block' => 1,
'cms_titles' => $cms_titles, 'cms_titles' => $cms_titles,
'theme_dir' => _PS_THEME_DIR_ 'theme_dir' => _PS_THEME_DIR_
@@ -716,7 +716,7 @@ class BlockCms extends Module
$context = Context::getContext(); $context = Context::getContext();
$cms_titles = self::getCMStitles(self::RIGHT_COLUMN); $cms_titles = self::getCMStitles(self::RIGHT_COLUMN);
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'block' => 1, 'block' => 1,
'cms_titles' => $cms_titles, 'cms_titles' => $cms_titles,
'theme_dir' => _PS_THEME_DIR_ 'theme_dir' => _PS_THEME_DIR_
@@ -731,7 +731,7 @@ class BlockCms extends Module
if (Configuration::get('FOOTER_BLOCK_ACTIVATION')) if (Configuration::get('FOOTER_BLOCK_ACTIVATION'))
{ {
$cms_titles = self::getCMStitlesFooter(); $cms_titles = self::getCMStitlesFooter();
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'block' => 0, 'block' => 0,
'cmslinks' => $cms_titles, 'cmslinks' => $cms_titles,
'theme_dir' => _PS_THEME_DIR_, 'theme_dir' => _PS_THEME_DIR_,
+1 -1
View File
@@ -63,7 +63,7 @@ class BlockCurrencies extends Module
$currencies = Currency::getCurrencies(false, 1, $this->context->shop->getID()); $currencies = Currency::getCurrencies(false, 1, $this->context->shop->getID());
if (!sizeof($currencies)) if (!sizeof($currencies))
return ''; return '';
$this->context->controller->smarty->assign('currencies', $currencies); $this->context->smarty->assign('currencies', $currencies);
return $this->display(__FILE__, 'blockcurrencies.tpl'); return $this->display(__FILE__, 'blockcurrencies.tpl');
} }
+1 -1
View File
@@ -60,7 +60,7 @@ class BlockLanguages extends Module
$languages = Language::getLanguages(true, $this->context->shop->getID()); $languages = Language::getLanguages(true, $this->context->shop->getID());
if (!sizeof($languages)) if (!sizeof($languages))
return ''; return '';
$this->context->controller->smarty->assign('languages', $languages); $this->context->smarty->assign('languages', $languages);
return $this->display(__FILE__, 'blocklanguages.tpl'); return $this->display(__FILE__, 'blocklanguages.tpl');
} }
+6 -6
View File
@@ -715,7 +715,7 @@ class BlockLayered extends Module
$share_url = $context->link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$context->language->id], $context->language->id).rtrim($params, '&'); $share_url = $context->link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$context->language->id], $context->language->id).rtrim($params, '&');
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'display_share' => (int)Configuration::get('PS_LAYERED_SHARE'), 'display_share' => (int)Configuration::get('PS_LAYERED_SHARE'),
'share_url' => $this->getShortLink($share_url), 'share_url' => $this->getShortLink($share_url),
'layered_use_checkboxes' => (int)Configuration::get('PS_LAYERED_NAVIGATION_CHECKBOXES'), 'layered_use_checkboxes' => (int)Configuration::get('PS_LAYERED_NAVIGATION_CHECKBOXES'),
@@ -756,7 +756,7 @@ class BlockLayered extends Module
if ($stop > $pages_nb) if ($stop > $pages_nb)
$stop = (int)($pages_nb); $stop = (int)($pages_nb);
$context->controller->smarty->assign('nb_products', $nbProducts); $context->smarty->assign('nb_products', $nbProducts);
$pagination_infos = array( $pagination_infos = array(
'pages_nb' => (int)($pages_nb), 'pages_nb' => (int)($pages_nb),
'p' => (int)($p), 'p' => (int)($p),
@@ -766,15 +766,15 @@ class BlockLayered extends Module
'stop' => (int)($stop), '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) '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)
); );
$context->controller->smarty->assign($pagination_infos); $context->smarty->assign($pagination_infos);
$context->controller->smarty->assign('products', $products); $context->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 */ /* 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( return Tools::jsonEncode(array(
'filtersBlock' => $this->generateFiltersBlock($selectedFilters), 'filtersBlock' => $this->generateFiltersBlock($selectedFilters),
'productList' => $context->controller->smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'), 'productList' => $context->smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'),
'pagination' => $context->controller->smarty->fetch(_PS_THEME_DIR_.'pagination.tpl') 'pagination' => $context->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>'; // return '<div id="layered_ajax_column">'.$this->generateFiltersBlock($selectedFilters).'</div><div id="layered_ajax_products">'.$smarty->fetch(_PS_THEME_DIR_.'product-list.tpl').'</div>';
} }
+1 -1
View File
@@ -86,7 +86,7 @@ class BlockLink extends Module
$context = Context::getContext(); $context = Context::getContext();
$links = $this->getLinks(); $links = $this->getLinks();
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'blocklink_links' => $links, 'blocklink_links' => $links,
'title' => Configuration::get('PS_BLOCKLINK_TITLE', $context->language->id), 'title' => Configuration::get('PS_BLOCKLINK_TITLE', $context->language->id),
'url' => Configuration::get('PS_BLOCKLINK_URL'), 'url' => Configuration::get('PS_BLOCKLINK_URL'),
@@ -56,7 +56,7 @@ class BlockManufacturer extends Module
{ {
$context = Context::getContext(); $context = Context::getContext();
//$getNbProducts = false, $id_lang = 0, $active = true, $p = false, $n = false, $all_group = false, $id_shop = false //$getNbProducts = false, $id_lang = 0, $active = true, $p = false, $n = false, $all_group = false, $id_shop = false
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'manufacturers' => Manufacturer::getManufacturers(false, 0, true, false, false, false, $this->context->shop->getGroupID()), 'manufacturers' => Manufacturer::getManufacturers(false, 0, true, false, false, false, $this->context->shop->getGroupID()),
'link' => $context->link, 'link' => $context->link,
'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
+1 -1
View File
@@ -61,7 +61,7 @@ class BlockMyAccount extends Module
$context = Context::getContext(); $context = Context::getContext();
if (!$params['cookie']->isLogged()) if (!$params['cookie']->isLogged())
return false; return false;
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')), 'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')),
'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN')), 'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN')),
'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock') 'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock')
@@ -100,7 +100,7 @@ class BlockNewProducts extends Module
$newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR'))); $newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR')));
if (!$newProducts AND !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) if (!$newProducts AND !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
return; return;
$context->controller->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium'))); $context->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));
return $this->display(__FILE__, 'blocknewproducts.tpl'); return $this->display(__FILE__, 'blocknewproducts.tpl');
} }
+3 -3
View File
@@ -242,7 +242,7 @@ class Blocknewsletter extends Module
$this->newsletterRegistration(); $this->newsletterRegistration();
if ($this->error) if ($this->error)
{ {
$context->controller->smarty->assign(array('color' => 'red', $context->smarty->assign(array('color' => 'red',
'msg' => $this->error, 'msg' => $this->error,
'nw_value' => isset($_POST['email']) ? pSQL($_POST['email']) : false, 'nw_value' => isset($_POST['email']) ? pSQL($_POST['email']) : false,
'nw_error' => true, 'nw_error' => true,
@@ -252,12 +252,12 @@ class Blocknewsletter extends Module
{ {
if (Configuration::get('NW_CONFIRMATION_EMAIL') AND isset($_POST['action']) AND (int)($_POST['action']) == 0) if (Configuration::get('NW_CONFIRMATION_EMAIL') AND isset($_POST['action']) AND (int)($_POST['action']) == 0)
Mail::Send($params['cookie']->id_lang, 'newsletter_conf', Mail::l('Newsletter confirmation'), array(), pSQL($_POST['email']), NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/'); 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', $context->smarty->assign(array('color' => 'green',
'msg' => $this->valid, 'msg' => $this->valid,
'nw_error' => false)); 'nw_error' => false));
} }
} }
$context->controller->smarty->assign('this_path', $this->_path); $context->smarty->assign('this_path', $this->_path);
return $this->display(__FILE__, 'blocknewsletter.tpl'); return $this->display(__FILE__, 'blocknewsletter.tpl');
} }
@@ -119,7 +119,7 @@ class BlockPaymentLogo extends Module
$cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $context->language->id); $cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $context->language->id);
if (!Validate::isLoadedObject($cms)) if (!Validate::isLoadedObject($cms))
return; return;
$context->controller->smarty->assign('cms_payement_logo', $cms); $context->smarty->assign('cms_payement_logo', $cms);
return $this->display(__FILE__, 'blockpaymentlogo.tpl'); return $this->display(__FILE__, 'blockpaymentlogo.tpl');
} }
+1 -1
View File
@@ -148,7 +148,7 @@ class Blockrss extends Module
$rss_links[] = array('title' => $item->title, 'url' => $item->link); $rss_links[] = array('title' => $item->title, 'url' => $item->link);
// Display smarty // Display smarty
$context->controller->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links)); $context->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links));
return $this->display(__FILE__, 'blockrss.tpl'); return $this->display(__FILE__, 'blockrss.tpl');
} }
+4 -4
View File
@@ -82,14 +82,14 @@ class BlockSearch extends Module
{ {
$context = Context::getContext(); $context = Context::getContext();
$context->controller->smarty->assign('ENT_QUOTES', ENT_QUOTES); $context->smarty->assign('ENT_QUOTES', ENT_QUOTES);
$context->controller->smarty->assign('search_ssl', (int)(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')); $context->smarty->assign('search_ssl', (int)(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'));
$ajaxSearch=(int)(Configuration::get('PS_SEARCH_AJAX')); $ajaxSearch=(int)(Configuration::get('PS_SEARCH_AJAX'));
$context->controller->smarty->assign('ajaxsearch', $ajaxSearch); $context->smarty->assign('ajaxsearch', $ajaxSearch);
$instantSearch = (int)(Configuration::get('PS_INSTANT_SEARCH')); $instantSearch = (int)(Configuration::get('PS_INSTANT_SEARCH'));
$context->controller->smarty->assign('instantsearch', $instantSearch); $context->smarty->assign('instantsearch', $instantSearch);
if ($ajaxSearch) if ($ajaxSearch)
{ {
$context->controller->addCSS(_PS_CSS_DIR_.'jquery.autocomplete.css'); $context->controller->addCSS(_PS_CSS_DIR_.'jquery.autocomplete.css');
+1 -1
View File
@@ -88,7 +88,7 @@ class BlockSpecials extends Module
if (!$special = Product::getRandomSpecial((int)($params['cookie']->id_lang), false, false, $this->context->shop->getID()) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) if (!$special = Product::getRandomSpecial((int)($params['cookie']->id_lang), false, false, $this->context->shop->getID()) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY'))
return; return;
$this->context->controller->smarty->assign(array( $this->context->smarty->assign(array(
'special' => $special, 'special' => $special,
'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2),
'mediumSize' => Image::getSize('medium') 'mediumSize' => Image::getSize('medium')
+1 -1
View File
@@ -66,7 +66,7 @@ class BlockStore extends Module
$context = Context::getContext(); $context = Context::getContext();
$context->controller->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG')); $context->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG'));
return $this->display(__FILE__, 'blockstore.tpl'); return $this->display(__FILE__, 'blockstore.tpl');
} }
+1 -1
View File
@@ -61,7 +61,7 @@ class BlockSupplier extends Module
function hookLeftColumn($params) function hookLeftColumn($params)
{ {
$context = Context::getContext(); $context = Context::getContext();
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'suppliers' => Supplier::getSuppliers(false), 'suppliers' => Supplier::getSuppliers(false),
'link' => $context->link, 'link' => $context->link,
'text_list' => Configuration::get('SUPPLIER_DISPLAY_TEXT'), 'text_list' => Configuration::get('SUPPLIER_DISPLAY_TEXT'),
+1 -1
View File
@@ -107,7 +107,7 @@ class BlockTags extends Module
return false; return false;
foreach ($tags AS &$tag) foreach ($tags AS &$tag)
$tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']); $tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']);
$context->controller->smarty->assign('tags', $tags); $context->smarty->assign('tags', $tags);
return $this->display(__FILE__, 'blocktags.tpl'); return $this->display(__FILE__, 'blocktags.tpl');
} }
+1 -1
View File
@@ -60,7 +60,7 @@ class BlockUserInfo extends Module
if (!$this->active) if (!$this->active)
return; return;
$context = Context::getContext(); $context = Context::getContext();
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'cart' => $context->cart, 'cart' => $context->cart,
'cart_qties' => $context->cart->nbProducts(), 'cart_qties' => $context->cart->nbProducts(),
'logged' => $context->cookie->isLogged(), 'logged' => $context->cookie->isLogged(),
+1 -1
View File
@@ -167,7 +167,7 @@ class BlockViewed extends Module
if (!sizeof($productsViewedObj)) if (!sizeof($productsViewedObj))
return ; return ;
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'productsViewedObj' => $productsViewedObj, 'productsViewedObj' => $productsViewedObj,
'mediumSize' => Image::getSize('medium'))); 'mediumSize' => Image::getSize('medium')));
+3 -3
View File
@@ -196,7 +196,7 @@ class BlockWishList extends Module
} }
else else
$id_wishlist = $params['cookie']->id_wishlist; $id_wishlist = $params['cookie']->id_wishlist;
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'id_wishlist' => $id_wishlist, 'id_wishlist' => $id_wishlist,
'isLogged' => true, 'isLogged' => true,
'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $params['cookie']->id_customer, $params['cookie']->id_lang, null, true)), 'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $params['cookie']->id_customer, $params['cookie']->id_lang, null, true)),
@@ -204,7 +204,7 @@ class BlockWishList extends Module
'ptoken' => Tools::getToken(false))); 'ptoken' => Tools::getToken(false)));
} }
else else
$context->controller->smarty->assign(array('wishlist_products' => false, 'wishlists' => false)); $context->smarty->assign(array('wishlist_products' => false, 'wishlists' => false));
return ($this->display(__FILE__, 'blockwishlist.tpl')); return ($this->display(__FILE__, 'blockwishlist.tpl'));
} }
@@ -216,7 +216,7 @@ class BlockWishList extends Module
public function hookProductActions($params) public function hookProductActions($params)
{ {
$context = Context::getContext(); $context = Context::getContext();
$context->controller->smarty->assign('id_product', (int)(Tools::getValue('id_product'))); $context->smarty->assign('id_product', (int)(Tools::getValue('id_product')));
return ($this->display(__FILE__, 'blockwishlist-extra.tpl')); return ($this->display(__FILE__, 'blockwishlist-extra.tpl'));
} }
+1 -1
View File
@@ -70,7 +70,7 @@ class CarrierCompare extends Module
if ($context->customer->id) if ($context->customer->id)
return; return;
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'countries' => Country::getCountries($context->language->id), 'countries' => Country::getCountries($context->language->id),
'id_carrier' => ($params['cart']->id_carrier ? $params['cart']->id_carrier : Configuration::get('PS_CARRIER_DEFAULT')), 'id_carrier' => ($params['cart']->id_carrier ? $params['cart']->id_carrier : Configuration::get('PS_CARRIER_DEFAULT')),
'id_country' => (isset($context->customer->geoloc_id_country) ? $context->customer->geoloc_id_country : Configuration::get('PS_COUNTRY_DEFAULT')), 'id_country' => (isset($context->customer->geoloc_id_country) ? $context->customer->geoloc_id_country : Configuration::get('PS_COUNTRY_DEFAULT')),
+1 -1
View File
@@ -67,7 +67,7 @@ class CashOnDelivery extends PaymentModule
return false; return false;
} }
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'this_path' => $this->_path, 'this_path' => $this->_path,
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
)); ));
+4 -4
View File
@@ -555,7 +555,7 @@ abstract class PrepaidServices extends PaymentModule
if ($amount > $this->max_amount) if ($amount > $this->max_amount)
return false; return false;
$context->controller->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png', $context->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
'payment_name' => $this->displayName, 'payment_name' => $this->displayName,
'module_name' => $this->name)); 'module_name' => $this->name));
@@ -570,7 +570,7 @@ abstract class PrepaidServices extends PaymentModule
if ($params['objOrder']->module != $this->name) if ($params['objOrder']->module != $this->name)
return; return;
$context->controller->smarty->assign('payment_name', $this->displayName); $context->smarty->assign('payment_name', $this->displayName);
return $this->display(__FILE__, $this->name.'-confirmation.tpl'); return $this->display(__FILE__, $this->name.'-confirmation.tpl');
} }
@@ -598,7 +598,7 @@ abstract class PrepaidServices extends PaymentModule
// if the disposition is not "active" // if the disposition is not "active"
if ($res[5] != PrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PrepaidServicesAPI::DISPOSITION_DEBITED) if ($res[5] != PrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PrepaidServicesAPI::DISPOSITION_DEBITED)
{ {
$context->controller->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment)); $context->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
return $this->display($this->module_dir.'/'.$this->name, 'disposition-error.tpl'); 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')) if (Tools::getIsset('pp_error'))
$error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error')); $error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error'));
$context->controller->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'], $context->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
'payment_name' => $order->payment, 'payment_name' => $order->payment,
'error' => $error_msg, 'error' => $error_msg,
'currency' => $currency->getSign('right'), 'currency' => $currency->getSign('right'),
+4 -4
View File
@@ -157,7 +157,7 @@ class Cheque extends PaymentModule
$context = Context::getContext(); $context = Context::getContext();
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'nbProducts' => $cart->nbProducts(), 'nbProducts' => $cart->nbProducts(),
'cust_currency' => $cart->id_currency, 'cust_currency' => $cart->id_currency,
'currencies' => $this->getCurrency((int)$cart->id_currency), 'currencies' => $this->getCurrency((int)$cart->id_currency),
@@ -180,7 +180,7 @@ class Cheque extends PaymentModule
return ; return ;
$context = Context::getContext(); $context = Context::getContext();
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'this_path' => $this->_path, 'this_path' => $this->_path,
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
)); ));
@@ -195,7 +195,7 @@ class Cheque extends PaymentModule
$context = Context::getContext(); $context = Context::getContext();
$state = $params['objOrder']->getCurrentState(); $state = $params['objOrder']->getCurrentState();
if ($state == _PS_OS_CHEQUE_ OR $state == _PS_OS_OUTOFSTOCK_) if ($state == _PS_OS_CHEQUE_ OR $state == _PS_OS_OUTOFSTOCK_)
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
'chequeName' => $this->chequeName, 'chequeName' => $this->chequeName,
'chequeAddress' => nl2br2($this->address), 'chequeAddress' => nl2br2($this->address),
@@ -203,7 +203,7 @@ class Cheque extends PaymentModule
'id_order' => $params['objOrder']->id 'id_order' => $params['objOrder']->id
)); ));
else else
$context->controller->smarty->assign('status', 'failed'); $context->smarty->assign('status', 'failed');
return $this->display(__FILE__, 'payment_return.tpl'); return $this->display(__FILE__, 'payment_return.tpl');
} }
+1 -1
View File
@@ -143,7 +143,7 @@ class CrossSelling extends Module
$orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], false, NULL); $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], false, NULL);
} }
$context->controller->smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), $context->smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0),
'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE'))); 'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE')));
} }
return $this->display(__FILE__, 'crossselling.tpl'); return $this->display(__FILE__, 'crossselling.tpl');
+2 -2
View File
@@ -111,7 +111,7 @@ class DateOfDelivery extends Module
foreach ($params['carriers'] as $carrier) foreach ($params['carriers'] as $carrier)
$datesDelivery[(int)($carrier['id_carrier'])] = $this->_getDatesOfDelivery((int)($carrier['id_carrier']), $oos); $datesDelivery[(int)($carrier['id_carrier'])] = $this->_getDatesOfDelivery((int)($carrier['id_carrier']), $oos);
$context->controller->smarty->assign(array( $context->smarty->assign(array(
'datesDelivery' => $datesDelivery, 'datesDelivery' => $datesDelivery,
'id_carrier' => ($params['cart']->id_carrier ? (int)($params['cart']->id_carrier) : (int)(Configuration::get('PS_CARRIER_DEFAULT'))) 'id_carrier' => ($params['cart']->id_carrier ? (int)($params['cart']->id_carrier) : (int)(Configuration::get('PS_CARRIER_DEFAULT')))
)); ));
@@ -134,7 +134,7 @@ class DateOfDelivery extends Module
if (!is_array($datesDelivery) OR !sizeof($datesDelivery)) if (!is_array($datesDelivery) OR !sizeof($datesDelivery))
return ; return ;
$context->controller->smarty->assign('datesDelivery', $datesDelivery); $context->smarty->assign('datesDelivery', $datesDelivery);
return $this->display(__FILE__, 'orderDetail.tpl'); return $this->display(__FILE__, 'orderDetail.tpl');
} }
+55 -55
View File
@@ -394,7 +394,7 @@ class Dejala extends CarrierModule
{ {
$context = Context::getContext(); $context = Context::getContext();
//$context->controller->smarty->assign('country', $this->dejalaConfig->country); //$context->smarty->assign('country', $this->dejalaConfig->country);
$output = $this->display(__FILE__, 'dejala_header.tpl'); $output = $this->display(__FILE__, 'dejala_header.tpl');
if (!empty($_POST)) if (!empty($_POST))
{ {
@@ -424,14 +424,14 @@ class Dejala extends CarrierModule
$errors = array(); $errors = array();
$outputMain = ''; $outputMain = '';
$context->controller->smarty->assign("djl_mode", $this->dejalaConfig->mode); $context->smarty->assign("djl_mode", $this->dejalaConfig->mode);
$context->controller->smarty->assign("disabled", ''); $context->smarty->assign("disabled", '');
if ($this->dejalaConfig->mode == 'PROD') if ($this->dejalaConfig->mode == 'PROD')
$context->controller->smarty->assign("disabled", 'disabled="disabled"'); $context->smarty->assign("disabled", 'disabled="disabled"');
if (true !== extension_loaded('curl')) if (true !== extension_loaded('curl'))
{ {
$errors[] = $this->l('This module requires php extension cURL to function properly. Please install the php extension "cURL" first.'); $errors[] = $this->l('This module requires php extension cURL to function properly. Please install the php extension "cURL" first.');
$context->controller->smarty->assign("disabled", 'disabled="disabled"'); $context->smarty->assign("disabled", 'disabled="disabled"');
} }
$registered = TRUE; $registered = TRUE;
@@ -453,7 +453,7 @@ class Dejala extends CarrierModule
} }
} }
$context->controller->smarty->assign("registered", $registered?"1":"0"); $context->smarty->assign("registered", $registered?"1":"0");
if (!isset($_GET['cat']) || ($_GET['cat']==='home') || ($_GET['cat']==='')) if (!isset($_GET['cat']) || ($_GET['cat']==='home') || ($_GET['cat']===''))
@@ -461,19 +461,19 @@ class Dejala extends CarrierModule
else else
$currentTab=$_GET['cat']; $currentTab=$_GET['cat'];
$context->controller->smarty->assign("currentTab", $currentTab); $context->smarty->assign("currentTab", $currentTab);
$context->controller->smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']); $context->smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']);
$context->controller->smarty->assign("formAction", $_SERVER['REQUEST_URI']); $context->smarty->assign("formAction", $_SERVER['REQUEST_URI']);
$outputMenu = $this->display(__FILE__, 'dejala_menu.tpl'); $outputMenu = $this->display(__FILE__, 'dejala_menu.tpl');
if ($currentTab==='home') if ($currentTab==='home')
{ {
$context->controller->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8')); $context->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8'));
if ($registered) if ($registered)
{ {
$context->controller->smarty->assign("visibility_status", $this->dejalaConfig->visibility_status); $context->smarty->assign("visibility_status", $this->dejalaConfig->visibility_status);
$context->controller->smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list); $context->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')); $context->smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8'));
$smartifyErrors = $this->smartyfyStoreAttributes(); $smartifyErrors = $this->smartyfyStoreAttributes();
if (isset($smartifyErrors) && count($smartifyErrors)) if (isset($smartifyErrors) && count($smartifyErrors))
$errors = $smartifyErrors; $errors = $smartifyErrors;
@@ -483,7 +483,7 @@ class Dejala extends CarrierModule
$shopName = Configuration::get('PS_SHOP_NAME'); $shopName = Configuration::get('PS_SHOP_NAME');
if (strlen($shopName) >= 15) if (strlen($shopName) >= 15)
$shopName = substr($shopName, 0, 15); $shopName = substr($shopName, 0, 15);
$context->controller->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8')); $context->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8'));
} }
$outputMain = $this->display(__FILE__, 'dejala_home.tpl'); $outputMain = $this->display(__FILE__, 'dejala_home.tpl');
} }
@@ -496,7 +496,7 @@ class Dejala extends CarrierModule
{ {
foreach ($contacts as $contactName=>$contactData) { foreach ($contacts as $contactName=>$contactData) {
foreach ($contactData as $key=>$value) { foreach ($contactData as $key=>$value) {
$context->controller->smarty->assign($contactName.'_'.$key, $value); $context->smarty->assign($contactName.'_'.$key, $value);
} }
} }
} }
@@ -510,7 +510,7 @@ class Dejala extends CarrierModule
if ('200' == $responseArray['status']) if ('200' == $responseArray['status'])
{ {
foreach ($location as $key=>$value) foreach ($location as $key=>$value)
$context->controller->smarty->assign($key, $value); $context->smarty->assign($key, $value);
$outputMain = $this->display(__FILE__, 'dejala_location.tpl'); $outputMain = $this->display(__FILE__, 'dejala_location.tpl');
} }
@@ -523,7 +523,7 @@ class Dejala extends CarrierModule
if ('200' == $responseArray['status']) if ('200' == $responseArray['status'])
{ {
foreach ($processes as $key=>$value) foreach ($processes as $key=>$value)
$context->controller->smarty->assign($key, $value); $context->smarty->assign($key, $value);
$outputMain = $this->display(__FILE__, 'dejala_processes.tpl'); $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'] = number_format(round($product['price'] + $product['margin'], 2), 2, '.', '');
$product['public_price_notax'] = number_format(round($product['public_price']/$vat_factor, 2), 2, '.', ''); $product['public_price_notax'] = number_format(round($product['public_price']/$vat_factor, 2), 2, '.', '');
} }
$context->controller->smarty->assign('products', $products); $context->smarty->assign('products', $products);
$outputMain = $this->display(__FILE__, 'dejala_products.tpl'); $outputMain = $this->display(__FILE__, 'dejala_products.tpl');
} }
} }
@@ -582,10 +582,10 @@ class Dejala extends CarrierModule
$delivery['delivery_time'] = date('H\hi', $delivery['delivery_utc']); $delivery['delivery_time'] = date('H\hi', $delivery['delivery_utc']);
} }
} }
$context->controller->smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php'); $context->smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php');
$context->controller->smarty->assign('defaultDateFrom', date('01/m/Y')); $context->smarty->assign('defaultDateFrom', date('01/m/Y'));
$context->controller->smarty->assign('defaultDateTo', date('d/m/Y')); $context->smarty->assign('defaultDateTo', date('d/m/Y'));
$context->controller->smarty->assign('deliveries', $deliveries); $context->smarty->assign('deliveries', $deliveries);
$outputMain = $this->display(__FILE__, 'dejala_deliveries.tpl'); $outputMain = $this->display(__FILE__, 'dejala_deliveries.tpl');
} }
} }
@@ -608,9 +608,9 @@ class Dejala extends CarrierModule
$m_status['checked'] = '0'; $m_status['checked'] = '0';
$orderStatuses[] = $m_status; $orderStatuses[] = $m_status;
} }
$context->controller->smarty->assign('statuses', $orderStatuses); $context->smarty->assign('statuses', $orderStatuses);
$context->controller->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses); $context->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses);
$outputMain = $this->display(__FILE__, 'dejala_technical_options.tpl'); $outputMain = $this->display(__FILE__, 'dejala_technical_options.tpl');
} }
@@ -639,20 +639,20 @@ class Dejala extends CarrierModule
$errors[] = $this->l('An error occurred while getting store, please try again later or contact Dejala.com'); $errors[] = $this->l('An error occurred while getting store, please try again later or contact Dejala.com');
else else
{ {
$context->controller->smarty->assign("account_balance", $storeAttrs['account_balance']); $context->smarty->assign("account_balance", $storeAttrs['account_balance']);
$context->controller->smarty->assign("store_name", $storeAttrs['name']); $context->smarty->assign("store_name", $storeAttrs['name']);
// Check if account exists in production // Check if account exists in production
$responsePing = $djlUtil->ping($this->dejalaConfig, 'PROD'); $responsePing = $djlUtil->ping($this->dejalaConfig, 'PROD');
if ('200' == $responsePing['status']) if ('200' == $responsePing['status'])
$context->controller->smarty->assign('isLiveReady', '1'); $context->smarty->assign('isLiveReady', '1');
else else
{ {
$context->controller->smarty->assign('isLiveReady', '0'); $context->smarty->assign('isLiveReady', '0');
if (isset($storeAttrs['attributes']) && isset($storeAttrs['attributes']['request_live']) && ($storeAttrs['attributes']['request_live']=='true')) if (isset($storeAttrs['attributes']) && isset($storeAttrs['attributes']['request_live']) && ($storeAttrs['attributes']['request_live']=='true'))
$context->controller->smarty->assign('isLiveRequested', '1'); $context->smarty->assign('isLiveRequested', '1');
else else
$context->controller->smarty->assign('isLiveRequested', '0'); $context->smarty->assign('isLiveRequested', '0');
} }
} }
return ($errors); return ($errors);
@@ -682,26 +682,26 @@ class Dejala extends CarrierModule
$response = $djlUtil->getStoreAttributes($this->dejalaConfig, $store); $response = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
if ($response['status'] == 200) if ($response['status'] == 200)
{ {
$context->controller->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']); $context->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']);
$context->controller->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']); $context->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']);
if (isset($store['attributes']['delivery_partial'])) if (isset($store['attributes']['delivery_partial']))
$context->controller->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']); $context->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']);
} }
$wday_selected = array(1, 1, 1, 1, 1, 1, 1); $wday_selected = array(1, 1, 1, 1, 1, 1, 1);
$context->controller->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css'); $context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
$context->controller->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js'); $context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
$context->controller->smarty->assign("weekdayLabels", $this->wday_labels); $context->smarty->assign("weekdayLabels", $this->wday_labels);
$context->controller->smarty->assign("weekdaySelected", $wday_selected); $context->smarty->assign("weekdaySelected", $wday_selected);
$calendar = array(); $calendar = array();
$response = $djlUtil->getStoreCalendar($this->dejalaConfig, $calendar); $response = $djlUtil->getStoreCalendar($this->dejalaConfig, $calendar);
if ($response['status'] == 200) if ($response['status'] == 200)
{ {
$context->controller->smarty->assign("calendar", $calendar); $context->smarty->assign("calendar", $calendar);
$context->controller->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl"); $context->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl");
} }
$output = $output . $this->display(__FILE__, 'dejala_delivery_options.tpl'); $output = $output . $this->display(__FILE__, 'dejala_delivery_options.tpl');
@@ -871,8 +871,8 @@ class Dejala extends CarrierModule
$this->mylog("date$=" . $this->logValue($dates,1)); $this->mylog("date$=" . $this->logValue($dates,1));
$context->controller->smarty->assign('nb_days', $nbDeliveryDates); $context->smarty->assign('nb_days', $nbDeliveryDates);
$context->controller->smarty->assign('dates', $dates); $context->smarty->assign('dates', $dates);
for ($i=0; $i < 24; $i++) for ($i=0; $i < 24; $i++)
{ {
$endHour = (($i+$electedProduct['timelimit'])%24); $endHour = (($i+$electedProduct['timelimit'])%24);
@@ -880,10 +880,10 @@ class Dejala extends CarrierModule
$endHour = 24; $endHour = 24;
$hourLabels[] = $i . 'h-' . $endHour . 'h'; $hourLabels[] = $i . 'h-' . $endHour . 'h';
} }
$context->controller->smarty->assign('hourLabels', $hourLabels); $context->smarty->assign('hourLabels', $hourLabels);
$context->controller->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css'); $context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
$context->controller->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js'); $context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
$this->mylog("electedCarrier->id=" . $this->logValue($djlCarrier->id)); $this->mylog("electedCarrier->id=" . $this->logValue($djlCarrier->id));
$mCarrier = $djlCarrier; $mCarrier = $djlCarrier;
@@ -896,9 +896,9 @@ class Dejala extends CarrierModule
$resultsArray[] = $row; $resultsArray[] = $row;
$context->controller->smarty->assign('carriers', $resultsArray); $context->smarty->assign('carriers', $resultsArray);
$context->controller->smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ; $context->smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ;
$context->controller->smarty->assign('product', $electedProduct); $context->smarty->assign('product', $electedProduct);
$djlCart = new DejalaCart($cart->id); $djlCart = new DejalaCart($cart->id);
@@ -915,21 +915,21 @@ class Dejala extends CarrierModule
{ {
if ($l_date['value'] == $deliveryDateSelected) if ($l_date['value'] == $deliveryDateSelected)
{ {
$context->controller->smarty->assign("deliveryDateIndexSelected", $l_key); $context->smarty->assign("deliveryDateIndexSelected", $l_key);
$context->controller->smarty->assign("deliveryDateSelected", $deliveryDateSelected); $context->smarty->assign("deliveryDateSelected", $deliveryDateSelected);
$context->controller->smarty->assign("deliveryHourSelected", $m_hour); $context->smarty->assign("deliveryHourSelected", $m_hour);
$setDefaultDate = FALSE; $setDefaultDate = FALSE;
} }
} }
} }
if ($setDefaultDate) if ($setDefaultDate)
{ {
$context->controller->smarty->assign("deliveryDateIndexSelected", 0); $context->smarty->assign("deliveryDateIndexSelected", 0);
$context->controller->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc)); $context->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc));
$context->controller->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc))); $context->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc)));
} }
$context->controller->smarty->assign("isCartOutOfStock", $isCartOutOfStock); $context->smarty->assign("isCartOutOfStock", $isCartOutOfStock);
if (!$isCartOutOfStock) if (!$isCartOutOfStock)
{ {
$buffer = $this->display(__FILE__, 'dejala_carrier.tpl'); $buffer = $this->display(__FILE__, 'dejala_carrier.tpl');
@@ -937,7 +937,7 @@ class Dejala extends CarrierModule
} }
else else
{ {
$context->controller->smarty->assign('nostock_info', $this->l('I will select my shipping date when my product is available.')); $context->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'); $buffer = $this->display(__FILE__, 'dejala_carrier_nostock.tpl');
} }
return $buffer; return $buffer;
+3 -3
View File
@@ -190,11 +190,11 @@ class Ogone extends PaymentModule
return; return;
if ($params['objOrder']->valid) if ($params['objOrder']->valid)
$context->controller->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id)); $context->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id));
else else
$context->controller->smarty->assign('status', 'failed'); $context->smarty->assign('status', 'failed');
$context->controller->smarty->assign('ogone_link', (method_exists($link, 'getPageLink') ? $context->link->getPageLink('contact', true) : Tools::getHttpHost(true).'contact')); $context->smarty->assign('ogone_link', (method_exists($link, 'getPageLink') ? $context->link->getPageLink('contact', true) : Tools::getHttpHost(true).'contact'));
return $this->display(dirname(__FILE__), 'hookorderconfirmation.tpl'); return $this->display(dirname(__FILE__), 'hookorderconfirmation.tpl');
} }
+1 -1
View File
@@ -184,7 +184,7 @@ function submitAccount()
{ {
if (Mail::Send($context->language->id, 'account', Mail::l('Welcome!'), if (Mail::Send($context->language->id, 'account', Mail::l('Welcome!'),
array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname)) array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname))
$context->controller->smarty->assign('confirmation', 1); $context->smarty->assign('confirmation', 1);
$context->cookie->id_customer = (int)($customer->id); $context->cookie->id_customer = (int)($customer->id);
$context->cookie->customer_lastname = $customer->lastname; $context->cookie->customer_lastname = $customer->lastname;
$context->cookie->customer_firstname = $customer->firstname; $context->cookie->customer_firstname = $customer->firstname;