// Context part 11
This commit is contained in:
@@ -29,13 +29,12 @@ class AdminReturn extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$this->table = 'order_return';
|
||||
$this->className = 'OrderReturn';
|
||||
$this->colorOnBackground = true;
|
||||
$this->_select = 'orsl.`name`';
|
||||
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)($cookie->id_lang).')';
|
||||
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$context->language->id.')';
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_order_return' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
@@ -54,8 +53,7 @@ class AdminReturn extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (Tools::isSubmit('deleteorder_return_detail'))
|
||||
{
|
||||
if ($this->tabAccess['delete'] === '1')
|
||||
@@ -103,7 +101,7 @@ class AdminReturn extends AdminTab
|
||||
'{firstname}' => $customer->firstname,
|
||||
'{id_order_return}' => $id_order_return,
|
||||
'{state_order_return}' => $orderReturnState->name[(int)(Configuration::get('PS_LANG_DEFAULT'))]);
|
||||
Mail::Send((int)($cookie->id_lang), 'order_return_state', Mail::l('Your order return state has changed'), $vars, $customer->email, $customer->firstname.' '.$customer->lastname);
|
||||
Mail::Send(clan, 'order_return_state', Mail::l('Your order return state has changed'), $vars, $customer->email, $customer->firstname.' '.$customer->lastname);
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
}
|
||||
@@ -118,8 +116,7 @@ class AdminReturn extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
// Include current tab
|
||||
if (isset($_GET['update'.$this->table]))
|
||||
{
|
||||
@@ -133,7 +130,7 @@ class AdminReturn extends AdminTab
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->displayList();
|
||||
$this->displayOptionsList();
|
||||
$this->includeSubTab('display');
|
||||
@@ -143,7 +140,6 @@ class AdminReturn extends AdminTab
|
||||
|
||||
public function displayListContent($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$irow = 0;
|
||||
if ($this->_list)
|
||||
foreach ($this->_list AS $tr)
|
||||
@@ -159,7 +155,7 @@ class AdminReturn extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -175,12 +171,12 @@ class AdminReturn extends AdminTab
|
||||
$customer = new Customer((int)($obj->id_customer));
|
||||
echo '
|
||||
<div class="margin-form">'.$customer->firstname.' '.$customer->lastname.'
|
||||
<p style="clear: both"><a href="index.php?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">'.$this->l('View details on customer page').'</a></p>
|
||||
<p style="clear: both"><a href="index.php?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">'.$this->l('View details on customer page').'</a></p>
|
||||
</div>
|
||||
<label>'.$this->l('Order:').' </label>';
|
||||
$order = new Order((int)($obj->id_order));
|
||||
echo ' <div class="margin-form">'.$this->l('Order #').sprintf('%06d', $order->id).' '.$this->l('from').' '.Tools::displayDate($order->date_upd, $order->id_lang).'
|
||||
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'">'.$this->l('View details on order page').'</a></p>
|
||||
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id).'">'.$this->l('View details on order page').'</a></p>
|
||||
</div>
|
||||
<label>'.$this->l('Customer explanation:').' </label>
|
||||
<div class="margin-form">'.$obj->question.'</div>
|
||||
@@ -188,7 +184,7 @@ class AdminReturn extends AdminTab
|
||||
<label>'.$this->l('Status:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name=\'state\'>';
|
||||
$states = OrderReturnState::getOrderReturnStates($cookie->id_lang);
|
||||
$states = OrderReturnState::getOrderReturnStates($context->language->id);
|
||||
foreach ($states as $state)
|
||||
echo '<option value="'.$state['id_order_return_state'].'"'.($obj->state == $state['id_order_return_state'] ? ' selected="selected"' : '').'>'.$state['name'].'</option>';
|
||||
echo ' </select>
|
||||
@@ -197,7 +193,7 @@ class AdminReturn extends AdminTab
|
||||
if ($obj->state >= 3)
|
||||
echo ' <label>'.$this->l('Slip:').' </label>
|
||||
<div class="margin-form">'.$this->l('Generate a new slip from the customer order').'
|
||||
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'#products">'.$this->l('More information on order page').'</a></p>
|
||||
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order='.$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id).'#products">'.$this->l('More information on order page').'</a></p>
|
||||
</div>';
|
||||
echo ' <label>'.$this->l('Products:').' </label>
|
||||
<div class="margin-form">';
|
||||
|
||||
@@ -47,7 +47,6 @@ class AdminReturnStates extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -125,7 +125,7 @@ class AdminScenes extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -139,7 +139,7 @@ class AdminScenes extends AdminTab
|
||||
echo 'startingData = new Array();'."\n";
|
||||
foreach ($obj->getProducts() as $key => $product)
|
||||
{
|
||||
$productObj = new Product((int)($product['id_product']), true, (int)($cookie->id_lang));
|
||||
$productObj = new Product($product['id_product'], true, $context->language->id);
|
||||
echo 'startingData['.$key.'] = new Array(\''.$productObj->name.'\', '.$product['id_product'].', '.$product['x_axis'].', '.$product['y_axis'].', '.$product['zone_width'].', '.$product['zone_height'].');';
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ class AdminScenes extends AdminTab
|
||||
<th>'.$this->l('ID').'</th>
|
||||
<th>'.$this->l('Image map name:').'</th>
|
||||
</tr>';
|
||||
$categories = Category::getCategories((int)($cookie->id_lang), false);
|
||||
$categories = Category::getCategories($context->language->id, false);
|
||||
$done = array();
|
||||
$index = array();
|
||||
if (Tools::isSubmit('categories'))
|
||||
|
||||
@@ -35,14 +35,13 @@ class AdminSearch extends AdminTab
|
||||
*/
|
||||
public function searchCatalog($query)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->_list['products'] = Product::searchByName((int)$cookie->id_lang, $query);
|
||||
$context = Context::getContext();
|
||||
$this->_list['products'] = Product::searchByName($context->language->id, $query);
|
||||
if (!empty($this->_list['products']))
|
||||
for ($i = 0; $i < count($this->_list['products']); $i++)
|
||||
$this->_list['products'][$i]['nameh'] = str_ireplace($query, '<span class="highlight">'.Tools::htmlentitiesUTF8($query).'</span>', $this->_list['products'][$i]['name']);
|
||||
|
||||
$this->_list['categories'] = Category::searchByName((int)$cookie->id_lang, $query);
|
||||
$this->_list['categories'] = Category::searchByName($context->language->id, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,8 +56,7 @@ class AdminSearch extends AdminTab
|
||||
|
||||
function postProcess()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$query = trim(Tools::getValue('bo_query'));
|
||||
$searchType = (int)Tools::getValue('bo_search_type');
|
||||
|
||||
@@ -73,7 +71,7 @@ class AdminSearch extends AdminTab
|
||||
{
|
||||
global $_LANGADM;
|
||||
$tabs = array();
|
||||
$result = Db::getInstance()->ExecuteS('SELECT class_name, name FROM '._DB_PREFIX_.'tab t INNER JOIN '._DB_PREFIX_.'tab_lang tl ON t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$cookie->id_lang);
|
||||
$result = Db::getInstance()->ExecuteS('SELECT class_name, name FROM '._DB_PREFIX_.'tab t INNER JOIN '._DB_PREFIX_.'tab_lang tl ON t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$context->language->id);
|
||||
foreach ($result as $row)
|
||||
$tabs[$row['class_name']] = $row['name'];
|
||||
foreach (AdminTab::$tabParenting as $key => $value)
|
||||
@@ -132,7 +130,7 @@ class AdminSearch extends AdminTab
|
||||
/* Handle product ID */
|
||||
if ($searchType == 1 AND (int)$query AND Validate::isUnsignedInt((int)$query))
|
||||
if ($product = new Product((int)$query) AND Validate::isLoadedObject($product))
|
||||
Tools::redirectAdmin('index.php?tab=AdminCatalog&id_product='.(int)($product->id).'&addproduct'.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin('index.php?tab=AdminCatalog&id_product='.(int)($product->id).'&addproduct'.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
|
||||
|
||||
/* Normal catalog search */
|
||||
$this->searchCatalog($query);
|
||||
@@ -156,7 +154,7 @@ class AdminSearch extends AdminTab
|
||||
/* Handle customer ID */
|
||||
if ($searchType AND (int)$query AND Validate::isUnsignedInt((int)$query))
|
||||
if ($customer = new Customer((int)$query) AND Validate::isLoadedObject($customer))
|
||||
Tools::redirectAdmin('index.php?tab=AdminCustomers&id_customer='.(int)($customer->id).'&viewcustomer'.'&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin('index.php?tab=AdminCustomers&id_customer='.(int)($customer->id).'&viewcustomer'.'&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id));
|
||||
|
||||
/* Normal customer search */
|
||||
$this->searchCustomer($query);
|
||||
@@ -166,7 +164,7 @@ class AdminSearch extends AdminTab
|
||||
if ($searchType == 3)
|
||||
{
|
||||
if ((int)$query AND Validate::isUnsignedInt((int)$query) AND $order = new Order((int)$query) AND Validate::isLoadedObject($order))
|
||||
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id));
|
||||
$this->_errors[] = Tools::displayError('No order found with this ID:').' '.Tools::htmlentitiesUTF8($query);
|
||||
}
|
||||
|
||||
@@ -182,7 +180,7 @@ class AdminSearch extends AdminTab
|
||||
if ($searchType == 5)
|
||||
{
|
||||
if ((int)$query AND Validate::isUnsignedInt((int)$query) AND $cart = new Cart((int)$query) AND Validate::isLoadedObject($cart))
|
||||
Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$context->employee->id));
|
||||
$this->_errors[] = Tools::displayError('No cart found with this ID:').' '.Tools::htmlentitiesUTF8($query);
|
||||
}
|
||||
}
|
||||
@@ -190,8 +188,8 @@ class AdminSearch extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie;
|
||||
$currentIndex = 'index.php';
|
||||
$context = Context::getContext();
|
||||
self::$currentIndex = 'index.php';
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$query = trim(Tools::getValue('bo_query'));
|
||||
$nbCategories = $nbProducts = $nbCustomers = 0;
|
||||
@@ -224,17 +222,17 @@ class AdminSearch extends AdminTab
|
||||
<td>'.$product['id_product'].'</td>
|
||||
<td align="center">'.($product['manufacturer_name'] != NULL ? stripslashes($product['manufacturer_name']) : '--').'</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)($cookie->id_employee)).'">'.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>'.stripslashes($product['tax_name']).'</td>
|
||||
<td align="center">'.$product['quantity'].'</td>
|
||||
<td align="center">'.$product['weight'].' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
|
||||
<td align="center"><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">
|
||||
<td align="center"><a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
|
||||
<img src="../img/admin/'.($product['active'] ? 'enabled.gif' : 'forbbiden.gif').'" alt="" /></a></td>
|
||||
<td>
|
||||
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">
|
||||
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
|
||||
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>
|
||||
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'"
|
||||
<a href="'.self::$currentIndex.'?tab=AdminCatalog&id_product='.$product['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'"
|
||||
onclick="return confirm(\''.$this->l('Do you want to delete this product?', __CLASS__, true, false).' ('.addslashes($product['name']).')\');">
|
||||
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
|
||||
</td>
|
||||
@@ -263,16 +261,16 @@ class AdminSearch extends AdminTab
|
||||
<td class="center">'.$imgGender.'</td>
|
||||
<td>'.stripslashes($customer['lastname']).' '.stripslashes($customer['firstname']).'</td>
|
||||
<td>'.stripslashes($customer['email']).'<a href="mailto:'.stripslashes($customer['email']).'"> <img src="../img/admin/email_edit.gif" alt="'.$this->l('Write to this customer').'" /></a></td>
|
||||
<td>'.Tools::displayDate($customer['birthday'], (int)($cookie->id_lang)).'</td>
|
||||
<td>'.Tools::displayDate($customer['date_add'], (int)($cookie->id_lang)).'</td>
|
||||
<td>'.Tools::displayDate($customer['birthday'], $context->language->id).'</td>
|
||||
<td>'.Tools::displayDate($customer['date_add'], $context->language->id).'</td>
|
||||
<td>'.Order::getCustomerNbOrders($customer['id_customer']).'</td>
|
||||
<td class="center"><img src="../img/admin/'.($customer['active'] ? 'enabled.gif' : 'forbbiden.gif').'" alt="" /></td>
|
||||
<td class="center" width="60px">
|
||||
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">
|
||||
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">
|
||||
<img src="../img/admin/details.gif" alt="'.$this->l('View orders').'" /></a>
|
||||
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&addcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'">
|
||||
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&addcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'">
|
||||
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this customer').'" /></a>
|
||||
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&deletecustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
|
||||
<a href="'.self::$currentIndex.'?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&deletecustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id).'" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');">
|
||||
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this customer').'" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
@@ -31,8 +31,6 @@ class AdminSearchConf extends AdminPreferences
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->className = 'Configuration';
|
||||
$this->table = 'configuration';
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ class AdminSearchEngines extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -46,8 +46,6 @@ class AdminShipping extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
/* Handling settings */
|
||||
if (isset($_POST['submitHandling'.$this->table]))
|
||||
{
|
||||
@@ -138,8 +136,6 @@ class AdminShipping extends AdminTab
|
||||
|
||||
public function displayFormHandling()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$confKeys = $this->_fieldsHandling;
|
||||
foreach ($confKeys AS $key => $confKey)
|
||||
$getConf[] = $key;
|
||||
@@ -195,8 +191,6 @@ class AdminShipping extends AdminTab
|
||||
|
||||
public function displayFormFees()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$carrierArray = array();
|
||||
$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);
|
||||
|
||||
@@ -30,7 +30,7 @@ class AdminShop extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
$this->table = 'shop';
|
||||
$this->className = 'Shop';
|
||||
@@ -40,7 +40,7 @@ class AdminShop extends AdminTab
|
||||
|
||||
$this->_select = 'gs.name group_shop_name, cl.name category_name';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'group_shop` gs ON (a.id_group_shop = gs.id_group_shop)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$cookie->id_lang.')';
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$context->language->id.')';
|
||||
$this->_group = 'GROUP BY id_shop';
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
@@ -80,7 +80,7 @@ class AdminShop extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm($isMainTab);
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -111,7 +111,7 @@ class AdminShop extends AdminTab
|
||||
echo '<label for="id_category">'.$this->l('Category root').'</label>
|
||||
<div class="margin-form">
|
||||
<select id="id_category" name="id_category">';
|
||||
$categories = Category::getCategories((int)$cookie->id_lang, false);
|
||||
$categories = Category::getCategories($context->language->id, false);
|
||||
Category::recurseCategory($categories, $categories[0][1], 1, $obj->id_category);
|
||||
|
||||
echo '
|
||||
|
||||
@@ -86,7 +86,6 @@ class AdminShopUrl extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm($isMainTab = true);
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -66,10 +66,9 @@ class AdminSlip extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$context = Context::getContext();
|
||||
echo '<div style="float:left;width:600px">';
|
||||
$this->getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
|
||||
$this->displayList();
|
||||
echo '</div>';
|
||||
|
||||
@@ -95,7 +94,6 @@ class AdminSlip extends AdminTab
|
||||
|
||||
public function displayListContent($token = NULL)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$irow = 0;
|
||||
if ($this->_list)
|
||||
foreach ($this->_list AS $tr)
|
||||
|
||||
@@ -52,8 +52,6 @@ class AdminStates extends AdminTab
|
||||
/* Delete object */
|
||||
if (isset($_GET['delete'.$this->table]))
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
// set token
|
||||
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
||||
|
||||
@@ -100,7 +98,7 @@ class AdminStates extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -123,7 +121,7 @@ class AdminStates extends AdminTab
|
||||
<label>'.$this->l('Country:').' </label>
|
||||
<div class="margin-form">
|
||||
<select name="id_country">';
|
||||
$countries = Country::getCountries((int)($cookie->id_lang), false, true);
|
||||
$countries = Country::getCountries($context->language->id, false, true);
|
||||
foreach ($countries AS $country)
|
||||
echo '<option value="'.(int)($country['id_country']).'"'.(($this->getFieldValue($obj, 'id_country') == $country['id_country']) ? ' selected="selected"' : '').'>'.$country['name'].'</option>';
|
||||
echo '
|
||||
|
||||
@@ -52,8 +52,6 @@ class AdminStatsConf extends AdminPreferences
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$graphEngine = Configuration::get('PS_STATS_RENDER');
|
||||
$gridEngine = Configuration::get('PS_STATS_GRID_RENDER');
|
||||
$autoclean = Configuration::get('PS_STATS_OLD_CONNECT_AUTO_CLEAN');
|
||||
|
||||
@@ -40,8 +40,7 @@ abstract class AdminStatsTab extends AdminPreferences
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (Tools::isSubmit('submitDatePicker'))
|
||||
{
|
||||
if (!Validate::isDate($from = Tools::getValue('datepickerFrom')) OR !Validate::isDate($to = Tools::getValue('datepickerTo')))
|
||||
@@ -82,17 +81,16 @@ abstract class AdminStatsTab extends AdminPreferences
|
||||
}
|
||||
if (isset($from) AND isset($to) AND !sizeof($this->_errors))
|
||||
{
|
||||
$employee = new Employee($cookie->id_employee);
|
||||
$employee->stats_date_from = $from;
|
||||
$employee->stats_date_to = $to;
|
||||
$employee->update();
|
||||
$context->employee->stats_date_from = $from;
|
||||
$context->employee->stats_date_to = $to;
|
||||
$context->employee->update();
|
||||
Tools::redirectAdmin($_SERVER['REQUEST_URI']);
|
||||
}
|
||||
if (Tools::getValue('submitSettings'))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
$currentIndex .= '&module='.Tools::getValue('module');
|
||||
self::$currentIndex .= '&module='.Tools::getValue('module');
|
||||
$this->_postConfig($this->_fieldsSettings);
|
||||
}
|
||||
else
|
||||
@@ -104,8 +102,6 @@ abstract class AdminStatsTab extends AdminPreferences
|
||||
|
||||
protected function displayEngines()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$graphEngine = Configuration::get('PS_STATS_RENDER');
|
||||
$gridEngine = Configuration::get('PS_STATS_GRID_RENDER');
|
||||
$arrayGraphEngines = ModuleGraphEngine::getGraphEngines();
|
||||
@@ -141,10 +137,10 @@ abstract class AdminStatsTab extends AdminPreferences
|
||||
|
||||
protected function getDate()
|
||||
{
|
||||
global $cookie;
|
||||
$year = isset($cookie->stats_year) ? $cookie->stats_year : date('Y');
|
||||
$month = isset($cookie->stats_month) ? sprintf('%02d', $cookie->stats_month) : '%';
|
||||
$day = isset($cookie->stats_day) ? sprintf('%02d', $cookie->stats_day) : '%';
|
||||
$context = Context::getContext();
|
||||
$year = isset($context->cookie->stats_year) ? $context->cookie->stats_year : date('Y');
|
||||
$month = isset($context->cookie->stats_month) ? sprintf('%02d', $context->cookie->stats_month) : '%';
|
||||
$day = isset($context->cookie->stats_day) ? sprintf('%02d', $context->cookie->stats_day) : '%';
|
||||
return $year.'-'.$month.'-'.$day;
|
||||
}
|
||||
|
||||
@@ -161,9 +157,7 @@ abstract class AdminStatsTab extends AdminPreferences
|
||||
|
||||
public static function displayCalendarStatic($translations)
|
||||
{
|
||||
global $cookie;
|
||||
$employee = new Employee($cookie->id_employee);
|
||||
|
||||
$context = Context::getContext();
|
||||
includeDatepicker(array('datepickerFrom', 'datepickerTo'));
|
||||
return '
|
||||
<fieldset style="width: 200px; font-size:13px;"><legend><img src="../img/admin/date.png" /> '.$translations['Calendar'].'</legend>
|
||||
@@ -175,8 +169,8 @@ abstract class AdminStatsTab extends AdminPreferences
|
||||
<input type="submit" name="submitDateDayPrev" class="button" value="'.$translations['Day'].'-1" style="margin-top:2px">
|
||||
<input type="submit" name="submitDateMonthPrev" class="button" value="'.$translations['Month'].'-1" style="margin-top:2px">
|
||||
<input type="submit" name="submitDateYearPrev" class="button" value="'.$translations['Year'].'-1" style="margin-top:2px">
|
||||
<p>'.(isset($translations['From']) ? $translations['From'] : 'From:').' <input type="text" name="datepickerFrom" id="datepickerFrom" value="'.Tools::getValue('datepickerFrom', $employee->stats_date_from).'"></p>
|
||||
<p>'.(isset($translations['To']) ? $translations['To'] : 'To:').' <input type="text" name="datepickerTo" id="datepickerTo" value="'.Tools::getValue('datepickerTo', $employee->stats_date_to).'"></p>
|
||||
<p>'.(isset($translations['From']) ? $translations['From'] : 'From:').' <input type="text" name="datepickerFrom" id="datepickerFrom" value="'.Tools::getValue('datepickerFrom', $context->employee->stats_date_from).'"></p>
|
||||
<p>'.(isset($translations['To']) ? $translations['To'] : 'To:').' <input type="text" name="datepickerTo" id="datepickerTo" value="'.Tools::getValue('datepickerTo', $context->employee->stats_date_to).'"></p>
|
||||
<input type="submit" name="submitDatePicker" class="button" value="'.(isset($translations['Save']) ? $translations['Save'] : ' Save ').'" />
|
||||
</form>
|
||||
</div>
|
||||
@@ -207,7 +201,6 @@ abstract class AdminStatsTab extends AdminPreferences
|
||||
|
||||
public function displayMenu()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$modules = $this->getModules();
|
||||
|
||||
echo '<fieldset style="width: 200px"><legend><img src="../img/admin/navigation.png" /> '.$this->l('Navigation', 'AdminStatsTab').'</legend>';
|
||||
|
||||
@@ -67,8 +67,6 @@ class AdminStatuses extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (!Tools::isSubmit('updateorder_return_state') AND !Tools::isSubmit('submitAddorder_return_state'))
|
||||
{
|
||||
echo '<h2>'.$this->l('Order statuses').'</h2>';
|
||||
|
||||
@@ -34,8 +34,7 @@ class AdminStores extends AdminTab
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$this->table = 'store';
|
||||
$this->className = 'Store';
|
||||
$this->lang = false;
|
||||
@@ -46,10 +45,10 @@ class AdminStores extends AdminTab
|
||||
|
||||
$this->_select = 'cl.`name` country, st.`name` state';
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)($cookie->id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'state` st ON (st.`id_state` = a.`id_state`)';
|
||||
|
||||
$countries = Country::getCountries((int)($cookie->id_lang));
|
||||
$countries = Country::getCountries($context->language->id);
|
||||
foreach ($countries AS $country)
|
||||
$this->countriesArray[$country['id_country']] = $country['name'];
|
||||
|
||||
@@ -146,7 +145,7 @@ class AdminStores extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -260,7 +259,7 @@ class AdminStores extends AdminTab
|
||||
<input type="file" name="image" />
|
||||
<p class="clear">'.$this->l('Store window picture').'</p>';
|
||||
|
||||
echo $this->displayImage($obj->id, _PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminStores'.(int)(Tab::getIdFromClassName('AdminStores')).(int)($cookie->id_employee)), true);
|
||||
echo $this->displayImage($obj->id, _PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminStores'.(int)(Tab::getIdFromClassName('AdminStores')).(int)$context->employee->id), true);
|
||||
|
||||
echo '</div>
|
||||
<table cellpadding="2" cellspacing="2" style="padding: 10px; margin-top: 15px; border: 1px solid #BBB;">
|
||||
|
||||
@@ -49,7 +49,6 @@ class AdminSubDomains extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -55,23 +55,23 @@ class AdminSuppliers extends AdminTab
|
||||
|
||||
public function viewsupplier()
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
if (!($supplier = $this->loadObject()))
|
||||
return;
|
||||
echo '<h2>'.$supplier->name.'</h2>';
|
||||
|
||||
$products = $supplier->getProductsLite((int)($cookie->id_lang));
|
||||
$products = $supplier->getProductsLite($context->language->id);
|
||||
echo '<h3>'.$this->l('Total products:').' '.sizeof($products).'</h3>';
|
||||
foreach ($products AS $product)
|
||||
{
|
||||
$product = new Product($product['id_product'], false, (int)($cookie->id_lang));
|
||||
$product = new Product($product['id_product'], false, $context->language->id);
|
||||
echo '<hr />';
|
||||
if (!$product->hasAttributes())
|
||||
{
|
||||
echo '
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table width3">
|
||||
<tr>
|
||||
<th><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" target="_blank">'.$product->name.'</a></th>
|
||||
<th><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" target="_blank">'.$product->name.'</a></th>
|
||||
'.(!empty($product->reference) ? '<th width="150">'.$this->l('Ref:').' '.$product->reference.'</th>' : '').'
|
||||
'.(!empty($product->ean13) ? '<th width="120">'.$this->l('EAN13:').' '.$product->ean13.'</th>' : '').'
|
||||
'.(!empty($product->upc) ? '<th width="120">'.$this->l('UPC:').' '.$product->upc.'</th>' : '').'
|
||||
@@ -82,7 +82,7 @@ class AdminSuppliers extends AdminTab
|
||||
else
|
||||
{
|
||||
echo '
|
||||
<h3><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" target="_blank">'.$product->name.'</a></h3>
|
||||
<h3><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" target="_blank">'.$product->name.'</a></h3>
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
|
||||
<tr>
|
||||
<th>'.$this->l('Attribute name').'</th>
|
||||
@@ -92,7 +92,7 @@ class AdminSuppliers extends AdminTab
|
||||
'.(Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="40">'.$this->l('Quantity').'</th>' : '').'
|
||||
</tr>';
|
||||
/* Build attributes combinaisons */
|
||||
$combinaisons = $product->getAttributeCombinaisons((int)($cookie->id_lang));
|
||||
$combinaisons = $product->getAttributeCombinaisons($context->language->id);
|
||||
foreach ($combinaisons AS $k => $combinaison)
|
||||
{
|
||||
$combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
|
||||
@@ -125,7 +125,6 @@ class AdminSuppliers extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($supplier = $this->loadObject(true)))
|
||||
|
||||
@@ -29,20 +29,19 @@ class AdminTabs extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$this->table = 'tab';
|
||||
$this->className = 'Tab';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->_select = '(SELECT stl.`name` FROM `'._DB_PREFIX_.'tab_lang` stl WHERE stl.`id_tab` = a.`id_parent` AND stl.`id_lang` = '.(int)($cookie->id_lang).' LIMIT 1) AS parent';
|
||||
$this->_select = '(SELECT stl.`name` FROM `'._DB_PREFIX_.'tab_lang` stl WHERE stl.`id_tab` = a.`id_parent` AND stl.`id_lang` = '.(int)$context->language->id.' LIMIT 1) AS parent';
|
||||
|
||||
$this->fieldImageSettings = array('name' => 'icon', 'dir' => 't');
|
||||
$this->imageType = 'gif';
|
||||
|
||||
$tabs = array(0 => $this->l('Home'));
|
||||
foreach (Tab::getTabs((int)$cookie->id_lang, 0) AS $tab)
|
||||
foreach (Tab::getTabs($context->language->id, 0) AS $tab)
|
||||
$tabs[$tab['id_tab']] = $tab['name'];
|
||||
$this->fieldsDisplay = array(
|
||||
'id_tab' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
@@ -58,7 +57,6 @@ class AdminTabs extends AdminTab
|
||||
{
|
||||
if (($id_tab = (int)(Tools::getValue('id_tab'))) AND ($direction = Tools::getValue('move')) AND Validate::isLoadedObject($tab = new Tab($id_tab)))
|
||||
{
|
||||
global $currentIndex;
|
||||
if ($tab->move($direction))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
}
|
||||
@@ -72,8 +70,6 @@ class AdminTabs extends AdminTab
|
||||
|
||||
private function _posTabs($name, $arrayTabs)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (sizeof($arrayTabs) > 1)
|
||||
{
|
||||
echo '
|
||||
@@ -96,22 +92,21 @@ class AdminTabs extends AdminTab
|
||||
|
||||
public function displayList()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$context = Context::getContext();
|
||||
parent::displayList();
|
||||
|
||||
$tabs = Tab::getTabs((int)$cookie->id_lang, 0);
|
||||
$tabs = Tab::getTabs($context->language->id, 0);
|
||||
echo '<br /><h2>'.$this->l('Positions').'</h2>
|
||||
<h3>'.$this->l('Level').' 1</h3>';
|
||||
$this->_posTabs($this->l('Main'), $tabs);
|
||||
echo '<h3>'.$this->l('Level').' 2</h3>';
|
||||
foreach ($tabs AS $t)
|
||||
$this->_posTabs(stripslashes($t['name']), Tab::getTabs((int)$cookie->id_lang, $t['id_tab']));
|
||||
$this->_posTabs(stripslashes($t['name']), Tab::getTabs($context->language->id, $t['id_tab']));
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -156,7 +151,7 @@ class AdminTabs extends AdminTab
|
||||
<select name="id_parent">
|
||||
<option value="-1" '.(($this->getFieldValue($obj, 'id_parent') == -1) ? 'selected="selected"' : '').'>'.$this->l('None').'</option>
|
||||
<option value="0" '.(($this->getFieldValue($obj, 'id_parent') == 0) ? 'selected="selected"' : '').'>'.$this->l('Home').'</option>';
|
||||
foreach (Tab::getTabs((int)$cookie->id_lang, 0) AS $tab)
|
||||
foreach (Tab::getTabs($context->language->id, 0) AS $tab)
|
||||
echo ' <option value="'.$tab['id_tab'].'" '.($tab['id_tab'] == $this->getFieldValue($obj, 'id_parent') ? 'selected="selected"' : '').'>'.$tab['name'].'</option>';
|
||||
echo ' </select>
|
||||
</div>
|
||||
|
||||
@@ -29,8 +29,6 @@ class AdminTags extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'tag';
|
||||
$this->className = 'Tag';
|
||||
$this->edit = true;
|
||||
@@ -61,7 +59,6 @@ class AdminTags extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -30,7 +30,6 @@ class AdminTaxRulesGroup extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
$this->table = 'tax_rules_group';
|
||||
$this->className = 'TaxRulesGroup';
|
||||
$this->edit = true;
|
||||
@@ -70,7 +69,7 @@ class AdminTaxRulesGroup extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
@@ -182,7 +181,7 @@ class AdminTaxRulesGroup extends AdminTab
|
||||
<script type="text/javascript">
|
||||
var tabPane1 = new WebFXTabPane( document.getElementById( "tab-pane-1" ) );
|
||||
</script>
|
||||
<link type="text/css" rel="stylesheet" href="../css/tabpane.css" />'.$this->renderZones($tax_rules, (int)$cookie->id_lang);
|
||||
<link type="text/css" rel="stylesheet" href="../css/tabpane.css" />'.$this->renderZones($tax_rules, $context->language->id);
|
||||
echo '
|
||||
<div class="margin-form" style="margin-top: 10px">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
@@ -383,12 +382,11 @@ class AdminTaxRulesGroup extends AdminTab
|
||||
|
||||
protected function afterUpdate($object)
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
TaxRule::deleteByGroupId($object->id);
|
||||
|
||||
|
||||
foreach(Country::getCountries($cookie->id_lang, true) AS $country)
|
||||
foreach(Country::getCountries($context->language->id, true) AS $country)
|
||||
{
|
||||
$id_tax = (int)Tools::getValue('tax_'.$country['id_country'].'_0');
|
||||
|
||||
@@ -456,9 +454,9 @@ class AdminTaxRulesGroup extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
|
||||
global $currentIndex, $cookie;
|
||||
if (!isset($this->table))
|
||||
$context = Context::getContext();
|
||||
|
||||
if (!isset($this->table))
|
||||
return false;
|
||||
|
||||
// set token
|
||||
@@ -523,7 +521,7 @@ class AdminTaxRulesGroup extends AdminTab
|
||||
// Default behavior (save and back)
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
if ($id_product)
|
||||
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
|
||||
|
||||
Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token);
|
||||
}
|
||||
@@ -555,7 +553,7 @@ class AdminTaxRulesGroup extends AdminTab
|
||||
$this->updateAssoGroupShop($object->id);
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
if ($id_product)
|
||||
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id));
|
||||
|
||||
Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token);
|
||||
// Default behavior (save and back)
|
||||
|
||||
@@ -29,7 +29,6 @@ class AdminTaxes extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
$this->table = 'tax';
|
||||
$this->className = 'Tax';
|
||||
$this->lang = true;
|
||||
@@ -59,13 +58,13 @@ class AdminTaxes extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
$zones = Zone::getZones(true);
|
||||
$states = State::getStates((int)$cookie->id_lang);
|
||||
$states = State::getStates($context->language->id);
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
|
||||
@@ -104,8 +103,6 @@ class AdminTaxes extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if(Tools::getValue('submitAdd'.$this->table))
|
||||
{
|
||||
/* Checking fields validity */
|
||||
@@ -164,8 +161,6 @@ class AdminTaxes extends AdminTab
|
||||
|
||||
protected function _displayDeleteLink($token = NULL, $id)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$_cacheLang['Delete'] = $this->l('Delete', __CLASS__, TRUE, FALSE);
|
||||
|
||||
$_cacheLang['DeleteItem'] = $this->l('Delete item #', __CLASS__, TRUE, FALSE).$id.' ?)';
|
||||
@@ -179,8 +174,6 @@ class AdminTaxes extends AdminTab
|
||||
|
||||
protected function _displayEnableLink($token, $id, $value, $active, $id_category = NULL, $id_product = NULL)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$confirm = ($value AND TaxRule::isTaxInUse($id)) ? 'onclick="return confirm(\''. $this->l('This tax is currently in use in a tax rule. If you continue this tax will be removed from the tax rule, are you sure?').'\')"' : '';
|
||||
|
||||
echo '<a href="'.self::$currentIndex.'&'.$this->identifier.'='.$id.'&'.$active.
|
||||
|
||||
@@ -112,8 +112,6 @@ class AdminThemes extends AdminPreferences
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (file_exists(_PS_IMG_DIR_.'logo.jpg'))
|
||||
{
|
||||
list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_.'logo.jpg');
|
||||
@@ -161,7 +159,6 @@ class AdminThemes extends AdminPreferences
|
||||
*/
|
||||
private function _isThemeCompatible($theme_dir)
|
||||
{
|
||||
global $cookie;
|
||||
$all_errors='';
|
||||
$return=true;
|
||||
$check_version=AdminThemes::$check_features_version;
|
||||
|
||||
@@ -37,8 +37,6 @@ class AdminTracking extends AdminTab
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
echo '<h2 class="space">'.$this->l('Catalog tracking').'</h2>';
|
||||
$this->getObjects('categories_empty');
|
||||
$this->displayCategories();
|
||||
@@ -52,8 +50,7 @@ class AdminTracking extends AdminTab
|
||||
|
||||
public function getObjects($type)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
switch ($type)
|
||||
{
|
||||
case 'categories_empty':
|
||||
@@ -99,10 +96,10 @@ class AdminTracking extends AdminTab
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)($cookie->id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)($cookie->id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = pa.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)($cookie->id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer` = m.`id_manufacturer`)
|
||||
WHERE pa.quantity <= 0
|
||||
ORDER BY pa.`id_product_attribute`
|
||||
@@ -115,8 +112,6 @@ class AdminTracking extends AdminTab
|
||||
|
||||
public function displayCategories()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (isset($this->_list['obj']))
|
||||
{
|
||||
$nbCategories = sizeof($this->_list['obj']);
|
||||
@@ -135,8 +130,7 @@ class AdminTracking extends AdminTab
|
||||
|
||||
public function displayProducts()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
if (isset($this->_list['obj']))
|
||||
{
|
||||
$nbProducts = sizeof($this->_list['obj']);
|
||||
@@ -166,7 +160,7 @@ class AdminTracking extends AdminTab
|
||||
foreach ($this->_list['obj'] AS $k => $prod)
|
||||
{
|
||||
$product = new Product((int)($prod['id_product']));
|
||||
$product->name = $product->name[(int)($cookie->id_lang)];
|
||||
$product->name = $product->name[(int)$context->language->id];
|
||||
$taxrate = Tax::getProductTaxRate($product->id);
|
||||
|
||||
echo '
|
||||
@@ -174,16 +168,16 @@ class AdminTracking extends AdminTab
|
||||
<td>'.$product->id.'</td>
|
||||
<td align="center">'.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').'</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)($cookie->id_employee)).'">'.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>'.(float)$taxrate.'% </td>
|
||||
<td align="center">'.$product->quantity.'</td>
|
||||
<td align="center">'.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
|
||||
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'"><img src="../img/admin/'.($product->active ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
|
||||
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'"><img src="../img/admin/'.($product->active ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
|
||||
<td>
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
|
||||
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.str_replace('"', ' ', $product->name)).' ?\');">
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$product->id.'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.str_replace('"', ' ', $product->name)).' ?\');">
|
||||
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
@@ -194,7 +188,7 @@ class AdminTracking extends AdminTab
|
||||
|
||||
public function displayAttributes()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
if (isset($this->_list['obj']))
|
||||
{
|
||||
@@ -246,16 +240,16 @@ class AdminTracking extends AdminTab
|
||||
<td>'.$prod['id_product'].'</td>
|
||||
<td align="center">'.($prod['manufacturer_name'] != NULL ? stripslashes($prod['manufacturer_name']) : '--').'</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)($cookie->id_employee)).'">'.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>'.(float)$taxrate.'% </td>
|
||||
<td align="center">'.$prod['quantity'].'</td>
|
||||
<td align="center">'.($prod['weight'] + $prod['product_weight']).' '.Configuration::get('PS_WEIGHT_UNIT').'</td>
|
||||
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'"><img src="../img/admin/'.($prod['active'] ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
|
||||
<td align="center"><a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&status&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'"><img src="../img/admin/'.($prod['active'] ? 'enabled.gif' : 'disabled.gif').'" alt="" /></a></td>
|
||||
<td>
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'">
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&addproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'">
|
||||
<img src="../img/admin/edit.gif" alt="'.$this->l('Modify this product').'" /></a>
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.$prod['name']).' ?\');">
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$prod['id_product'].'&deleteproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id).'" onclick="return confirm(\''.addslashes($this->l('Do you want to delete').' '.$prod['name']).' ?\');">
|
||||
<img src="../img/admin/delete.gif" alt="'.$this->l('Delete this product').'" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
@@ -110,8 +110,6 @@ class AdminTranslations extends AdminTab
|
||||
|
||||
protected function writeTranslationFile($type, $path, $mark = false, $fullmark = false)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if ($fd = fopen($path, 'w'))
|
||||
{
|
||||
unset($_POST['submitTranslations'.$type], $_POST['lang']);
|
||||
@@ -135,8 +133,6 @@ class AdminTranslations extends AdminTab
|
||||
|
||||
public function submitCopyLang()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (!($fromLang = strval(Tools::getValue('fromLang'))) OR !($toLang = strval(Tools::getValue('toLang'))))
|
||||
$this->_errors[] = $this->l('you must select 2 languages in order to copy data from one to another');
|
||||
elseif (!($fromTheme = strval(Tools::getValue('fromTheme'))) OR !($toTheme = strval(Tools::getValue('toTheme'))))
|
||||
@@ -191,8 +187,6 @@ class AdminTranslations extends AdminTab
|
||||
}
|
||||
public function submitExportLang()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$lang = strtolower(Tools::getValue('iso_code'));
|
||||
$theme = strval(Tools::getValue('theme'));
|
||||
if ($lang AND $theme)
|
||||
@@ -229,8 +223,6 @@ class AdminTranslations extends AdminTab
|
||||
}
|
||||
public function submitImportLang()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (!isset($_FILES['file']['tmp_name']) OR !$_FILES['file']['tmp_name'])
|
||||
$this->_errors[] = Tools::displayError('No file selected');
|
||||
else
|
||||
@@ -254,8 +246,6 @@ class AdminTranslations extends AdminTab
|
||||
|
||||
public function submitAddLang()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$arr_import_lang = explode('|', Tools::getValue('params_import_language')); /* 0 = Language ISO code, 1 = PS version */
|
||||
if (Validate::isLangIsoCode($arr_import_lang[0]))
|
||||
{
|
||||
@@ -428,8 +418,6 @@ class AdminTranslations extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if (Tools::isSubmit('submitCopyLang'))
|
||||
{
|
||||
if ($this->tabAccess['add'] === '1')
|
||||
@@ -582,7 +570,6 @@ class AdminTranslations extends AdminTab
|
||||
*/
|
||||
protected function submitTranslationsMails ($id_lang)
|
||||
{
|
||||
global $currentIndex;
|
||||
$obj_lang = new Language($id_lang);
|
||||
$params_redirect = (Tools::isSubmit('submitTranslationsMailsAndStay') ? '&lang='.Tools::getValue('lang').'&type='.Tools::getValue('type') : '');
|
||||
|
||||
@@ -684,8 +671,7 @@ class AdminTranslations extends AdminTab
|
||||
}
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$translations = array(
|
||||
'front' => $this->l('Front Office translations'),
|
||||
'back' => $this->l('Back Office translations'),
|
||||
@@ -794,7 +780,7 @@ class AdminTranslations extends AdminTab
|
||||
<fieldset class="width3"><legend><img src="../img/admin/copy_files.gif" />'.$this->l('Copy').'</legend>
|
||||
<p>'.$this->l('Copies data from one language to another.').'<br />'.
|
||||
$this->l('Be careful, as it will replace all existing data for the destination language!').'<br />'.
|
||||
$this->l('If necessary').', <b><a href="index.php?tab=AdminLanguages&addlang&token='.Tools::getAdminToken('AdminLanguages'.(int)(Tab::getIdFromClassName('AdminLanguages')).(int)($cookie->id_employee)).'">'.$this->l('first create a new language').'</a></b>.</p>
|
||||
$this->l('If necessary').', <b><a href="index.php?tab=AdminLanguages&addlang&token='.Tools::getAdminToken('AdminLanguages'.(int)(Tab::getIdFromClassName('AdminLanguages')).(int)$context->employee->id).'">'.$this->l('first create a new language').'</a></b>.</p>
|
||||
<div style="float:left;">
|
||||
<p>
|
||||
<div style="width:75px; font-weight:bold; float:left;">'.$this->l('From:').'</div>
|
||||
@@ -951,7 +937,6 @@ class AdminTranslations extends AdminTab
|
||||
|
||||
public function displayFormFront($lang)
|
||||
{
|
||||
global $currentIndex;
|
||||
$_LANG = $this->fileExists(_PS_THEME_DIR_.'lang', Tools::strtolower($lang).'.php', '_LANG');
|
||||
$str_output = '';
|
||||
|
||||
@@ -1034,7 +1019,6 @@ class AdminTranslations extends AdminTab
|
||||
|
||||
public function displayFormBack($lang)
|
||||
{
|
||||
global $currentIndex;
|
||||
$_LANGADM = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'admin.php', '_LANGADM');
|
||||
$str_output = '';
|
||||
/* List templates to parse */
|
||||
@@ -1108,7 +1092,6 @@ class AdminTranslations extends AdminTab
|
||||
|
||||
public function displayFormErrors($lang)
|
||||
{
|
||||
global $currentIndex;
|
||||
$_ERRORS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'errors.php', '_ERRORS');
|
||||
|
||||
$str_output = '';
|
||||
@@ -1167,7 +1150,6 @@ class AdminTranslations extends AdminTab
|
||||
|
||||
public function displayFormFields($lang)
|
||||
{
|
||||
global $currentIndex;
|
||||
$_FIELDS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'fields.php', '_FIELDS');
|
||||
|
||||
$str_output = '';
|
||||
@@ -1487,8 +1469,6 @@ class AdminTranslations extends AdminTab
|
||||
}
|
||||
public function displayFormMails($lang, $noDisplay = false)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$core_mails = array();
|
||||
$module_mails = array();
|
||||
$theme_mails = array();
|
||||
@@ -1662,8 +1642,6 @@ class AdminTranslations extends AdminTab
|
||||
|
||||
protected function writeSubjectTranslationFile($sub, $path, $mark = false, $fullmark = false)
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
if ($fd = @fopen($path, 'w'))
|
||||
{
|
||||
//$tab = ($fullmark ? Tools::strtoupper($fullmark) : 'LANG').($mark ? Tools::strtoupper($mark) : '');
|
||||
@@ -1746,7 +1724,7 @@ class AdminTranslations extends AdminTab
|
||||
}
|
||||
public function displayFormModules($lang)
|
||||
{
|
||||
global $currentIndex, $_MODULES;
|
||||
global $_MODULES;
|
||||
|
||||
$array_lang_src = Language::getLanguages(false);
|
||||
$str_output = '';
|
||||
@@ -1837,8 +1815,6 @@ class AdminTranslations extends AdminTab
|
||||
|
||||
public function displayFormPDF()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$lang = Tools::strtolower(Tools::getValue('lang'));
|
||||
$_LANG = array();
|
||||
$str_output = '';
|
||||
|
||||
@@ -97,7 +97,6 @@ class AdminWebservice extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
@@ -227,8 +226,7 @@ echo '
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
// Include other tab in current tab
|
||||
if ($this->includeSubTab('display', array('submitAdd2', 'add', 'update', 'view'))){}
|
||||
|
||||
@@ -246,7 +244,7 @@ echo '
|
||||
}
|
||||
elseif (isset($_GET['update'.$this->table]))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $cookie->id_employee == Tools::getValue('id_employee')))
|
||||
if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $context->employee->id == Tools::getValue('id_employee')))
|
||||
{
|
||||
$this->displayForm();
|
||||
if ($this->tabAccess['view'])
|
||||
@@ -262,7 +260,7 @@ echo '
|
||||
{
|
||||
$this->checkForWarning();
|
||||
|
||||
$this->getList((int)$cookie->id_lang);
|
||||
$this->getList($context->language->id);
|
||||
$this->displayList();
|
||||
|
||||
$this->displayRequiredFields();
|
||||
|
||||
@@ -48,7 +48,6 @@ class AdminZones extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -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 .= '
|
||||
|
||||
@@ -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