// Context part 29

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7935 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-08-08 13:17:12 +00:00
parent 89cc9649cf
commit 653ef8d115
40 changed files with 195 additions and 360 deletions
+1 -2
View File
@@ -900,7 +900,6 @@ class AdminImport extends AdminTab
public function attributeImport() public function attributeImport()
{ {
global $cookie;
$defaultLanguage = Configuration::get('PS_LANG_DEFAULT'); $defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
$groups = array(); $groups = array();
foreach (AttributeGroup::getAttributesGroups($defaultLanguage) AS $group) foreach (AttributeGroup::getAttributesGroups($defaultLanguage) AS $group)
@@ -927,7 +926,7 @@ class AdminImport extends AdminTab
if (isset($info['image_url']) && $info['image_url']) if (isset($info['image_url']) && $info['image_url'])
{ {
$productHasImages = (bool)Image::getImages((int)($cookie->id_lang), (int)($product->id)); $productHasImages = (bool)Image::getImages($this->context->language->id, $product->id);
$url = $info['image_url']; $url = $info['image_url'];
$image = new Image(); $image = new Image();
$image->id_product = (int)($product->id); $image->id_product = (int)($product->id);
+1 -4
View File
@@ -1028,10 +1028,7 @@ class CategoryCore extends ObjectModel
public static function getCategoryInformations($ids_category, $id_lang = null) public static function getCategoryInformations($ids_category, $id_lang = null)
{ {
if ($id_lang === null) if ($id_lang === null)
{ $id_lang = Context::getContext()->language->id;
global $cookie;
$id_lang = $cookie->id_lang;
}
if (!is_array($ids_category) || !sizeof($ids_category)) if (!is_array($ids_category) || !sizeof($ids_category))
return; return;
+1 -3
View File
@@ -477,8 +477,6 @@ abstract class ModuleCore
*/ */
public static function getModuleNameFromClass($currentClass) public static function getModuleNameFromClass($currentClass)
{ {
global $cookie;
// Module can now define AdminTab keeping the module translations method, // Module can now define AdminTab keeping the module translations method,
// i.e. in modules/[module name]/[iso_code].php // i.e. in modules/[module name]/[iso_code].php
if (!isset(self::$classInModule[$currentClass])) if (!isset(self::$classInModule[$currentClass]))
@@ -918,7 +916,7 @@ abstract class ModuleCore
global $_MODULES, $_MODULE; global $_MODULES, $_MODULE;
if ($id_lang == null) if ($id_lang == null)
$id_lang = (!isset($cookie) OR !is_object($cookie)) ? (int)(Configuration::get('PS_LANG_DEFAULT')) : (int)($cookie->id_lang); $id_lang = Context::getContext()->language->id;
$file = _PS_MODULE_DIR_.$this->name.'/'.Context::getContext()->language->iso_code.'.php'; $file = _PS_MODULE_DIR_.$this->name.'/'.Context::getContext()->language->iso_code.'.php';
if (Tools::file_exists_cache($file) AND include_once($file)) if (Tools::file_exists_cache($file) AND include_once($file))
+1 -2
View File
@@ -90,7 +90,6 @@ class ToolsCore
*/ */
public static function redirectLink($url) public static function redirectLink($url)
{ {
$context = Context::getContext();
if (!preg_match('@^https?://@i', $url)) if (!preg_match('@^https?://@i', $url))
{ {
if (strpos($url, __PS_BASE_URI__) !== FALSE && strpos($url, __PS_BASE_URI__) == 0) if (strpos($url, __PS_BASE_URI__) !== FALSE && strpos($url, __PS_BASE_URI__) == 0)
@@ -98,7 +97,7 @@ class ToolsCore
if (strpos($url, 'index.php?controller=') !== FALSE && strpos($url, 'index.php/') == 0) if (strpos($url, 'index.php?controller=') !== FALSE && strpos($url, 'index.php/') == 0)
$url = substr($url, strlen('index.php?controller=')); $url = substr($url, strlen('index.php?controller='));
$explode = explode('?', $url); $explode = explode('?', $url);
$url = $context->link->getPageLink($explode[0]); $url = Context::getContext()->link->getPageLink($explode[0]);
if (isset($explode[1])) if (isset($explode[1]))
$url .= '?'.$explode[1]; $url .= '?'.$explode[1];
} }
+6 -13
View File
@@ -388,7 +388,6 @@ class CanadaPost extends CarrierModule
private function _displayFormGeneral() private function _displayFormGeneral()
{ {
global $cookie;
$configCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); $configCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
$html = '<script> $html = '<script>
@@ -464,7 +463,7 @@ class CanadaPost extends CarrierModule
<select name="cp_carrier_country" id="cp_carrier_country"> <select name="cp_carrier_country" id="cp_carrier_country">
<option value="0">'.$this->l('Select a country ...').'</option>'; <option value="0">'.$this->l('Select a country ...').'</option>';
$idcountries = array(); $idcountries = array();
foreach (Country::getCountries($cookie->id_lang) as $v) foreach (Country::getCountries($this->context->language->id) as $v)
{ {
$html .= '<option value="'.$v['id_country'].'" '.($v['id_country'] == (int)(Tools::getValue('cp_carrier_country', Configuration::get('CP_CARRIER_COUNTRY'))) ? 'selected="selected"' : '').'>'.$v['name'].'</option>'; $html .= '<option value="'.$v['id_country'].'" '.($v['id_country'] == (int)(Tools::getValue('cp_carrier_country', Configuration::get('CP_CARRIER_COUNTRY'))) ? 'selected="selected"' : '').'>'.$v['name'].'</option>';
$idcountries[] = $v['id_country']; $idcountries[] = $v['id_country'];
@@ -619,8 +618,6 @@ class CanadaPost extends CarrierModule
private function _getPathInTab($id_category) private function _getPathInTab($id_category)
{ {
global $cookie;
$category = Db::getInstance()->getRow(' $category = Db::getInstance()->getRow('
SELECT id_category, level_depth, nleft, nright SELECT id_category, level_depth, nleft, nright
FROM '._DB_PREFIX_.'category FROM '._DB_PREFIX_.'category
@@ -632,7 +629,7 @@ class CanadaPost extends CarrierModule
SELECT c.id_category, cl.name, cl.link_rewrite SELECT c.id_category, cl.name, cl.link_rewrite
FROM '._DB_PREFIX_.'category c FROM '._DB_PREFIX_.'category c
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category) LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category)
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)($cookie->id_lang).' WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)$this->context->language->id.'
ORDER BY c.level_depth ASC ORDER BY c.level_depth ASC
LIMIT '.(int)($category['level_depth'] + 1)); LIMIT '.(int)($category['level_depth'] + 1));
@@ -677,8 +674,6 @@ class CanadaPost extends CarrierModule
private function _displayFormCategory() private function _displayFormCategory()
{ {
global $cookie;
// Check if the module is configured // Check if the module is configured
if (!$this->_webserviceTestResult) if (!$this->_webserviceTestResult)
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />'; return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
@@ -794,7 +789,7 @@ class CanadaPost extends CarrierModule
<div class="margin-form"> <div class="margin-form">
<select name="id_category"> <select name="id_category">
<option value="0">'.$this->l('Select a category ...').'</option> <option value="0">'.$this->l('Select a category ...').'</option>
'.$this->_getChildCategories(Category::getCategories($cookie->id_lang), 0).' '.$this->_getChildCategories(Category::getCategories($this->context->language->id), 0).'
</select> </select>
</div> </div>
<label>'.$this->l('Additional charges').' : </label> <label>'.$this->l('Additional charges').' : </label>
@@ -916,8 +911,6 @@ class CanadaPost extends CarrierModule
private function _displayFormProduct() private function _displayFormProduct()
{ {
global $cookie;
// Check if the module is configured // Check if the module is configured
if (!$this->_webserviceTestResult) if (!$this->_webserviceTestResult)
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />'; return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
@@ -943,7 +936,7 @@ class CanadaPost extends CarrierModule
foreach ($configProductList as $k => $c) foreach ($configProductList as $k => $c)
{ {
// Loading Product // Loading Product
$product = new Product((int)$c['id_product'], false, (int)$cookie->id_lang); $product = new Product((int)$c['id_product'], false, (int)$this->context->language->id);
// Loading config currency // Loading config currency
$configCurrency = new Currency($c['id_currency']); $configCurrency = new Currency($c['id_currency']);
@@ -988,7 +981,7 @@ class CanadaPost extends CarrierModule
{ {
// Loading config // Loading config
$configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_cp_rate_config` = '.(int)(Tools::getValue('id_cp_rate_config'))); $configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'cp_rate_config` WHERE `id_cp_rate_config` = '.(int)(Tools::getValue('id_cp_rate_config')));
$product = new Product((int)$configSelected['id_product'], false, (int)$cookie->id_lang); $product = new Product((int)$configSelected['id_product'], false, (int)$this->context->language->id);
$html .= '<p align="center"><b>'.$this->l('Update a rule').' (<a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=add">'.$this->l('Add a rule').' ?</a>)</b></p> $html .= '<p align="center"><b>'.$this->l('Update a rule').' (<a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=add">'.$this->l('Add a rule').' ?</a>)</b></p>
<form action="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=edit&id_cp_rate_config='.(int)(Tools::getValue('id_cp_rate_config')).'" method="post" class="form"> <form action="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=edit&id_cp_rate_config='.(int)(Tools::getValue('id_cp_rate_config')).'" method="post" class="form">
@@ -1021,7 +1014,7 @@ class CanadaPost extends CarrierModule
<option value="0">'.$this->l('Select a product ...').'</option>'; <option value="0">'.$this->l('Select a product ...').'</option>';
$productsList = Db::getInstance()->ExecuteS(' $productsList = Db::getInstance()->ExecuteS('
SELECT pl.* FROM `'._DB_PREFIX_.'product` p SELECT pl.* FROM `'._DB_PREFIX_.'product` p
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)$this->context->language->id.')
WHERE p.`active` = 1 WHERE p.`active` = 1
ORDER BY pl.`name`'); ORDER BY pl.`name`');
foreach ($productsList as $product) foreach ($productsList as $product)
+4 -6
View File
@@ -44,8 +44,6 @@ require(dirname(__FILE__).'/classes/MRGetTickets.php');
require(dirname(__FILE__).'/classes/MRGetRelayPoint.php'); require(dirname(__FILE__).'/classes/MRGetRelayPoint.php');
require(dirname(__FILE__).'/classes/MRManagement.php'); require(dirname(__FILE__).'/classes/MRManagement.php');
global $cookie, $cart, $customer;
$method = Tools::getValue('method'); $method = Tools::getValue('method');
$params = array(); $params = array();
$result = array(); $result = array();
@@ -70,13 +68,13 @@ switch($method)
break; break;
case 'MRGetRelayPoint': case 'MRGetRelayPoint':
$params['id_carrier'] = Tools::getValue('id_carrier'); $params['id_carrier'] = Tools::getValue('id_carrier');
$params['weight'] = $cart->getTotalWeight(); $params['weight'] = Context::getContext()->cart->getTotalWeight();
$params['id_address_delivery'] = $cart->id_address_delivery; $params['id_address_delivery'] = Context::getContext()->cart->id_address_delivery;
break; break;
case 'addSelectedCarrierToDB': case 'addSelectedCarrierToDB':
$params['id_carrier'] = Tools::getValue('id_carrier'); $params['id_carrier'] = Tools::getValue('id_carrier');
$params['id_cart'] = $cart->id; $params['id_cart'] = Context::getContext()->cart->id;
$params['id_customer'] = $cookie->id_customer; $params['id_customer'] = Context::getContext()->customer->id;
$params['id_mr_method'] = Tools::getValue('id_mr_method'); $params['id_mr_method'] = Tools::getValue('id_mr_method');
$params['relayPointInfo'] = Tools::getValue('relayPointInfo'); $params['relayPointInfo'] = Tools::getValue('relayPointInfo');
break; break;
@@ -404,8 +404,6 @@ class MRCreateTickets implements IMondialRelayWSMethod
*/ */
private function _updateTable($params, $expeditionNum, $ticketURL, $trackingURL, $id_mr_selected) private function _updateTable($params, $expeditionNum, $ticketURL, $trackingURL, $id_mr_selected)
{ {
global $cookie;
Db::getInstance()->Execute(' Db::getInstance()->Execute('
UPDATE `'._DB_PREFIX_.'mr_selected` UPDATE `'._DB_PREFIX_.'mr_selected`
SET `MR_poids` = \''.$params['Poids'].'\', SET `MR_poids` = \''.$params['Poids'].'\',
@@ -426,7 +424,7 @@ class MRCreateTickets implements IMondialRelayWSMethod
$history = new OrderHistory(); $history = new OrderHistory();
$history->id_order = (int)($params['NDossier']); $history->id_order = (int)($params['NDossier']);
$history->changeIdOrderState(Configuration::get('PS_OS_SHIPPING'), (int)($params['NDossier'])); $history->changeIdOrderState(Configuration::get('PS_OS_SHIPPING'), (int)($params['NDossier']));
$history->id_employee = (int)($cookie->id_employee); $history->id_employee = (int)Context::getContext()->employee->id;
$history->addWithemail(true, $templateVars); $history->addWithemail(true, $templateVars);
unset($order); unset($order);
-6
View File
@@ -551,10 +551,6 @@ class MondialRelay extends Module
*/ */
public function _getCarriers() public function _getCarriers()
{ {
global $cookie;
$id_lang = (int)$cookie->id_lang;
// Query don't use the external_module_name to keep the // Query don't use the external_module_name to keep the
// 1.3 compatibility // 1.3 compatibility
$carriers = Db::getInstance()->ExecuteS(' $carriers = Db::getInstance()->ExecuteS('
@@ -625,8 +621,6 @@ class MondialRelay extends Module
public function getContent() public function getContent()
{ {
global $cookie;
$error = null; $error = null;
$html = ''; $html = '';
@@ -112,11 +112,8 @@ class Secuvad_connection
return 'Erreur de connexion'; return 'Erreur de connexion';
} }
public function send_transaction() public function send_transaction()
{ {
global $cookie;
$flag_rep = false; $flag_rep = false;
$response = str_replace("\n", "", $this->send('bulk_transactions')); $response = str_replace("\n", "", $this->send('bulk_transactions'));
$response = str_replace("\r", "", $response); $response = str_replace("\r", "", $response);
+2 -6
View File
@@ -62,8 +62,6 @@ class Secuvad_flux
private function get_flux_xml_order() private function get_flux_xml_order()
{ {
global $cookie;
$order = new Order((int)($this->id_order)); $order = new Order((int)($this->id_order));
$address_delivery = new Address((int)($order->id_address_delivery)); $address_delivery = new Address((int)($order->id_address_delivery));
$address_invoice = new Address((int)($order->id_address_invoice)); $address_invoice = new Address((int)($order->id_address_invoice));
@@ -92,7 +90,7 @@ class Secuvad_flux
FROM `'._DB_PREFIX_.'secuvad_assoc_transport` at FROM `'._DB_PREFIX_.'secuvad_assoc_transport` at
JOIN `'._DB_PREFIX_.'secuvad_transport_delay` td ON (at.`transport_delay_id` = td.`transport_delay_id`) JOIN `'._DB_PREFIX_.'secuvad_transport_delay` td ON (at.`transport_delay_id` = td.`transport_delay_id`)
JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = td.`id_lang`) JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = td.`id_lang`)
WHERE l.`id_lang` = '.((isset($cookie->id_lang) AND (int)($cookie->id_lang)) ? (int)($cookie->id_lang) : (int)(Configuration::get('PS_LANG_DEFAULT'))).' WHERE l.`id_lang` = '.(int)Context::getContext()->language->id.'
AND at.`id_carrier` = '.(int)($order->id_carrier)); AND at.`id_carrier` = '.(int)($order->id_carrier));
$transptype = $carrier['transport_id']; $transptype = $carrier['transport_id'];
$rapidite = $carrier['transport_delay_name']; $rapidite = $carrier['transport_delay_name'];
@@ -209,8 +207,6 @@ class Secuvad_flux
private function get_flux_xml_products() private function get_flux_xml_products()
{ {
global $cookie;
$flux_xml = ''; $flux_xml = '';
$order = new Order((int)($this->id_order)); $order = new Order((int)($this->id_order));
$products = $order->getProducts(); $products = $order->getProducts();
@@ -222,7 +218,7 @@ class Secuvad_flux
JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = sac.`id_category`) JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = sac.`id_category`)
JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`) JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`)
JOIN `'._DB_PREFIX_.'product_lang` pl ON (cp.`id_product` = pl.`id_product`) JOIN `'._DB_PREFIX_.'product_lang` pl ON (cp.`id_product` = pl.`id_product`)
JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = pl.`id_lang` AND l.`id_lang` = '.((isset($cookie->id_lang) AND (int)($cookie->id_lang)) ? (int)($cookie->id_lang) : (int)(Configuration::get('PS_LANG_DEFAULT'))).') JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = pl.`id_lang` AND l.`id_lang` = '.(int)Context::getContext()->language->id.')
WHERE pl.`id_product` = '.(int)($product['product_id']).' WHERE pl.`id_product` = '.(int)($product['product_id']).'
ORDER BY c.`level_depth` DESC ORDER BY c.`level_depth` DESC
',true); ',true);
+15 -41
View File
@@ -244,8 +244,6 @@ class Secuvad extends Module
public function hookAdminOrder($params) public function hookAdminOrder($params)
{ {
global $cookie;
if ($this->check_assoc() != '') if ($this->check_assoc() != '')
return ' return '
<br /> <br />
@@ -276,7 +274,7 @@ class Secuvad extends Module
'.($secuvad_order['is_fraud'] ? '<br /><b>'.$this->l('Unpaid transmitted:').'</b> '.$this->_getFraudStatusHtml((int)($secuvad_order['is_fraud'])) : '').' '.($secuvad_order['is_fraud'] ? '<br /><b>'.$this->l('Unpaid transmitted:').'</b> '.$this->_getFraudStatusHtml((int)($secuvad_order['is_fraud'])) : '').'
</p> </p>
<form method="POST" action="'.AdminTab::$currentIndex.'&id_order='.Tools::getValue('id_order').'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'"> <form method="POST" action="'.AdminTab::$currentIndex.'&id_order='.Tools::getValue('id_order').'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id).'">
<p class="center"> <p class="center">
<input type="hidden" name="id_secuvad_order" value="'.(int)($params['id_order']).'" /> <input type="hidden" name="id_secuvad_order" value="'.(int)($params['id_order']).'" />
<input type="submit" class="button" name="send_to_secuvad" value="'.$this->l('Update Secuvad status').'"> <input type="submit" class="button" name="send_to_secuvad" value="'.$this->l('Update Secuvad status').'">
@@ -353,8 +351,6 @@ class Secuvad extends Module
public function getContent() public function getContent()
{ {
global $cookie;
$this->_html = '<h2>'.$this->l('Secuvad configuration').'</h2>'; $this->_html = '<h2>'.$this->l('Secuvad configuration').'</h2>';
if (!$this->_isPaymentCCFilePresent()) if (!$this->_isPaymentCCFilePresent())
@@ -394,12 +390,10 @@ class Secuvad extends Module
private function _getSecuvadCategories() private function _getSecuvadCategories()
{ {
global $cookie;
return Db::getInstance()->ExecuteS(' return Db::getInstance()->ExecuteS('
SELECT * SELECT *
FROM `'._DB_PREFIX_.'secuvad_category` sc FROM `'._DB_PREFIX_.'secuvad_category` sc
WHERE sc.`id_lang` = '.(int)($cookie->id_lang)); WHERE sc.`id_lang` = '.(int)$this->context->language->id);
} }
private function _getSecuvadCategoryAssoc() private function _getSecuvadCategoryAssoc()
@@ -419,58 +413,48 @@ class Secuvad extends Module
private function _getSecuvadPayment() private function _getSecuvadPayment()
{ {
global $cookie;
return Db::getInstance()->ExecuteS(' return Db::getInstance()->ExecuteS('
SELECT IF(sp.name IS NULL, "Unknown", sp.name) AS `secuvad_name`, sp.`code`, m.`id_module`, m.`name` AS `module_name` SELECT IF(sp.name IS NULL, "Unknown", sp.name) AS `secuvad_name`, sp.`code`, m.`id_module`, m.`name` AS `module_name`
FROM `'._DB_PREFIX_.'secuvad_assoc_payment` sac FROM `'._DB_PREFIX_.'secuvad_assoc_payment` sac
JOIN `'._DB_PREFIX_.'module` m ON (m.`id_module` = sac.`id_module`) JOIN `'._DB_PREFIX_.'module` m ON (m.`id_module` = sac.`id_module`)
LEFT JOIN `'._DB_PREFIX_.'secuvad_payment` sp ON (sp.`code` = sac.`code` AND sp.`id_lang` = '.(int)($cookie->id_lang).')'); LEFT JOIN `'._DB_PREFIX_.'secuvad_payment` sp ON (sp.`code` = sac.`code` AND sp.`id_lang` = '.(int)$this->context->language->id.')');
} }
private function _getSecuvadCodePayment() private function _getSecuvadCodePayment()
{ {
global $cookie;
return Db::getInstance()->ExecuteS(' return Db::getInstance()->ExecuteS('
SELECT * SELECT *
FROM `'._DB_PREFIX_.'secuvad_payment` FROM `'._DB_PREFIX_.'secuvad_payment`
WHERE `id_lang` = '.(int)($cookie->id_lang) WHERE `id_lang` = '.(int)$this->context->language->id
); );
} }
private function _getSecuvadCarrier() private function _getSecuvadCarrier()
{ {
global $cookie;
return Db::getInstance()->ExecuteS(' return Db::getInstance()->ExecuteS('
SELECT * SELECT *
FROM `'._DB_PREFIX_.'secuvad_assoc_transport` sat FROM `'._DB_PREFIX_.'secuvad_assoc_transport` sat
JOIN '._DB_PREFIX_.'carrier c ON (c.id_carrier = sat.id_carrier) JOIN '._DB_PREFIX_.'carrier c ON (c.id_carrier = sat.id_carrier)
LEFT JOIN '._DB_PREFIX_.'secuvad_transport st ON st.transport_id = sat.transport_id AND st.id_lang='.(int)($cookie->id_lang).' LEFT JOIN '._DB_PREFIX_.'secuvad_transport st ON st.transport_id = sat.transport_id AND st.id_lang='.(int)$this->context->language->id.'
LEFT JOIN '._DB_PREFIX_.'secuvad_transport_delay std ON std.transport_delay_id = sat.transport_delay_id AND std.id_lang='.(int)($cookie->id_lang) LEFT JOIN '._DB_PREFIX_.'secuvad_transport_delay std ON std.transport_delay_id = sat.transport_delay_id AND std.id_lang='.(int)$this->context->language->id
); );
} }
private function _getSecuvadCarrierType() private function _getSecuvadCarrierType()
{ {
global $cookie;
return Db::getInstance()->ExecuteS(' return Db::getInstance()->ExecuteS('
SELECT * SELECT *
FROM `'._DB_PREFIX_.'secuvad_transport` FROM `'._DB_PREFIX_.'secuvad_transport`
WHERE `id_lang` = '.(int)($cookie->id_lang) WHERE `id_lang` = '.(int)$this->context->language->id
); );
} }
private function _getSecuvadCarrierDelay() private function _getSecuvadCarrierDelay()
{ {
global $cookie;
return Db::getInstance()->ExecuteS(' return Db::getInstance()->ExecuteS('
SELECT * SELECT *
FROM `'._DB_PREFIX_.'secuvad_transport_delay` FROM `'._DB_PREFIX_.'secuvad_transport_delay`
WHERE `id_lang` = '.(int)($cookie->id_lang) WHERE `id_lang` = '.(int)$this->context->language->id
); );
} }
@@ -621,8 +605,6 @@ class Secuvad extends Module
private function _setFormConfigure() private function _setFormConfigure()
{ {
global $cookie;
$this->_html .= ' $this->_html .= '
<form method="POST" action="'.$_SERVER['REQUEST_URI'].'"> <form method="POST" action="'.$_SERVER['REQUEST_URI'].'">
<fieldset style="width:430px;margin-right:10px;margin-bottom:10px;"> <fieldset style="width:430px;margin-right:10px;margin-bottom:10px;">
@@ -658,7 +640,7 @@ class Secuvad extends Module
if (Configuration::get('SECUVAD_ACTIVATION')) if (Configuration::get('SECUVAD_ACTIVATION'))
{ {
$categories = Category::getCategories((int)($cookie->id_lang), false); $categories = Category::getCategories((int)$this->context->language->id, false);
$categories[1]['infos'] = array('name' => $this->l('Home'), 'id_parent' => 0, 'level_depth' => 0); $categories[1]['infos'] = array('name' => $this->l('Home'), 'id_parent' => 0, 'level_depth' => 0);
$this->_html .= ' $this->_html .= '
@@ -763,7 +745,7 @@ class Secuvad extends Module
private function recurseCategoryForInclude($categories, $current, $id_category = 1, $has_suite = array()) private function recurseCategoryForInclude($categories, $current, $id_category = 1, $has_suite = array())
{ {
global $done, $cookie; global $done;
static $irow; static $irow;
if (!isset($done[$current['infos']['id_parent']])) if (!isset($done[$current['infos']['id_parent']]))
@@ -1058,8 +1040,6 @@ class Secuvad extends Module
private function check_transport() private function check_transport()
{ {
global $cookie;
$result = true; $result = true;
Db::getInstance()->Execute(' Db::getInstance()->Execute('
DELETE FROM `'._DB_PREFIX_.'secuvad_assoc_transport` DELETE FROM `'._DB_PREFIX_.'secuvad_assoc_transport`
@@ -1085,8 +1065,8 @@ class Secuvad extends Module
SELECT c.`name`, c.`id_carrier` SELECT c.`name`, c.`id_carrier`
FROM `'._DB_PREFIX_.'carrier` c FROM `'._DB_PREFIX_.'carrier` c
JOIN `'._DB_PREFIX_.'secuvad_assoc_transport` sat ON (sat.`id_carrier` = c.`id_carrier`) JOIN `'._DB_PREFIX_.'secuvad_assoc_transport` sat ON (sat.`id_carrier` = c.`id_carrier`)
LEFT JOIN `'._DB_PREFIX_.'secuvad_transport` st ON (st.`transport_id` = sat.`transport_id` AND st.`id_lang` = '.(int)($cookie->id_lang).') LEFT JOIN `'._DB_PREFIX_.'secuvad_transport` st ON (st.`transport_id` = sat.`transport_id` AND st.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'secuvad_transport_delay` std ON (std.`transport_delay_id` = sat.`transport_delay_id` AND std.`id_lang`='.(int)($cookie->id_lang).') LEFT JOIN `'._DB_PREFIX_.'secuvad_transport_delay` std ON (std.`transport_delay_id` = sat.`transport_delay_id` AND std.`id_lang`='.(int)$this->context->language->id.')
WHERE (st.`transport_id` IS NULL OR std.`transport_delay_id` IS NULL) WHERE (st.`transport_id` IS NULL OR std.`transport_delay_id` IS NULL)
AND c.`deleted` = 0 AND c.`deleted` = 0
AND c.`active` = 1 AND c.`active` = 1
@@ -1105,8 +1085,6 @@ class Secuvad extends Module
private function check_category() private function check_category()
{ {
global $cookie;
$result = true; $result = true;
Db::getInstance()->Execute(' Db::getInstance()->Execute('
DELETE FROM `'._DB_PREFIX_.'secuvad_assoc_category` DELETE FROM `'._DB_PREFIX_.'secuvad_assoc_category`
@@ -1133,7 +1111,7 @@ class Secuvad extends Module
JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = c.`id_category`) JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = c.`id_category`)
JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = cl.`id_lang` AND l.`iso_code` = \'en\') JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = cl.`id_lang` AND l.`iso_code` = \'en\')
JOIN `'._DB_PREFIX_.'secuvad_assoc_category` sac ON (sac.`id_category` = c.`id_category`) JOIN `'._DB_PREFIX_.'secuvad_assoc_category` sac ON (sac.`id_category` = c.`id_category`)
LEFT JOIN `'._DB_PREFIX_.'secuvad_category` sc ON (sc.`category_id` = sac.`category_id` AND sc.`id_lang` = '.(int)($cookie->id_lang).') LEFT JOIN `'._DB_PREFIX_.'secuvad_category` sc ON (sc.`category_id` = sac.`category_id` AND sc.`id_lang` = '.(int)$this->context->language->id.')
WHERE sc.`category_id` IS NULL WHERE sc.`category_id` IS NULL
'); ');
if(count($module_not_assoc)>0) if(count($module_not_assoc)>0)
@@ -1150,8 +1128,6 @@ class Secuvad extends Module
private function _sendToSecuvad() private function _sendToSecuvad()
{ {
global $cookie;
if ($this->check_assoc() != '' || Configuration::get('SECUVAD_ACTIVATION') != 1) if ($this->check_assoc() != '' || Configuration::get('SECUVAD_ACTIVATION') != 1)
{ {
$this->secuvad_log('AdminOrders.php : '.$this->l('Error during activation')); $this->secuvad_log('AdminOrders.php : '.$this->l('Error during activation'));
@@ -1169,14 +1145,12 @@ class Secuvad extends Module
$url = 'https://'.Configuration::get('SECUVAD_LOGIN').':'.Configuration::get('SECUVAD_MDP').'@'.Configuration::get('SECUVAD_URL_PROD'); $url = 'https://'.Configuration::get('SECUVAD_LOGIN').':'.Configuration::get('SECUVAD_MDP').'@'.Configuration::get('SECUVAD_URL_PROD');
$connection_obj = new Secuvad_connection($flux_xml, Configuration::get('SECUVAD_ID'),$url, $this); $connection_obj = new Secuvad_connection($flux_xml, Configuration::get('SECUVAD_ID'),$url, $this);
$connection_obj->send_transaction(); $connection_obj->send_transaction();
Tools::redirectAdmin('index.php?tab=AdminOrders&confirm=1&id_order='.Tools::getValue('id_secuvad_order').'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee))); Tools::redirectAdmin('index.php?tab=AdminOrders&confirm=1&id_order='.Tools::getValue('id_secuvad_order').'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
} }
} }
private function _reportFraud() private function _reportFraud()
{ {
global $cookie;
if ($this->check_assoc() != '' || Configuration::get('SECUVAD_ACTIVATION') != 1) if ($this->check_assoc() != '' || Configuration::get('SECUVAD_ACTIVATION') != 1)
{ {
$this->secuvad_log('AdminOrders.php : '.$this->l('Error during activation')); $this->secuvad_log('AdminOrders.php : '.$this->l('Error during activation'));
@@ -1209,7 +1183,7 @@ class Secuvad extends Module
$result = $connection_obj->report_fraud('impaye','impaye_report'); $result = $connection_obj->report_fraud('impaye','impaye_report');
if ($result == "true") if ($result == "true")
Tools::redirectAdmin('index.php?tab=AdminOrders&confirm=2&id_order='.Tools::getValue('id_secuvad_order').'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee))); Tools::redirectAdmin('index.php?tab=AdminOrders&confirm=2&id_order='.Tools::getValue('id_secuvad_order').'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
else else
{ {
if ($result == "Erreur de connexion") if ($result == "Erreur de connexion")
+6 -10
View File
@@ -51,8 +51,7 @@ class sendToAFriend extends Module
function hookExtraLeft($params) function hookExtraLeft($params)
{ {
global $smarty; $this->context->smarty->assign('this_path', $this->_path);
$smarty->assign('this_path', $this->_path);
return $this->display(__FILE__, 'product_page.tpl'); return $this->display(__FILE__, 'product_page.tpl');
} }
@@ -68,16 +67,14 @@ class sendToAFriend extends Module
public function displayFrontForm() public function displayFrontForm()
{ {
global $smarty;
$error = false; $error = false;
$confirm = false; $confirm = false;
if (isset($_POST['submitAddtoafriend'])) if (isset($_POST['submitAddtoafriend']))
{ {
global $cookie, $link;
/* Product informations */ /* Product informations */
$product = new Product((int)Tools::getValue('id_product'), false, (int)$cookie->id_lang); $product = new Product((int)Tools::getValue('id_product'), false, $this->context->language->id);
$productLink = $link->getProductLink($product); $productLink = $this->context->link->getProductLink($product);
/* Fields verifications */ /* Fields verifications */
if (empty($_POST['email']) OR empty($_POST['name'])) if (empty($_POST['email']) OR empty($_POST['name']))
@@ -108,10 +105,9 @@ class sendToAFriend extends Module
} }
else else
{ {
global $cookie, $link;
/* Product informations */ /* Product informations */
$product = new Product((int)Tools::getValue('id_product'), false, (int)$cookie->id_lang); $product = new Product((int)Tools::getValue('id_product'), false, $this->context->language->id);
$productLink = $link->getProductLink($product); $productLink = $this->context->link->getProductLink($product);
} }
/* Image */ /* Image */
@@ -126,7 +122,7 @@ class sendToAFriend extends Module
if (!isset($cover)) if (!isset($cover))
$cover = array('id_image' => Language::getIsoById((int)$cookie->id_lang).'-default', 'legend' => 'No picture'); $cover = array('id_image' => Language::getIsoById((int)$cookie->id_lang).'-default', 'legend' => 'No picture');
$smarty->assign(array( $this->context->smarty->assign(array(
'cover' => $cover, 'cover' => $cover,
'errors' => $error, 'errors' => $error,
'confirm' => $confirm, 'confirm' => $confirm,
+1 -4
View File
@@ -6,8 +6,6 @@ class shopimporter extends ImportModule
public function __construct() public function __construct()
{ {
global $cookie;
$this->name = 'shopimporter'; $this->name = 'shopimporter';
$this->tab = 'migration_tools'; $this->tab = 'migration_tools';
$this->version = '1.0'; $this->version = '1.0';
@@ -260,7 +258,6 @@ class shopimporter extends ImportModule
public function getContent() public function getContent()
{ {
global $cookie;
$exportModules = parent::getImportModulesOnDisk(); $exportModules = parent::getImportModulesOnDisk();
//get installed module only //get installed module only
foreach($exportModules as $key => $module) foreach($exportModules as $key => $module)
@@ -297,7 +294,7 @@ class shopimporter extends ImportModule
<fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" />'.$this->l('Import from another system').'</legend> <fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" />'.$this->l('Import from another system').'</legend>
<div class="warn" ><img src="../img/admin/warn2.png"> <div class="warn" ><img src="../img/admin/warn2.png">
'.$this->l('Before starting the import please backup your database. ').' '.$this->l('Before starting the import please backup your database. ').'
<a href="index.php?tab=AdminBackup&token='.Tools::getAdminToken('AdminBackup'.intval(Tab::getIdFromClassName('AdminBackup')).intval($cookie->id_employee)).'"">'.$this->l(' Click here to backup').'</a> <a href="index.php?tab=AdminBackup&token='.Tools::getAdminToken('AdminBackup'.(int)Tab::getIdFromClassName('AdminBackup').(int)$this->context->employee->id).'"">'.$this->l(' Click here to backup').'</a>
</div> </div>
<br> <br>
<div style="float:right;width:450px" id="steps"></div>'; <div style="float:right;width:450px" id="steps"></div>';
+1 -3
View File
@@ -9,9 +9,7 @@ if (!Tools::getValue('ajax'))
$socolissimo = new Socolissimo(); $socolissimo = new Socolissimo();
global $cookie; $result = $socolissimo->getDeliveryInfos(Context::getContext()->cart->id, Context::getContext()->customer->id);
$result = $socolissimo->getDeliveryInfos($cookie->id_cart,$cookie->id_customer);
if (!$result) if (!$result)
die('{"result" : false}'); die('{"result" : false}');
else else
+14 -27
View File
@@ -55,8 +55,6 @@ class Socolissimo extends CarrierModule
function __construct() function __construct()
{ {
global $cookie;
$this->name = 'socolissimo'; $this->name = 'socolissimo';
$this->tab = 'shipping_logistics'; $this->tab = 'shipping_logistics';
$this->version = '2.0'; $this->version = '2.0';
@@ -108,8 +106,6 @@ class Socolissimo extends CarrierModule
public function install() public function install()
{ {
global $cookie;
if (!parent::install() OR !Configuration::updateValue('SOCOLISSIMO_ID', NULL) OR !Configuration::updateValue('SOCOLISSIMO_KEY', NULL) if (!parent::install() OR !Configuration::updateValue('SOCOLISSIMO_ID', NULL) OR !Configuration::updateValue('SOCOLISSIMO_KEY', NULL)
OR !Configuration::updateValue('SOCOLISSIMO_URL', 'https://ws.colissimo.fr/pudo-fo/storeCall.do') OR !Configuration::updateValue('SOCOLISSIMO_PREPARATION_TIME', 1) OR !Configuration::updateValue('SOCOLISSIMO_URL', 'https://ws.colissimo.fr/pudo-fo/storeCall.do') OR !Configuration::updateValue('SOCOLISSIMO_PREPARATION_TIME', 1)
OR !Configuration::updateValue('SOCOLISSIMO_OVERCOST', 3.6) OR !$this->registerHook('extraCarrier') OR !$this->registerHook('AdminOrder') OR !$this->registerHook('updateCarrier') OR !Configuration::updateValue('SOCOLISSIMO_OVERCOST', 3.6) OR !$this->registerHook('extraCarrier') OR !$this->registerHook('AdminOrder') OR !$this->registerHook('updateCarrier')
@@ -154,8 +150,6 @@ class Socolissimo extends CarrierModule
public function uninstall() public function uninstall()
{ {
global $cookie;
$so_id = (int)Configuration::get('SOCOLISSIMO_CARRIER_ID'); $so_id = (int)Configuration::get('SOCOLISSIMO_CARRIER_ID');
if (!parent::uninstall() if (!parent::uninstall()
@@ -181,7 +175,7 @@ class Socolissimo extends CarrierModule
//if socolissimo carrier is default set other one as default //if socolissimo carrier is default set other one as default
if(Configuration::get('PS_CARRIER_DEFAULT') == (int)($soCarrier->id)) if(Configuration::get('PS_CARRIER_DEFAULT') == (int)($soCarrier->id))
{ {
$carriersD = Carrier::getCarriers((int)($cookie->id_lang)); $carriersD = Carrier::getCarriers($this->context->language->id);
foreach($carriersD as $carrierD) foreach($carriersD as $carrierD)
if ($carrierD['active'] AND !$carrierD['deleted'] AND ($carrierD['name'] != $this->_config['name'])) if ($carrierD['active'] AND !$carrierD['deleted'] AND ($carrierD['name'] != $this->_config['name']))
Configuration::updateValue('PS_CARRIER_DEFAULT', $carrierD['id_carrier']); Configuration::updateValue('PS_CARRIER_DEFAULT', $carrierD['id_carrier']);
@@ -217,8 +211,6 @@ class Socolissimo extends CarrierModule
private function _displayForm() private function _displayForm()
{ {
global $cookie;
$this->_html .= '<form action="'.$_SERVER['REQUEST_URI'].'" method="post" class="form"> $this->_html .= '<form action="'.$_SERVER['REQUEST_URI'].'" method="post" class="form">
<fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" /> '.$this->l('Description').'</legend>'. <fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" /> '.$this->l('Description').'</legend>'.
$this->l('SoColissimo is a service offered by La Poste, which allows you to offer buyers 5 modes of delivery.').' : $this->l('SoColissimo is a service offered by La Poste, which allows you to offer buyers 5 modes of delivery.').' :
@@ -359,8 +351,6 @@ class Socolissimo extends CarrierModule
public function hookExtraCarrier($params) public function hookExtraCarrier($params)
{ {
global $smarty, $cookie;
$customer = new Customer($params['address']->id_customer); $customer = new Customer($params['address']->id_customer);
$gender = array('1'=>'MR','2'=>'MME'); $gender = array('1'=>'MR','2'=>'MME');
if (in_array((int)($customer->id_gender),array(1,2))) if (in_array((int)($customer->id_gender),array(1,2)))
@@ -403,19 +393,19 @@ class Socolissimo extends CarrierModule
$serialsInput .= '&'.$key.'='.$val; $serialsInput .= '&'.$key.'='.$val;
$serialsInput = ltrim($serialsInput, '&'); $serialsInput = ltrim($serialsInput, '&');
$row['id_carrier'] = (int)($carrierSo->id); $row['id_carrier'] = (int)($carrierSo->id);
$smarty->assign(array('urlSo' => Configuration::get('SOCOLISSIMO_URL').'?trReturnUrlKo='.htmlentities($this->url,ENT_NOQUOTES, 'UTF-8'),'id_carrier' => (int)($row['id_carrier']), $this->context->smarty->assign(array('urlSo' => Configuration::get('SOCOLISSIMO_URL').'?trReturnUrlKo='.htmlentities($this->url,ENT_NOQUOTES, 'UTF-8'),'id_carrier' => (int)($row['id_carrier']),
'inputs' => $inputs, 'serialsInput' => $serialsInput, 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method'))); 'inputs' => $inputs, 'serialsInput' => $serialsInput, 'finishProcess' => $this->l('To choose SoColissimo, click on a delivery method')));
$country = new Country((int)($params['address']->id_country)); $country = new Country((int)($params['address']->id_country));
$carriers = Carrier::getCarriers($cookie->id_lang, true , false,false, NULL, Carrier::ALL_CARRIERS); $carriers = Carrier::getCarriers($this->context->language->id, true , false,false, NULL, Carrier::ALL_CARRIERS);
$ids = array(); $ids = array();
foreach($carriers as $carrier) foreach($carriers as $carrier)
$ids[] = $carrier['id_carrier']; $ids[] = $carrier['id_carrier'];
if ($this->getDeliveryInfos((int)$cookie->id_cart, (int)$cookie->id_customer)) if ($this->getDeliveryInfos($this->context->cart->id, $this->context->customer->id))
$smarty->assign('already_select_delivery', true); $this->context->smarty->assign('already_select_delivery', true);
else else
$smarty->assign('already_select_delivery', false); $this->context->smarty->assign('already_select_delivery', false);
if (($country->iso_code == 'FR') AND (Configuration::Get('SOCOLISSIMO_ID') != NULL) if (($country->iso_code == 'FR') AND (Configuration::Get('SOCOLISSIMO_ID') != NULL)
AND (Configuration::get('SOCOLISSIMO_KEY') != NULL) AND $this->checkAvailibility() AND (Configuration::get('SOCOLISSIMO_KEY') != NULL) AND $this->checkAvailibility()
@@ -426,7 +416,7 @@ class Socolissimo extends CarrierModule
} }
else else
{ {
$smarty->assign('ids', explode('|',Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST'))); $this->context->smarty->assign('ids', explode('|',Configuration::get('SOCOLISSIMO_CARRIER_ID_HIST')));
return $this->display(__FILE__, 'socolissimo_error.tpl'); return $this->display(__FILE__, 'socolissimo_error.tpl');
} }
@@ -435,7 +425,6 @@ class Socolissimo extends CarrierModule
public function hooknewOrder($params) public function hooknewOrder($params)
{ {
global $cookie;
if ($params['order']->id_carrier != Configuration::get('SOCOLISSIMO_CARRIER_ID')) if ($params['order']->id_carrier != Configuration::get('SOCOLISSIMO_CARRIER_ID'))
return; return;
$order = $params['order']; $order = $params['order'];
@@ -727,9 +716,8 @@ class Socolissimo extends CarrierModule
private function checkSoCarrierAvailable($id_carrier) private function checkSoCarrierAvailable($id_carrier)
{ {
global $cart, $defaultCountry;
$carrier = new Carrier((int)($id_carrier)); $carrier = new Carrier((int)($id_carrier));
$address = new Address((int)($cart->id_address_delivery)); $address = new Address((int)($this->context->cart->id_address_delivery));
$id_zone = Address::getZoneById((int)($address->id)); $id_zone = Address::getZoneById((int)($address->id));
// Get only carriers that are compliant with shipping method // Get only carriers that are compliant with shipping method
@@ -743,14 +731,14 @@ class Socolissimo extends CarrierModule
if ($carrier->range_behavior) if ($carrier->range_behavior)
{ {
// Get id zone // Get id zone
if (isset($cart->id_address_delivery) AND $cart->id_address_delivery) if (isset($this->context->cart->id_address_delivery) AND $this->context->cart->id_address_delivery)
$id_zone = Address::getZoneById((int)($cart->id_address_delivery)); $id_zone = Address::getZoneById((int)($this->context->cart->id_address_delivery));
else else
$id_zone = (int)$defaultCountry->id_zone; $id_zone = (int)$this->context->country->id_zone;
// Get only carriers that have a range compatible with cart // Get only carriers that have a range compatible with cart
if ((Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByWeight((int)($carrier->id), $cart->getTotalWeight(), $id_zone))) if ((Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByWeight((int)($carrier->id), $this->context->cart->getTotalWeight(), $id_zone)))
OR (!Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByPrice((int)($carrier->id), $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING), $id_zone, $cart->id_currency)))) OR (!Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByPrice((int)($carrier->id), $this->context->cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING), $id_zone, $this->context->cart->id_currency))))
{ {
return false; return false;
} }
@@ -760,8 +748,7 @@ class Socolissimo extends CarrierModule
public function getOrderShippingCost($params,$shipping_cost) public function getOrderShippingCost($params,$shipping_cost)
{ {
global $cart; $deliveryInfo = $this->getDeliveryInfos($this->context->cart->id, $this->context->cart->id_customer);
$deliveryInfo = $this->getDeliveryInfos($cart->id, $cart->id_customer);
if (!empty($deliveryInfo)) if (!empty($deliveryInfo))
if ($deliveryInfo['delivery_mode'] == 'RDV') if ($deliveryInfo['delivery_mode'] == 'RDV')
$shipping_cost += (float)(Configuration::get('SOCOLISSIMO_OVERCOST')); $shipping_cost += (float)(Configuration::get('SOCOLISSIMO_OVERCOST'));
+4 -7
View File
@@ -52,15 +52,12 @@ if (isset($return['SIGNATURE']) AND isset($return['CENAME']) AND isset($return['
if ($return['SIGNATURE'] === socolissimo::make_key($return['CENAME'],(float)($return['DYPREPARATIONTIME']),$return['DYFORWARDINGCHARGES'],$return['TRCLIENTNUMBER'], $return['ORDERID'])) if ($return['SIGNATURE'] === socolissimo::make_key($return['CENAME'],(float)($return['DYPREPARATIONTIME']),$return['DYFORWARDINGCHARGES'],$return['TRCLIENTNUMBER'], $return['ORDERID']))
{ {
global $cookie ; if (Context::getContext()->cart->id)
if (isset($cookie) OR is_object($cookie))
{ {
if (saveOrderShippingDetails(Context::getContext()->cart->id,(int)($return['TRCLIENTNUMBER']),$return))
if (saveOrderShippingDetails((int)($cookie->id_cart),(int)($return['TRCLIENTNUMBER']),$return))
{ {
global $cookie; Context::getContext()->cart->id_carrier = (int)($_POST['TRPARAMPLUS']);
$cart->id_carrier = (int)($_POST['TRPARAMPLUS']); if (!Context::getContext()->cart->update())
if (!$cart->update())
Tools::redirect(); Tools::redirect();
else else
Tools::redirect('index.php?controller=order&step=3'); Tools::redirect('index.php?controller=order&step=3');
+1 -3
View File
@@ -56,15 +56,13 @@ class StatsCarrier extends ModuleGraph
public function hookAdminStatsModules($params) public function hookAdminStatsModules($params)
{ {
global $cookie;
$sql = 'SELECT COUNT(o.`id_order`) as total $sql = 'SELECT COUNT(o.`id_order`) as total
FROM `'._DB_PREFIX_.'orders` o FROM `'._DB_PREFIX_.'orders` o
WHERE o.`date_add` BETWEEN '.ModuleGraph::getDateBetween().' WHERE o.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
'.$this->sqlShopRestriction(false, 'o').' '.$this->sqlShopRestriction(false, 'o').'
'.((int)(Tools::getValue('id_order_state')) ? 'AND (SELECT oh.id_order_state FROM `'._DB_PREFIX_.'order_history` oh WHERE o.id_order = oh.id_order ORDER BY oh.date_add DESC, oh.id_order_history DESC LIMIT 1) = '.(int)(Tools::getValue('id_order_state')) : ''); '.((int)(Tools::getValue('id_order_state')) ? 'AND (SELECT oh.id_order_state FROM `'._DB_PREFIX_.'order_history` oh WHERE o.id_order = oh.id_order ORDER BY oh.date_add DESC, oh.id_order_history DESC LIMIT 1) = '.(int)(Tools::getValue('id_order_state')) : '');
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
$states = OrderState::getOrderStates((int)($cookie->id_lang)); $states = OrderState::getOrderStates($this->context->language->id);
if (Tools::getValue('export')) if (Tools::getValue('export'))
$this->csvExport(array('type' => 'pie', 'option' => Tools::getValue('id_order_state'))); $this->csvExport(array('type' => 'pie', 'option' => Tools::getValue('id_order_state')));
+10 -12
View File
@@ -54,8 +54,6 @@ class StatsCheckUp extends Module
function hookAdminStatsModules() function hookAdminStatsModules()
{ {
global $cookie;
if (Tools::isSubmit('submitCheckup')) if (Tools::isSubmit('submitCheckup'))
{ {
foreach (array('CHECKUP_DESCRIPTIONS_LT','CHECKUP_DESCRIPTIONS_GT','CHECKUP_IMAGES_LT','CHECKUP_IMAGES_GT','CHECKUP_SALES_LT','CHECKUP_SALES_GT','CHECKUP_STOCK_LT','CHECKUP_STOCK_GT') as $confname) foreach (array('CHECKUP_DESCRIPTIONS_LT','CHECKUP_DESCRIPTIONS_GT','CHECKUP_IMAGES_LT','CHECKUP_IMAGES_GT','CHECKUP_SALES_LT','CHECKUP_SALES_GT','CHECKUP_STOCK_LT','CHECKUP_STOCK_GT') as $confname)
@@ -65,15 +63,15 @@ class StatsCheckUp extends Module
if (Tools::isSubmit('submitCheckupOrder')) if (Tools::isSubmit('submitCheckupOrder'))
{ {
$cookie->checkup_order = (int)Tools::getValue('submitCheckupOrder'); $this->context->cookie->checkup_order = (int)Tools::getValue('submitCheckupOrder');
echo '<div class="conf confirm"><img src="../img/admin/ok.gif"> '.$this->l('Configuration updated').'</div>'; echo '<div class="conf confirm"><img src="../img/admin/ok.gif"> '.$this->l('Configuration updated').'</div>';
} }
if (!isset($cookie->checkup_order)) if (!isset($this->context->cookie->checkup_order))
$cookie->checkup_order = 1; $this->context->cookie->checkup_order = 1;
$db = Db::getInstance(_PS_USE_SQL_SLAVE_); $db = Db::getInstance(_PS_USE_SQL_SLAVE_);
$employee = new Employee((int)($cookie->id_employee)); $employee = Context::getContext()->employee;
$prop30 = ((strtotime($employee->stats_date_to.' 23:59:59') - strtotime($employee->stats_date_from.' 00:00:00')) / 60 / 60 / 24) / 30; $prop30 = ((strtotime($employee->stats_date_to.' 23:59:59') - strtotime($employee->stats_date_from.' 00:00:00')) / 60 / 60 / 24) / 30;
$shopID = $this->context->shop->getID(); $shopID = $this->context->shop->getID();
@@ -90,7 +88,7 @@ class StatsCheckUp extends Module
1 => '<img src="../modules/'.$this->name.'/orange.png" alt="'.$this->l('average').'" />', 1 => '<img src="../modules/'.$this->name.'/orange.png" alt="'.$this->l('average').'" />',
2 => '<img src="../modules/'.$this->name.'/green.png" alt="'.$this->l('good').'" />' 2 => '<img src="../modules/'.$this->name.'/green.png" alt="'.$this->l('good').'" />'
); );
$tokenProducts = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)); $tokenProducts = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)Context::getContext()->employee->id);
$divisor = 4; $divisor = 4;
$totals = array('products' => 0, 'active' => 0, 'images' => 0, 'sales' => 0, 'stock' => 0); $totals = array('products' => 0, 'active' => 0, 'images' => 0, 'sales' => 0, 'stock' => 0);
foreach ($languages as $language) foreach ($languages as $language)
@@ -100,9 +98,9 @@ class StatsCheckUp extends Module
} }
$orderBy = 'p.id_product'; $orderBy = 'p.id_product';
if ($cookie->checkup_order == 2) if ($this->context->cookie->checkup_order == 2)
$orderBy = 'pl.name'; $orderBy = 'pl.name';
elseif ($cookie->checkup_order == 3) elseif ($this->context->cookie->checkup_order == 3)
$orderBy = 'nbSales DESC'; $orderBy = 'nbSales DESC';
// Get products stats // Get products stats
@@ -124,7 +122,7 @@ class StatsCheckUp extends Module
WHERE pa.id_product = p.id_product WHERE pa.id_product = p.id_product
), p.quantity) as stock ), p.quantity) as stock
FROM '._DB_PREFIX_.'product p FROM '._DB_PREFIX_.'product p
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$cookie->id_lang.') LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.')
'.$this->context->shop->sqlAsso('product', 'p').' '.$this->context->shop->sqlAsso('product', 'p').'
ORDER BY '.$orderBy; ORDER BY '.$orderBy;
$result = $db->ExecuteS($sql); $result = $db->ExecuteS($sql);
@@ -165,8 +163,8 @@ class StatsCheckUp extends Module
'.$this->l('Order by').' '.$this->l('Order by').'
<select name="submitCheckupOrder" onchange="this.form.submit();" style="width:100px"> <select name="submitCheckupOrder" onchange="this.form.submit();" style="width:100px">
<option value="1">'.$this->l('ID').'</option> <option value="1">'.$this->l('ID').'</option>
<option value="2" '.($cookie->checkup_order == 2 ? 'selected="selected"' : '').'>'.$this->l('Name').'</option> <option value="2" '.($this->context->cookie->checkup_order == 2 ? 'selected="selected"' : '').'>'.$this->l('Name').'</option>
<option value="3" '.($cookie->checkup_order == 3 ? 'selected="selected"' : '').'>'.$this->l('Sales').'</option> <option value="3" '.($this->context->cookie->checkup_order == 3 ? 'selected="selected"' : '').'>'.$this->l('Sales').'</option>
</select> </select>
</form> </form>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
+28 -31
View File
@@ -65,20 +65,19 @@ class StatsForecast extends Module
public function hookAdminStatsModules() public function hookAdminStatsModules()
{ {
global $cookie;
$ru = AdminTab::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token'); $ru = AdminTab::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token');
$db = Db::getInstance(); $db = Db::getInstance();
if (!isset($cookie->stats_granularity)) if (!isset($this->context->cookie->stats_granularity))
$cookie->stats_granularity = 10; $this->context->cookie->stats_granularity = 10;
if (Tools::isSubmit('submitIdZone')) if (Tools::isSubmit('submitIdZone'))
$cookie->stats_id_zone = Tools::getValue('stats_id_zone'); $this->context->cookie->stats_id_zone = Tools::getValue('stats_id_zone');
if (Tools::isSubmit('submitGranularity')) if (Tools::isSubmit('submitGranularity'))
$cookie->stats_granularity = Tools::getValue('stats_granularity'); $this->context->cookie->stats_granularity = Tools::getValue('stats_granularity');
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $currency = $this->context->currency;
$employee = new Employee((int)($cookie->id_employee)); $employee = $this->context->employee;
// @todo use PHP functions to get timestamp ... // @todo use PHP functions to get timestamp ...
$result = $db->getRow('SELECT UNIX_TIMESTAMP(\'2009-06-05 00:00:00\') as t1, UNIX_TIMESTAMP(\''.$employee->stats_date_from.' 00:00:00\') as t2'); $result = $db->getRow('SELECT UNIX_TIMESTAMP(\'2009-06-05 00:00:00\') as t1, UNIX_TIMESTAMP(\''.$employee->stats_date_from.' 00:00:00\') as t2');
@@ -90,13 +89,13 @@ class StatsForecast extends Module
$interval2 = ($to2 - $from) / 60 / 60 / 24; $interval2 = ($to2 - $from) / 60 / 60 / 24;
$prop30 = $interval / $interval2; $prop30 = $interval / $interval2;
if ($cookie->stats_granularity == 7) if ($this->context->cookie->stats_granularity == 7)
$intervalAvg = $interval2 / 30; $intervalAvg = $interval2 / 30;
if ($cookie->stats_granularity == 4) if ($this->context->cookie->stats_granularity == 4)
$intervalAvg = $interval2 / 365; $intervalAvg = $interval2 / 365;
if ($cookie->stats_granularity == 10) if ($this->context->cookie->stats_granularity == 10)
$intervalAvg = $interval2; $intervalAvg = $interval2;
if ($cookie->stats_granularity == 42) if ($this->context->cookie->stats_granularity == 42)
$intervalAvg = $interval2 / 7; $intervalAvg = $interval2 / 7;
define('PS_BASE_URI', '/'); define('PS_BASE_URI', '/');
@@ -104,11 +103,11 @@ class StatsForecast extends Module
$from = max($result['t1'], $result['t2']); $from = max($result['t1'], $result['t2']);
$to = strtotime($employee->stats_date_to.''); $to = strtotime($employee->stats_date_to.'');
$dateFromGAdd = ($cookie->stats_granularity != 42 $dateFromGAdd = ($this->context->cookie->stats_granularity != 42
? 'SUBSTRING(date_add, 1, '.(int)$cookie->stats_granularity.')' ? 'SUBSTRING(date_add, 1, '.(int)$this->context->cookie->stats_granularity.')'
: 'IFNULL(MAKEDATE(YEAR(date_add),DAYOFYEAR(date_add)-WEEKDAY(date_add)), CONCAT(YEAR(date_add),"-01-01*"))'); : 'IFNULL(MAKEDATE(YEAR(date_add),DAYOFYEAR(date_add)-WEEKDAY(date_add)), CONCAT(YEAR(date_add),"-01-01*"))');
$dateFromGInvoice = ($cookie->stats_granularity != 42 $dateFromGInvoice = ($this->context->cookie->stats_granularity != 42
? 'SUBSTRING(invoice_date, 1, '.(int)$cookie->stats_granularity.')' ? 'SUBSTRING(invoice_date, 1, '.(int)$this->context->cookie->stats_granularity.')'
: 'IFNULL(MAKEDATE(YEAR(invoice_date),DAYOFYEAR(invoice_date)-WEEKDAY(invoice_date)), CONCAT(YEAR(invoice_date),"-01-01*"))'); : 'IFNULL(MAKEDATE(YEAR(invoice_date),DAYOFYEAR(invoice_date)-WEEKDAY(invoice_date)), CONCAT(YEAR(invoice_date),"-01-01*"))');
$sql = 'SELECT $sql = 'SELECT
@@ -127,7 +126,7 @@ class StatsForecast extends Module
$result = $db->ExecuteS($sql, false); $result = $db->ExecuteS($sql, false);
$dataTable = array(); $dataTable = array();
if ($cookie->stats_granularity == 10) if ($this->context->cookie->stats_granularity == 10)
{ {
$dateEnd = strtotime($employee->stats_date_to.' 23:59:59'); $dateEnd = strtotime($employee->stats_date_to.' 23:59:59');
$dateToday = time(); $dateToday = time();
@@ -145,9 +144,9 @@ class StatsForecast extends Module
<input type="hidden" name="submitGranularity" value="1" /> <input type="hidden" name="submitGranularity" value="1" />
'.$this->l('Mode:').' <select name="stats_granularity" onchange="this.form.submit();" style="width:100px"> '.$this->l('Mode:').' <select name="stats_granularity" onchange="this.form.submit();" style="width:100px">
<option value="10">'.$this->l('Day').'</option> <option value="10">'.$this->l('Day').'</option>
<option value="42" '.($cookie->stats_granularity == '42' ? 'selected="selected"' : '').'>'.$this->l('Week').'</option> <option value="42" '.($this->context->cookie->stats_granularity == '42' ? 'selected="selected"' : '').'>'.$this->l('Week').'</option>
<option value="7" '.($cookie->stats_granularity == '7' ? 'selected="selected"' : '').'>'.$this->l('Month').'</option> <option value="7" '.($this->context->cookie->stats_granularity == '7' ? 'selected="selected"' : '').'>'.$this->l('Month').'</option>
<option value="4" '.($cookie->stats_granularity == '4' ? 'selected="selected"' : '').'>'.$this->l('Year').'</option> <option value="4" '.($this->context->cookie->stats_granularity == '4' ? 'selected="selected"' : '').'>'.$this->l('Year').'</option>
</select> </select>
</form> </form>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
@@ -193,7 +192,7 @@ class StatsForecast extends Module
$discountToday = (isset($discountArray[$row['fix_date']]) ? $discountArray[$row['fix_date']] : 0); $discountToday = (isset($discountArray[$row['fix_date']]) ? $discountArray[$row['fix_date']] : 0);
$visitsToday = (int)(isset($visitArray[$row['fix_date']]) ? $visitArray[$row['fix_date']] : 0); $visitsToday = (int)(isset($visitArray[$row['fix_date']]) ? $visitArray[$row['fix_date']] : 0);
$dateFromGReg = ($cookie->stats_granularity != 42 $dateFromGReg = ($this->context->cookie->stats_granularity != 42
? 'LIKE \''.$row['fix_date'].'%\'' ? 'LIKE \''.$row['fix_date'].'%\''
: 'BETWEEN \''.substr($row['fix_date'], 0, 10).' 00:00:00\' AND DATE_ADD(\''.substr($row['fix_date'], 0, 8).substr($row['fix_date'], 8, 2).' 23:59:59\', INTERVAL 7 DAY)'); : 'BETWEEN \''.substr($row['fix_date'], 0, 10).' 00:00:00\' AND DATE_ADD(\''.substr($row['fix_date'], 0, 8).substr($row['fix_date'], 8, 2).' 23:59:59\', INTERVAL 7 DAY)');
$sql = 'SELECT COUNT(*) FROM '._DB_PREFIX_.'customer $sql = 'SELECT COUNT(*) FROM '._DB_PREFIX_.'customer
@@ -363,7 +362,7 @@ class StatsForecast extends Module
'.$this->l('Zone:').' <select name="stats_id_zone" onchange="this.form.submit();"> '.$this->l('Zone:').' <select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->l('-- No filter --').'</option>'; <option value="0">'.$this->l('-- No filter --').'</option>';
foreach (Zone::getZones() as $zone) foreach (Zone::getZones() as $zone)
$this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>'; $this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
$this->_html .= '</select> $this->_html .= '</select>
</form> </form>
<table class="table float" border="0" cellspacing="0" cellspacing="0"> <table class="table float" border="0" cellspacing="0" cellspacing="0">
@@ -386,7 +385,7 @@ class StatsForecast extends Module
'.$this->l('Zone:').' <select name="stats_id_zone" onchange="this.form.submit();"> '.$this->l('Zone:').' <select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->l('-- No filter --').'</option>'; <option value="0">'.$this->l('-- No filter --').'</option>';
foreach (Zone::getZones() as $zone) foreach (Zone::getZones() as $zone)
$this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>'; $this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
$this->_html .= ' </select> $this->_html .= ' </select>
</form> </form>
<table class="table float" border="0" cellspacing="0" cellspacing="0"> <table class="table float" border="0" cellspacing="0" cellspacing="0">
@@ -446,7 +445,7 @@ class StatsForecast extends Module
'.$this->l('Zone:').' <select name="stats_id_zone" onchange="this.form.submit();"> '.$this->l('Zone:').' <select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->l('-- No filter --').'</option>'; <option value="0">'.$this->l('-- No filter --').'</option>';
foreach (Zone::getZones() as $zone) foreach (Zone::getZones() as $zone)
$this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>'; $this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
$this->_html .= '</select> $this->_html .= '</select>
</form> </form>
<table class="table" border="0" cellspacing="0" cellspacing="0"> <table class="table" border="0" cellspacing="0" cellspacing="0">
@@ -483,23 +482,21 @@ class StatsForecast extends Module
private function getRealCA() private function getRealCA()
{ {
global $cookie; $employee = $this->context->employee;
$employee = new Employee($cookie->id_employee);
$ca = array(); $ca = array();
$where = $join = ''; $where = $join = '';
if ((int)$cookie->stats_id_zone) if ((int)$this->context->cookie->stats_id_zone)
{ {
$join = ' LEFT JOIN `'._DB_PREFIX_.'address` a ON o.id_address_invoice = a.id_address LEFT JOIN `'._DB_PREFIX_.'country` co ON co.id_country = a.id_country'; $join = ' LEFT JOIN `'._DB_PREFIX_.'address` a ON o.id_address_invoice = a.id_address LEFT JOIN `'._DB_PREFIX_.'country` co ON co.id_country = a.id_country';
$where = ' AND co.id_zone = '.$cookie->stats_id_zone.' '; $where = ' AND co.id_zone = '.$this->context->cookie->stats_id_zone.' ';
} }
$sql = 'SELECT SUM(od.`product_price` * od.`product_quantity` / o.conversion_rate) as orderSum, COUNT(*) AS orderQty, cl.name, AVG(od.`product_price` / o.conversion_rate) as priveAvg $sql = 'SELECT SUM(od.`product_price` * od.`product_quantity` / o.conversion_rate) as orderSum, COUNT(*) AS orderQty, cl.name, AVG(od.`product_price` / o.conversion_rate) as priveAvg
FROM `'._DB_PREFIX_.'orders` o FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = od.product_id LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = od.product_id
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.id_category_default = cl.id_category AND cl.id_lang = '.(int)($cookie->id_lang).') LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.id_category_default = cl.id_category AND cl.id_lang = '.(int)$this->context->language->id.')
'.$join.' '.$join.'
WHERE o.valid = 1 WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().' AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
@@ -589,8 +586,8 @@ class StatsForecast extends Module
LEFT JOIN '._DB_PREFIX_.'order_detail od ON o.id_order = od.id_order LEFT JOIN '._DB_PREFIX_.'order_detail od ON o.id_order = od.id_order
INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON od.product_attribute_id = pac.id_product_attribute INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON od.product_attribute_id = pac.id_product_attribute
INNER JOIN '._DB_PREFIX_.'attribute a ON pac.id_attribute = a.id_attribute INNER JOIN '._DB_PREFIX_.'attribute a ON pac.id_attribute = a.id_attribute
INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (a.id_attribute_group = agl.id_attribute_group AND agl.id_lang = '.(int)($cookie->id_lang).') INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (a.id_attribute_group = agl.id_attribute_group AND agl.id_lang = '.(int)$this->context->language->id.')
INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (a.id_attribute = al.id_attribute AND al.id_lang = '.(int)($cookie->id_lang).') INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (a.id_attribute = al.id_attribute AND al.id_lang = '.(int)$this->context->language->id.')
WHERE o.valid = 1 WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().' AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.$this->sqlShopRestriction(false, 'o').' '.$this->sqlShopRestriction(false, 'o').'
@@ -151,11 +151,9 @@ class StatsGeoLocation extends Module
public function displayForm() public function displayForm()
{ {
global $cookie;
$map_size; $map_size;
$cross_size; $cross_size;
$id_lang = (isset($cookie->id_lang) ? (int)($cookie->id_lang) : Configuration::get('PS_LANG_DEFAULT')); $id_lang = (int)$this->context->language->id;
$wait = $this->l('Please wait...'); $wait = $this->l('Please wait...');
if ((file_exists('../modules/'.$this->name.'/'.$this->_map_path) == FALSE) || if ((file_exists('../modules/'.$this->name.'/'.$this->_map_path) == FALSE) ||
+1 -3
View File
@@ -111,8 +111,6 @@ class StatsLive extends Module
public function hookAdminStatsModules($params) public function hookAdminStatsModules($params)
{ {
global $cookie;
list($customers, $totalCustomers) = $this->getCustomersOnline(); list($customers, $totalCustomers) = $this->getCustomersOnline();
list($visitors, $totalVisitors) = $this->getVisitorsOnline(); list($visitors, $totalVisitors) = $this->getVisitorsOnline();
$irow = 0; $irow = 0;
@@ -137,7 +135,7 @@ class StatsLive extends Module
<td style="width: 200px;">'.$customer['firstname'].' '.$customer['lastname'].'</td> <td style="width: 200px;">'.$customer['firstname'].' '.$customer['lastname'].'</td>
<td style="width: 200px;">'.$customer['page'].'</td> <td style="width: 200px;">'.$customer['page'].'</td>
<td style="text-align: right; width: 25px;"> <td style="text-align: right; width: 25px;">
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)).'" target="_blank"> <a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id).'" target="_blank">
<img src="../modules/'.$this->name.'/logo.gif" /> <img src="../modules/'.$this->name.'/logo.gif" />
</a> </a>
</td> </td>
@@ -120,8 +120,6 @@ class StatsPersonalInfos extends ModuleGraph
protected function getData($layers) protected function getData($layers)
{ {
global $cookie;
switch ($this->_option) switch ($this->_option)
{ {
case 'gender': case 'gender':
@@ -244,7 +242,7 @@ class StatsPersonalInfos extends ModuleGraph
FROM `'._DB_PREFIX_.'address` a FROM `'._DB_PREFIX_.'address` a
LEFT JOIN `'._DB_PREFIX_.'customer` cu ON cu.id_customer = a.id_customer LEFT JOIN `'._DB_PREFIX_.'customer` cu ON cu.id_customer = a.id_customer
LEFT JOIN `'._DB_PREFIX_.'country` c ON a.`id_country` = c.`id_country` LEFT JOIN `'._DB_PREFIX_.'country` c ON a.`id_country` = c.`id_country`
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$cookie->id_lang.') LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')
WHERE a.id_customer != 0 WHERE a.id_customer != 0
'.$this->sqlShopRestriction(true, 'cu').' '.$this->sqlShopRestriction(true, 'cu').'
GROUP BY c.`id_country`'; GROUP BY c.`id_country`';
+11 -13
View File
@@ -148,9 +148,8 @@ class StatsProduct extends ModuleGraph
public function hookAdminStatsModules($params) public function hookAdminStatsModules($params)
{ {
global $cookie;
$id_category = (int)(Tools::getValue('id_category')); $id_category = (int)(Tools::getValue('id_category'));
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $currency = Context::getContext()->currency;
if (Tools::getValue('export')) if (Tools::getValue('export'))
if (!Tools::getValue('exportType')) if (!Tools::getValue('exportType'))
@@ -164,7 +163,7 @@ class StatsProduct extends ModuleGraph
$this->csvExport(array('layers' => 2, 'type' => 'line', 'option' => '1-'.$id_product)); $this->csvExport(array('layers' => 2, 'type' => 'line', 'option' => '1-'.$id_product));
elseif (Tools::getValue('exportType') == 2) elseif (Tools::getValue('exportType') == 2)
$this->csvExport(array('type' => 'pie', 'option' => '3-'.$id_product)); $this->csvExport(array('type' => 'pie', 'option' => '3-'.$id_product));
$product = new Product($id_product, false, (int)($cookie->id_lang)); $product = new Product($id_product, false, $this->context->language->id);
$totalBought = $this->getTotalBought($product->id); $totalBought = $this->getTotalBought($product->id);
$totalSales = $this->getTotalSales($product->id); $totalSales = $this->getTotalSales($product->id);
$totalViewed = $this->getTotalViewed($product->id); $totalViewed = $this->getTotalViewed($product->id);
@@ -181,7 +180,7 @@ class StatsProduct extends ModuleGraph
<p><a href="'.$_SERVER['REQUEST_URI'].'&export=1&exportType=2"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p><br />'; <p><a href="'.$_SERVER['REQUEST_URI'].'&export=1&exportType=2"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p><br />';
if ($totalBought) if ($totalBought)
{ {
$sales = $this->getSales($id_product, $cookie->id_lang); $sales = $this->getSales($id_product, $this->context->language->id);
$this->_html .= '<br class="clear" /> $this->_html .= '<br class="clear" />
<h3>'.$this->l('Sales').'</h3> <h3>'.$this->l('Sales').'</h3>
<div style="overflow-y: scroll; height: '.min(400, (count($sales)+1)*32).'px;"> <div style="overflow-y: scroll; height: '.min(400, (count($sales)+1)*32).'px;">
@@ -196,12 +195,12 @@ class StatsProduct extends ModuleGraph
<th>'.$this->l('Price').'</th> <th>'.$this->l('Price').'</th>
</tr> </tr>
</thead><tbody>'; </thead><tbody>';
$tokenOrder = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)); $tokenOrder = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($this->context->employee->id));
$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee)); $tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($this->context->employee->id));
foreach ($sales as $sale) foreach ($sales as $sale)
$this->_html .= ' $this->_html .= '
<tr> <tr>
<td>'.Tools::displayDate($sale['date_add'], (int)($cookie->id_lang), false).'</td> <td>'.Tools::displayDate($sale['date_add'], (int)($this->context->language->id), false).'</td>
<td align="center"><a href="?tab=AdminOrders&id_order='.$sale['id_order'].'&vieworder&token='.$tokenOrder.'">'.(int)($sale['id_order']).'</a></td> <td align="center"><a href="?tab=AdminOrders&id_order='.$sale['id_order'].'&vieworder&token='.$tokenOrder.'">'.(int)($sale['id_order']).'</a></td>
<td align="center"><a href="?tab=AdminCustomers&id_customer='.$sale['id_customer'].'&viewcustomer&token='.$tokenCustomer.'">'.(int)($sale['id_customer']).'</a></td> <td align="center"><a href="?tab=AdminCustomers&id_customer='.$sale['id_customer'].'&viewcustomer&token='.$tokenCustomer.'">'.(int)($sale['id_customer']).'</a></td>
'.($hasAttribute ? '<td>'.$sale['product_name'].'</td>' : '').' '.($hasAttribute ? '<td>'.$sale['product_name'].'</td>' : '').'
@@ -210,7 +209,7 @@ class StatsProduct extends ModuleGraph
</tr>'; </tr>';
$this->_html .= '</tbody></table></div>'; $this->_html .= '</tbody></table></div>';
$crossSelling = $this->getCrossSales($id_product, $cookie->id_lang); $crossSelling = $this->getCrossSales($id_product, $this->context->language->id);
if (count($crossSelling)) if (count($crossSelling))
{ {
$this->_html .= '<br class="clear" /> $this->_html .= '<br class="clear" />
@@ -224,7 +223,7 @@ class StatsProduct extends ModuleGraph
<th>'.$this->l('Average price').'</th> <th>'.$this->l('Average price').'</th>
</tr> </tr>
</thead><tbody>'; </thead><tbody>';
$tokenProducts = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)); $tokenProducts = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($this->context->employee->id));
foreach ($crossSelling as $selling) foreach ($crossSelling as $selling)
$this->_html .= ' $this->_html .= '
<tr> <tr>
@@ -238,7 +237,7 @@ class StatsProduct extends ModuleGraph
} }
else else
{ {
$categories = Category::getCategories((int)($cookie->id_lang), true, false); $categories = Category::getCategories((int)$this->context->language->id, true, false);
$this->_html .= ' $this->_html .= '
<label>'.$this->l('Choose a category').'</label> <label>'.$this->l('Choose a category').'</label>
<div class="margin-form"> <div class="margin-form">
@@ -264,7 +263,7 @@ class StatsProduct extends ModuleGraph
<th>'.$this->l('Stock').'</th> <th>'.$this->l('Stock').'</th>
</tr> </tr>
</thead><tbody>'; </thead><tbody>';
foreach ($this->getProducts($cookie->id_lang) AS $product) foreach ($this->getProducts($this->context->language->id) AS $product)
$this->_html .= '<tr><td>'.$product['reference'].'</td><td><a href="'.AdminTab::$currentIndex.'&token='.Tools::getValue('token').'&module='.$this->name.'&id_product='.$product['id_product'].'">'.$product['name'].'</a></td><td>'.$product['quantity'].'</td></tr>'; $this->_html .= '<tr><td>'.$product['reference'].'</td><td><a href="'.AdminTab::$currentIndex.'&token='.Tools::getValue('token').'&module='.$this->name.'&id_product='.$product['id_product'].'">'.$product['name'].'</a></td><td>'.$product['quantity'].'</td></tr>';
$this->_html .= '</tbody></table><br /></div><br /> $this->_html .= '</tbody></table><br /></div><br />
<a href="'.$_SERVER['REQUEST_URI'].'&export=1"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a><br />'; <a href="'.$_SERVER['REQUEST_URI'].'&export=1"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a><br />';
@@ -343,10 +342,9 @@ class StatsProduct extends ModuleGraph
protected function getData($layers) protected function getData($layers)
{ {
global $cookie;
if ($this->_option == 42) if ($this->_option == 42)
{ {
$products = $this->getProducts(intval($cookie->id_lang)); $products = $this->getProducts($this->context->language->id);
foreach ($products AS $product) foreach ($products AS $product)
{ {
$this->_values[0][] = $product['reference']; $this->_values[0][] = $product['reference'];
+1 -3
View File
@@ -57,8 +57,6 @@ class StatsSales extends ModuleGraph
public function hookAdminStatsModules($params) public function hookAdminStatsModules($params)
{ {
global $cookie;
$totals = $this->getTotals(); $totals = $this->getTotals();
$currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); $currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
if (($id_export = (int)Tools::getValue('export')) == 1) if (($id_export = (int)Tools::getValue('export')) == 1)
@@ -73,7 +71,7 @@ class StatsSales extends ModuleGraph
<form action="'.$_SERVER['REQUEST_URI'].'" method="post" style="float: right; margin-left: 10px;"> <form action="'.$_SERVER['REQUEST_URI'].'" method="post" style="float: right; margin-left: 10px;">
<select name="id_country"> <select name="id_country">
<option value="0"'.((!Tools::getValue('id_order_state')) ? ' selected="selected"' : '').'>'.$this->l('All').'</option>'; <option value="0"'.((!Tools::getValue('id_order_state')) ? ' selected="selected"' : '').'>'.$this->l('All').'</option>';
foreach (Country::getCountries($cookie->id_lang) AS $country) foreach (Country::getCountries($this->context->language->id) AS $country)
$this->_html .= '<option value="'.$country['id_country'].'"'.(($country['id_country'] == Tools::getValue('id_country')) ? ' selected="selected"' : '').'>'.$country['name'].'</option>'; $this->_html .= '<option value="'.$country['id_country'].'"'.(($country['id_country'] == Tools::getValue('id_country')) ? ' selected="selected"' : '').'>'.$country['name'].'</option>';
$this->_html .= '</select> $this->_html .= '</select>
<input type="submit" name="submitCountry" value="'.$this->l('Filter').'" class="button" /> <input type="submit" name="submitCountry" value="'.$this->l('Filter').'" class="button" />
+5 -7
View File
@@ -51,14 +51,12 @@ class StatsStock extends Module
function hookAdminStatsModules() function hookAdminStatsModules()
{ {
global $cookie;
if (Tools::isSubmit('submitCategory')) if (Tools::isSubmit('submitCategory'))
$cookie->statsstock_id_category = Tools::getValue('statsstock_id_category'); $this->context->cookie->statsstock_id_category = Tools::getValue('statsstock_id_category');
$ru = AdminTab::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token'); $ru = AdminTab::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token');
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$filter = ((int)$cookie->statsstock_id_category ? ' AND p.id_product IN (SELECT cp.id_product FROM '._DB_PREFIX_.'category_product cp WHERE cp.id_category = '.(int)$cookie->statsstock_id_category.')' : ''); $filter = ((int)$this->context->cookie->statsstock_id_category ? ' AND p.id_product IN (SELECT cp.id_product FROM '._DB_PREFIX_.'category_product cp WHERE cp.id_category = '.(int)$this->context->cookie->statsstock_id_category.')' : '');
$sql = 'SELECT p.id_product, p.reference, pl.name, $sql = 'SELECT p.id_product, p.reference, pl.name,
IFNULL(( IFNULL((
@@ -76,7 +74,7 @@ class StatsStock extends Module
), p.wholesale_price * p.quantity) as stockvalue ), p.wholesale_price * p.quantity) as stockvalue
FROM '._DB_PREFIX_.'product p FROM '._DB_PREFIX_.'product p
'.$this->context->shop->sqlAsso('product', 'p').' '.$this->context->shop->sqlAsso('product', 'p').'
INNER JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$cookie->id_lang.') INNER JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.')
WHERE 1 = 1 WHERE 1 = 1
'.$filter; '.$filter;
$products = Db::getInstance()->ExecuteS($sql); $products = Db::getInstance()->ExecuteS($sql);
@@ -88,8 +86,8 @@ class StatsStock extends Module
<input type="hidden" name="submitCategory" value="1" /> <input type="hidden" name="submitCategory" value="1" />
'.$this->l('Category').' : <select name="statsstock_id_category" onchange="this.form.submit();"> '.$this->l('Category').' : <select name="statsstock_id_category" onchange="this.form.submit();">
<option value="0">-- '.$this->l('All').' --</option>'; <option value="0">-- '.$this->l('All').' --</option>';
foreach (Category::getSimpleCategories($cookie->id_lang) as $category) foreach (Category::getSimpleCategories($this->context->language->id) as $category)
echo '<option value="'.(int)$category['id_category'].'" '.($cookie->statsstock_id_category == $category['id_category'] ? 'selected="selected"' : '').'>'.$category['name'].'</option>'; echo '<option value="'.(int)$category['id_category'].'" '.($this->context->cookie->statsstock_id_category == $category['id_category'] ? 'selected="selected"' : '').'>'.$category['name'].'</option>';
echo ' </select> echo ' </select>
</form> </form>
<div style="clear:both">&nbsp;</div>'; <div style="clear:both">&nbsp;</div>';
+5 -13
View File
@@ -162,8 +162,6 @@ class ThemeInstallator extends Module
private function init_defines() private function init_defines()
{ {
global $cookie;
define('_EXPORT_FOLDER_', dirname(__FILE__).'/export/'); define('_EXPORT_FOLDER_', dirname(__FILE__).'/export/');
define('_IMPORT_FOLDER_', dirname(__FILE__).'/import/'); define('_IMPORT_FOLDER_', dirname(__FILE__).'/import/');
$this->page = 1; $this->page = 1;
@@ -623,9 +621,7 @@ class ThemeInstallator extends Module
private function _displayForm2() private function _displayForm2()
{ {
global $cookie; $iso = $this->context->language->iso_code;
$iso = Language::getIsoById((int)($cookie->id_lang));
$xml = simplexml_load_file(_IMPORT_FOLDER_.XMLFILENAME); $xml = simplexml_load_file(_IMPORT_FOLDER_.XMLFILENAME);
$this->xml = $xml; $this->xml = $xml;
$res = $xml->xpath('/theme/descriptions/description[@iso="'.$iso.'"]'); $res = $xml->xpath('/theme/descriptions/description[@iso="'.$iso.'"]');
@@ -1145,10 +1141,8 @@ class ThemeInstallator extends Module
private function AuthorInformationForm() private function AuthorInformationForm()
{ {
global $cookie; $employee = $this->context->employee;
$mail = Tools::getValue('email') ? Tools::htmlentitiesUTF8(Tools::getValue('email')) : Tools::htmlentitiesUTF8($employee->email);
$employee = new Employee((int)$cookie->id_employee);
$mail = Tools::getValue('email') ? Tools::htmlentitiesUTF8(Tools::getValue('email')) : Tools::htmlentitiesUTF8($cookie->email);
$author = Tools::getValue('author_name') ? Tools::htmlentitiesUTF8(Tools::getValue('author_name')) : Tools::htmlentitiesUTF8(($employee->firstname).' '.$employee->lastname); $author = Tools::getValue('author_name') ? Tools::htmlentitiesUTF8(Tools::getValue('author_name')) : Tools::htmlentitiesUTF8(($employee->firstname).' '.$employee->lastname);
$website = Tools::getValue('website') ? Tools::htmlentitiesUTF8(Tools::getValue('website')) : Tools::getHttpHost(true); $website = Tools::getValue('website') ? Tools::htmlentitiesUTF8(Tools::getValue('website')) : Tools::getHttpHost(true);
@@ -1173,11 +1167,9 @@ class ThemeInstallator extends Module
private function ThemeInformationForm() private function ThemeInformationForm()
{ {
global $cookie; $defaultLanguage = (int)$this->context->language->id;
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
$languages = Language::getLanguages(); $languages = Language::getLanguages();
$iso = Language::getIsoById((int)($cookie->id_lang)); $iso = $this->context->language->iso_code;
$divLangName = 'title'; $divLangName = 'title';
$val = Tools::getValue('theme_name') ? Tools::getValue('theme_name') : Tools::getValue('mainTheme'); $val = Tools::getValue('theme_name') ? Tools::getValue('theme_name') : Tools::getValue('mainTheme');
+27 -32
View File
@@ -46,13 +46,11 @@ class TrackingFront extends Module
public function postProcess() public function postProcess()
{ {
global $cookie, $smarty;
if (Tools::isSubmit('ajaxProductFilter')) if (Tools::isSubmit('ajaxProductFilter'))
{ {
$fakeEmployee = new Employee(); $fakeEmployee = new Employee();
$fakeEmployee->stats_date_from = $cookie->stats_date_from; $fakeEmployee->stats_date_from = $this->context->cookie->stats_date_from;
$fakeEmployee->stats_date_to = $cookie->stats_date_to; $fakeEmployee->stats_date_to = $this->context->cookie->stats_date_to;
$result = Db::getInstance()->getRow(' $result = Db::getInstance()->getRow('
SELECT `id_referrer` SELECT `id_referrer`
FROM `'._DB_PREFIX_.'referrer` FROM `'._DB_PREFIX_.'referrer`
@@ -62,8 +60,8 @@ class TrackingFront extends Module
} }
elseif (Tools::isSubmit('logout_tracking')) elseif (Tools::isSubmit('logout_tracking'))
{ {
unset($cookie->tracking_id); unset($this->context->cookie->tracking_id);
unset($cookie->tracking_passwd); unset($this->context->cookie->tracking_passwd);
Tools::redirect('modules/trackingfront/stats.php'); Tools::redirect('modules/trackingfront/stats.php');
} }
elseif (Tools::isSubmit('submitLoginTracking')) elseif (Tools::isSubmit('submitLoginTracking'))
@@ -90,18 +88,18 @@ class TrackingFront extends Module
$errors[] = $this->l('authentication failed'); $errors[] = $this->l('authentication failed');
else else
{ {
$cookie->tracking_id = $tracking_id; $this->context->cookie->tracking_id = $tracking_id;
$cookie->tracking_passwd = $passwd; $this->context->cookie->tracking_passwd = $passwd;
Tools::redirect('modules/trackingfront/stats.php'); Tools::redirect('modules/trackingfront/stats.php');
} }
} }
$smarty->assign('errors', $errors); $this->context->smarty->assign('errors', $errors);
} }
if (Tools::isSubmit('submitDatePicker')) if (Tools::isSubmit('submitDatePicker'))
{ {
$cookie->stats_date_from = Tools::getValue('datepickerFrom'); $this->context->cookie->stats_date_from = Tools::getValue('datepickerFrom');
$cookie->stats_date_to = Tools::getValue('datepickerTo'); $this->context->cookie->stats_date_to = Tools::getValue('datepickerTo');
} }
if (Tools::isSubmit('submitDateDay')) if (Tools::isSubmit('submitDateDay'))
{ {
@@ -140,13 +138,12 @@ class TrackingFront extends Module
public function isLogged() public function isLogged()
{ {
global $cookie; if (!$this->context->cookie->tracking_id OR !$this->context->cookie->tracking_passwd)
if (!$cookie->tracking_id OR !$cookie->tracking_passwd)
return false; return false;
$result = Db::getInstance()->getRow(' $result = Db::getInstance()->getRow('
SELECT `id_referrer` SELECT `id_referrer`
FROM `'._DB_PREFIX_.'referrer` FROM `'._DB_PREFIX_.'referrer`
WHERE `id_referrer` = '.(int)($cookie->tracking_id).' AND `passwd` = \''.pSQL($cookie->tracking_passwd).'\''); WHERE `id_referrer` = '.(int)($this->context->cookie->tracking_id).' AND `passwd` = \''.pSQL($this->context->cookie->tracking_passwd).'\'');
return isset($result['id_referrer']) ? $result['id_referrer'] : false; return isset($result['id_referrer']) ? $result['id_referrer'] : false;
} }
@@ -157,21 +154,19 @@ class TrackingFront extends Module
public function displayAccount() public function displayAccount()
{ {
global $smarty, $cookie; if (!isset($this->context->cookie->stats_date_from))
$this->context->cookie->stats_date_from = date('Y-m-d');
if (!isset($cookie->stats_date_from)) if (!isset($this->context->cookie->stats_date_to))
$cookie->stats_date_from = date('Y-m-d'); $this->context->cookie->stats_date_to = date('Y-m-t');
if (!isset($cookie->stats_date_to))
$cookie->stats_date_to = date('Y-m-t');
$fakeEmployee = new Employee(); $fakeEmployee = new Employee();
$fakeEmployee->stats_date_from = $cookie->stats_date_from; $fakeEmployee->stats_date_from = $this->context->cookie->stats_date_from;
$fakeEmployee->stats_date_to = $cookie->stats_date_to; $fakeEmployee->stats_date_to = $this->context->cookie->stats_date_to;
Referrer::refreshCache(array(array('id_referrer' => (int)($cookie->tracking_id))), $fakeEmployee); Referrer::refreshCache(array(array('id_referrer' => (int)($this->context->cookie->tracking_id))), $fakeEmployee);
$referrer = new Referrer((int)($cookie->tracking_id)); $referrer = new Referrer((int)($this->context->cookie->tracking_id));
$smarty->assign('referrer', $referrer); $this->context->smarty->assign('referrer', $referrer);
$smarty->assign('datepickerFrom', $fakeEmployee->stats_date_from); $this->context->smarty->assign('datepickerFrom', $fakeEmployee->stats_date_from);
$smarty->assign('datepickerTo', $fakeEmployee->stats_date_to); $this->context->smarty->assign('datepickerTo', $fakeEmployee->stats_date_to);
$displayTab = array( $displayTab = array(
'uniqs' => $this->l('Unique visitors'), 'uniqs' => $this->l('Unique visitors'),
@@ -187,15 +182,15 @@ class TrackingFront extends Module
'cart' => $this->l('Average cart'), 'cart' => $this->l('Average cart'),
'reg_rate' => $this->l('Registration rate'), 'reg_rate' => $this->l('Registration rate'),
'order_rate' => $this->l('Order rate')); 'order_rate' => $this->l('Order rate'));
$smarty->assign('displayTab', $displayTab); $this->context->smarty->assign('displayTab', $displayTab);
$products = Product::getSimpleProducts((int)($cookie->id_lang)); $products = Product::getSimpleProducts($this->context->language->id);
$productsArray = array(); $productsArray = array();
foreach ($products as $product) foreach ($products as $product)
$productsArray[] = $product['id_product']; $productsArray[] = $product['id_product'];
$echo = ' $echo = '
<script type="text/javascript" src="../../js/jquery/datepicker/ui/i18n/ui.datepicker-'.Db::getInstance()->getValue('SELECT iso_code FROM '._DB_PREFIX_.'lang WHERE `id_lang` = '.(int)($cookie->id_lang)).'.js"></script> <script type="text/javascript" src="../../js/jquery/datepicker/ui/i18n/ui.datepicker-'.Db::getInstance()->getValue('SELECT iso_code FROM '._DB_PREFIX_.'lang WHERE `id_lang` = '.(int)$this->context->language->id).'.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$("#datepickerFrom").datepicker({ $("#datepickerFrom").datepicker({
prevText:"", prevText:"",
@@ -208,7 +203,7 @@ class TrackingFront extends Module
function updateValues() function updateValues()
{ {
$.getJSON("stats.php",{ajaxProductFilter:1,id_referrer:'.$referrer->id.',token:"'.$cookie->tracking_passwd.'",id_product:0}, $.getJSON("stats.php",{ajaxProductFilter:1,id_referrer:'.$referrer->id.',token:"'.$this->context->cookie->tracking_passwd.'",id_product:0},
function(j) {'; function(j) {';
foreach ($displayTab as $key => $value) foreach ($displayTab as $key => $value)
$echo .= '$("#'.$key.'").html(j[0].'.$key.');'; $echo .= '$("#'.$key.'").html(j[0].'.$key.');';
@@ -244,7 +239,7 @@ class TrackingFront extends Module
{ {
var irow = 0; var irow = 0;
for (var i = 0; i < productIds.length; ++i) for (var i = 0; i < productIds.length; ++i)
$.getJSON("stats.php",{ajaxProductFilter:1,token:"'.$cookie->tracking_passwd.'",id_referrer:'.$referrer->id.',id_product:productIds[i]}, $.getJSON("stats.php",{ajaxProductFilter:1,token:"'.$this->context->cookie->tracking_passwd.'",id_referrer:'.$referrer->id.',id_product:productIds[i]},
function(result) { function(result) {
var newLine = newProductLine('.$referrer->id.', result[0], (irow++%2 ? 204 : 238)); var newLine = newProductLine('.$referrer->id.', result[0], (irow++%2 ? 204 : 238));
$(newLine).hide().insertBefore($(\'#trid_dummy\')).fadeIn(); $(newLine).hide().insertBefore($(\'#trid_dummy\')).fadeIn();
+6 -15
View File
@@ -90,11 +90,9 @@ class Treepodia extends Module
public function generateXmlFlow() public function generateXmlFlow()
{ {
global $cart, $cookie; $this->context->cookie->id_lang = (int)Configuration::get('PS_LANG_DEFAULT'); // url rewriting case
$cookie->id_lang = (int)Configuration::get('PS_LANG_DEFAULT'); // url rewriting case
$cart = new Cart(); $link = $this->context->link;
$link = new Link();
$defaultCurrencyIsoCode = strtoupper(Db::getInstance()->getValue('SELECT c.iso_code FROM '._DB_PREFIX_.'currency c WHERE c.id_currency = '.(int)Configuration::get('PS_CURRENCY_DEFAULT'))); $defaultCurrencyIsoCode = strtoupper(Db::getInstance()->getValue('SELECT c.iso_code FROM '._DB_PREFIX_.'currency c WHERE c.id_currency = '.(int)Configuration::get('PS_CURRENCY_DEFAULT')));
$defaultIdLang = (int)Configuration::get('PS_LANG_DEFAULT'); $defaultIdLang = (int)Configuration::get('PS_LANG_DEFAULT');
@@ -511,9 +509,7 @@ XML;
public function displayForm() public function displayForm()
{ {
global $cookie; $lang = $this->context->language;
$lang = new Language((int)($cookie->id_lang));
$output = $this->_displayCSSAndJS().'<h2>'.$this->displayName.'</h2> $output = $this->_displayCSSAndJS().'<h2>'.$this->displayName.'</h2>
<img id="treepodia-logo" src="'.__PS_BASE_URI__.'modules/'.$this->name.'/logo.png'.'" alt="" /> <img id="treepodia-logo" src="'.__PS_BASE_URI__.'modules/'.$this->name.'/logo.png'.'" alt="" />
@@ -726,8 +722,6 @@ XML;
public function hookExtraLeft($params) public function hookExtraLeft($params)
{ {
global $smarty;
$id_product = Tools::getValue('id_product'); $id_product = Tools::getValue('id_product');
if (!Configuration::get('TREEPODIA_ACCOUNT_CODE') OR Configuration::get('TREEPODIA_INTEGRATION_TYPE') != 0) if (!Configuration::get('TREEPODIA_ACCOUNT_CODE') OR Configuration::get('TREEPODIA_INTEGRATION_TYPE') != 0)
return ''; return '';
@@ -747,7 +741,7 @@ XML;
$position = 'left'; $position = 'left';
} }
$smarty->assign(array('position' => $position, 'img_src' => _MODULE_DIR_.$this->name.'/logos/'.Configuration::get('TREEPODIA_PLAY_LOGO'), 'account_id' => Configuration::get('TREEPODIA_ACCOUNT_CODE'), 'product_sku' => (int)($id_product))); $this->context->smarty->assign(array('position' => $position, 'img_src' => _MODULE_DIR_.$this->name.'/logos/'.Configuration::get('TREEPODIA_PLAY_LOGO'), 'account_id' => Configuration::get('TREEPODIA_ACCOUNT_CODE'), 'product_sku' => (int)($id_product)));
return $this->display(__FILE__, 'product.tpl'); return $this->display(__FILE__, 'product.tpl');
} }
@@ -759,14 +753,12 @@ XML;
public function hookFooter($params) public function hookFooter($params)
{ {
global $smarty;
if (!Configuration::get('TREEPODIA_ACCOUNT_CODE') OR Configuration::get('TREEPODIA_INTEGRATION_TYPE') != 0) if (!Configuration::get('TREEPODIA_ACCOUNT_CODE') OR Configuration::get('TREEPODIA_INTEGRATION_TYPE') != 0)
return; return;
if (!(int)Tools::getValue('id_product')) if (!(int)Tools::getValue('id_product'))
return; return;
$smarty->assign(array('account_id' => Configuration::get('TREEPODIA_ACCOUNT_CODE'), 'product_sku' => (int)Tools::getValue('id_product'))); $this->context->smarty->assign(array('account_id' => Configuration::get('TREEPODIA_ACCOUNT_CODE'), 'product_sku' => (int)Tools::getValue('id_product')));
return $this->display(__FILE__, 'footer.tpl'); return $this->display(__FILE__, 'footer.tpl');
} }
@@ -780,8 +772,7 @@ XML;
$order = $params['objOrder']; $order = $params['objOrder'];
$products = $order->getProducts(); $products = $order->getProducts();
global $smarty; $this->context->smarty->assign(array('account_id' => Configuration::get('TREEPODIA_ACCOUNT_CODE'), 'products' => $products));
$smarty->assign(array('account_id' => Configuration::get('TREEPODIA_ACCOUNT_CODE'), 'products' => $products));
return $this->display(__FILE__, 'tracking.tpl'); return $this->display(__FILE__, 'tracking.tpl');
} }
} }
+1 -2
View File
@@ -56,7 +56,6 @@ class RatingAlert
public static function executeCronTask() public static function executeCronTask()
{ {
global $cookie;
if (!Configuration::get('TS_SEND_SEPERATE_MAIL')) if (!Configuration::get('TS_SEND_SEPERATE_MAIL'))
return true; return true;
@@ -67,7 +66,7 @@ class RatingAlert
foreach ($alerts_infos AS $infos) foreach ($alerts_infos AS $infos)
{ {
$cookie->id_lang = $infos['id_lang']; $this->context->cookie->id_lang = $infos['id_lang'];
$subject = $ts_module->getL('title_part_1').' '.Configuration::get('PS_SHOP_NAME').$ts_module->getL('title_part_2'); $subject = $ts_module->getL('title_part_1').' '.Configuration::get('PS_SHOP_NAME').$ts_module->getL('title_part_2');
$template_vars = array('{ts_id}' => Configuration::get('TS_ID_'.(int)($infos['id_lang'])), $template_vars = array('{ts_id}' => Configuration::get('TS_ID_'.(int)($infos['id_lang'])),
'{button_url}' => TrustedShops::getHttpHost(true, true)._MODULE_DIR_.$ts_module->name.'/img', '{button_url}' => TrustedShops::getHttpHost(true, true)._MODULE_DIR_.$ts_module->name.'/img',
+1 -1
View File
@@ -116,7 +116,7 @@ abstract class AbsTrustedShops
} }
public function display($file, $template, $cacheId = NULL, $compileId = NULL) public function display($file, $template, $cacheId = NULL, $compileId = NULL)
{ {
global $smarty; $smarty = $this->context->smarty;
if (Configuration::get('PS_FORCE_SMARTY_2')) /* Keep a backward compatibility for Smarty v2 */ if (Configuration::get('PS_FORCE_SMARTY_2')) /* Keep a backward compatibility for Smarty v2 */
{ {
+1 -2
View File
@@ -56,7 +56,6 @@ class RatingAlert
public static function executeCronTask() public static function executeCronTask()
{ {
global $cookie;
if (!Configuration::get('TS_SEND_SEPERATE_MAIL')) if (!Configuration::get('TS_SEND_SEPERATE_MAIL'))
return true; return true;
@@ -67,7 +66,7 @@ class RatingAlert
foreach ($alerts_infos AS $infos) foreach ($alerts_infos AS $infos)
{ {
$cookie->id_lang = $infos['id_lang']; $this->context->cookie->id_lang = $infos['id_lang'];
$subject = $ts_module->getL('title_part_1').' '.Configuration::get('PS_SHOP_NAME').$ts_module->getL('title_part_2'); $subject = $ts_module->getL('title_part_1').' '.Configuration::get('PS_SHOP_NAME').$ts_module->getL('title_part_2');
$template_vars = array('{ts_id}' => Configuration::get('TS_ID_'.(int)($infos['id_lang'])), $template_vars = array('{ts_id}' => Configuration::get('TS_ID_'.(int)($infos['id_lang'])),
'{button_url}' => TrustedShops::getHttpHost(true, true)._MODULE_DIR_.$ts_module->name.'/img', '{button_url}' => TrustedShops::getHttpHost(true, true)._MODULE_DIR_.$ts_module->name.'/img',
@@ -931,14 +931,13 @@ class TSBuyerProtection extends AbsTrustedShops
} }
private function _displayPresentation() private function _displayPresentation()
{ {
global $cookie;
$link = ''; $link = '';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'de') if (strtolower(Context::getContext()->language->iso_code) == 'de')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.de/shopbetreiber/mitgliedschaft.html?et_cid=14&et_lid=29069" target="_blank">Jetzt bei Trusted Shops anmelden!</a></b></p><br />'; $link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.de/shopbetreiber/mitgliedschaft.html?et_cid=14&et_lid=29069" target="_blank">Jetzt bei Trusted Shops anmelden!</a></b></p><br />';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'en') if (strtolower(Context::getContext()->language->iso_code) == 'en')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.com/merchants/membership.html?shopsw=PRESTA&et_cid=53&et_lid=3361" target="_blank">Appy now!</a></b></p><br />'; $link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.com/merchants/membership.html?shopsw=PRESTA&et_cid=53&et_lid=3361" target="_blank">Appy now!</a></b></p><br />';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'fr') if (strtolower(Context::getContext()->language->iso_code) == 'fr')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.fr/marchands/tarifs.html?shopsw=PRESTA&et_cid=53&et_lid=3362" target="_blank">Enregistrement Trusted Shops</a></b></p><br />'; $link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.fr/marchands/tarifs.html?shopsw=PRESTA&et_cid=53&et_lid=3362" target="_blank">Enregistrement Trusted Shops</a></b></p><br />';
return ' return '
+13 -21
View File
@@ -358,20 +358,18 @@ class TrustedShopsRating extends AbsTrustedShops
public function displayInformationsPage() public function displayInformationsPage()
{ {
global $cookie;
$link = ''; $link = '';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'de') if (strtolower(Context::getContext()->language->iso_code) == 'de')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="https://www.trustedshops.de/shopbetreiber/kundenbewertung_anmeldung.html?partnerPackage=PrestaShop&ratingProduct=RATING_PRO&et_cid=14en&et_lid=29069" target="_blank">Jetzt bei Trusted Shops anmelden!</a></b></p><br />'; $link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="https://www.trustedshops.de/shopbetreiber/kundenbewertung_anmeldung.html?partnerPackage=PrestaShop&ratingProduct=RATING_PRO&et_cid=14en&et_lid=29069" target="_blank">Jetzt bei Trusted Shops anmelden!</a></b></p><br />';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'en') if (strtolower(Context::getContext()->language->iso_code) == 'en')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.com/merchants/membership.html?shopsw=PRESTA&et_cid=53&et_lid=3361" target="_blank">Apply now!</a></b></p><br />'; $link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.com/merchants/membership.html?shopsw=PRESTA&et_cid=53&et_lid=3361" target="_blank">Apply now!</a></b></p><br />';
if (strtolower(Language::getIsoById((int)$cookie->id_lang)) == 'fr') if (strtolower(Context::getContext()->language->iso_code) == 'fr')
$link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.fr/marchands/tarifs.html?shopsw=PRESTA&et_cid=53&et_lid=3362" target="_blank">Enregistrement Trusted Shops</a></b></p><br />'; $link = '<p><b><a style="text-decoration: underline; font-weight: bold; color: #0000CC;" target="_blank" href="http://www.trustedshops.fr/marchands/tarifs.html?shopsw=PRESTA&et_cid=53&et_lid=3362" target="_blank">Enregistrement Trusted Shops</a></b></p><br />';
return '<fieldset> return '<fieldset>
<legend><img src="'.__PS_BASE_URI__.'modules/'.self::$module_name.'/logo.gif" alt="" />'.$this->l('Learn More').'</legend> <legend><img src="'.__PS_BASE_URI__.'modules/'.self::$module_name.'/logo.gif" alt="" />'.$this->l('Learn More').'</legend>
<img src="'._MODULE_DIR_.self::$module_name.'/img/ts_rating_'.$this->_getAllowedIsobyId($cookie->id_lang).'.jpg" /> <img src="'._MODULE_DIR_.self::$module_name.'/img/ts_rating_'.$this->_getAllowedIsobyId(Context::getContext()->language->id).'.jpg" />
<h3>'.$this->l('Trusted Shops Customer Rating').'</h3> <h3>'.$this->l('Trusted Shops Customer Rating').'</h3>
<p>'.$this->l('For online buyers, positive and verifiable customer ratings are an important indication of an online shop\'s trustworthiness. The required software is already included in Prestashop, so you can start collecting customer ratings in your online shop too. Integration is easy with just a few clicks.').'</p> <p>'.$this->l('For online buyers, positive and verifiable customer ratings are an important indication of an online shop\'s trustworthiness. The required software is already included in Prestashop, so you can start collecting customer ratings in your online shop too. Integration is easy with just a few clicks.').'</p>
@@ -392,31 +390,27 @@ class TrustedShopsRating extends AbsTrustedShops
public function getApplyUrl() public function getApplyUrl()
{ {
global $cookie; $lang = $this->_getAllowedIsobyId(Context::getContext()->language->id);
$lang = $this->_getAllowedIsobyId($cookie->id_lang);
return $this->apply_url_base[$lang].'?partnerPackage='.self::PARTNER_PACKAGE.'&shopsw='.self::SHOP_SW.'&website='. return $this->apply_url_base[$lang].'?partnerPackage='.self::PARTNER_PACKAGE.'&shopsw='.self::SHOP_SW.'&website='.
urlencode(_PS_BASE_URL_.__PS_BASE_URI__).'&firstName='.urlencode($cookie->firstname).'&lastName='. urlencode(_PS_BASE_URL_.__PS_BASE_URI__).'&firstName='.urlencode(Context::getContext()->customer->firstname).'&lastName='.
urlencode($cookie->lastname).'&email='.urlencode(Configuration::get('PS_TAB0_SHOP_EMAIL')).'&language='.strtoupper(Language::getIsoById((int)($cookie->id_lang))). urlencode(Context::getContext()->customer->lastname).'&email='.urlencode(Configuration::get('PS_TAB0_SHOP_EMAIL')).'&language='.strtoupper(Context::getContext()->language->iso_code).
'&ratingProduct=RATING_PRO'.$this->apply_url_tracker[$lang]; '&ratingProduct=RATING_PRO'.$this->apply_url_tracker[$lang];
} }
public function getRatingUrl($id_order = '') public function getRatingUrl($id_order = '')
{ {
global $cookie;
$buyer_email = ''; $buyer_email = '';
if ($cookie->isLogged()) if (Context::getContext()->cookie->isLogged())
{ {
if (empty($id_order) && !empty($cookie->id_customer)) if (empty($id_order) && !empty(Context::getContext()->customer->id))
$id_order = $this->_getLastOrderId($cookie->id_customer); $id_order = $this->_getLastOrderId(Context::getContext()->customer->id);
$buyer_email = $cookie->email; $buyer_email = Context::getContext()->customer->email;
} }
return $this->getRatingUrlWithBuyerEmail((int)($cookie->id_lang), $id_order, $buyer_email); return $this->getRatingUrlWithBuyerEmail(Context::getContext()->language->id, $id_order, $buyer_email);
} }
public function getRatingUrlWithBuyerEmail($id_lang, $id_order = '', $buyer_email = '') public function getRatingUrlWithBuyerEmail($id_lang, $id_order = '', $buyer_email = '')
@@ -460,9 +454,7 @@ class TrustedShopsRating extends AbsTrustedShops
public function getWidgetFilename() public function getWidgetFilename()
{ {
global $cookie; return self::$module_name.'/cache/'.Configuration::get('TS_TAB0_ID_'.(int)Context::getContext()->language->id).'.gif';
return self::$module_name.'/cache/'.Configuration::get('TS_TAB0_ID_'.(int)($cookie->id_lang)).'.gif';
} }
public function hookOrderConfirmation($params) public function hookOrderConfirmation($params)
+1 -2
View File
@@ -45,7 +45,6 @@ class TrustedShops extends Module
public function __construct() public function __construct()
{ {
global $smarty;
$this->name = 'trustedshops'; $this->name = 'trustedshops';
$this->tab = 'payment_security'; $this->tab = 'payment_security';
$this->version = 1.3; $this->version = 1.3;
@@ -60,7 +59,7 @@ class TrustedShops extends Module
$obj_ts_buyerprotection->_setEnvApi(TSBuyerProtection::ENV_PROD); $obj_ts_buyerprotection->_setEnvApi(TSBuyerProtection::ENV_PROD);
self::$objects_list = array($obj_ts_rating, $obj_ts_buyerprotection); self::$objects_list = array($obj_ts_rating, $obj_ts_buyerprotection);
self::$objects_list[0]->setModuleName($this->name); self::$objects_list[0]->setModuleName($this->name);
self::$objects_list[0]->setSmarty($smarty); self::$objects_list[0]->setSmarty($this->context->smarty);
} }
if (!extension_loaded('soap')) if (!extension_loaded('soap'))
+7 -19
View File
@@ -184,15 +184,13 @@ class Twenga extends PaymentModule
private function _initCurrentIsoCodeCountry() private function _initCurrentIsoCodeCountry()
{ {
global $cookie;
$country = Db::getInstance()->ExecuteS(' $country = Db::getInstance()->ExecuteS('
SELECT c.iso_code as iso SELECT c.iso_code as iso
FROM '._DB_PREFIX_.'country as c FROM '._DB_PREFIX_.'country as c
LEFT JOIN '._DB_PREFIX_.'country_lang as c_l LEFT JOIN '._DB_PREFIX_.'country_lang as c_l
ON c_l.id_country = c.id_country ON c_l.id_country = c.id_country
WHERE c_l.id_lang = '.$cookie->id_lang.' WHERE c_l.id_lang = '.(int)$this->context->language->id.'
AND c.id_country = '. Configuration::get('PS_COUNTRY_DEFAULT')); AND c.id_country = '.(int)Configuration::get('PS_COUNTRY_DEFAULT'));
if (isset($country[0]['iso'])) if (isset($country[0]['iso']))
$this->_currentIsoCodeCountry = $country[0]['iso']; $this->_currentIsoCodeCountry = $country[0]['iso'];
@@ -251,13 +249,11 @@ class Twenga extends PaymentModule
*/ */
private function _getAjaxScript($file, $type, $href, $displayMsg = true) private function _getAjaxScript($file, $type, $href, $displayMsg = true)
{ {
global $cookie;
return ' return '
$.ajax({ $.ajax({
type: \'POST\', type: \'POST\',
url: \''._MODULE_DIR_.'twenga/'.$file.'\', url: \''._MODULE_DIR_.'twenga/'.$file.'\',
data: \'type='.$type.'&base='.$href.'&twenga_token='.sha1(Configuration::get('TWENGA_TOKEN')._COOKIE_KEY_).'&id_lang='.(int)$cookie->id_lang.'\', data: \'type='.$type.'&base='.$href.'&twenga_token='.sha1(Configuration::get('TWENGA_TOKEN')._COOKIE_KEY_).'&id_lang='.(int)$this->context->language->id.'\',
success: function(msg) { success: function(msg) {
'.(($displayMsg) ? ' '.(($displayMsg) ? '
$.fancybox(msg, { $.fancybox(msg, {
@@ -527,9 +523,7 @@ class Twenga extends PaymentModule
*/ */
public static function getCurrentCountryName() public static function getCurrentCountryName()
{ {
global $cookie; $id_lang = ((isset(Context::getContext()->language->id)) ? Context::getContext()->language->id :
$id_lang = ((isset($cookie->id_lang)) ? $cookie->id_lang :
((isset($_POST['id_lang'])) ? $_POST['id_lang'] : NULL)); ((isset($_POST['id_lang'])) ? $_POST['id_lang'] : NULL));
if ($id_lang === NULL) if ($id_lang === NULL)
@@ -550,8 +544,6 @@ class Twenga extends PaymentModule
*/ */
private function _checkCurrentCountrie() private function _checkCurrentCountrie()
{ {
global $cookie;
if (!in_array(strtolower($this->_currentIsoCodeCountry), $this->limited_countries)) if (!in_array(strtolower($this->_currentIsoCodeCountry), $this->limited_countries))
{ {
$query = ' $query = '
@@ -559,7 +551,7 @@ class Twenga extends PaymentModule
FROM '._DB_PREFIX_.'country_lang as c_l FROM '._DB_PREFIX_.'country_lang as c_l
LEFT JOIN '._DB_PREFIX_.'country as c LEFT JOIN '._DB_PREFIX_.'country as c
ON c_l.id_country = c.id_country ON c_l.id_country = c.id_country
WHERE c_l.id_lang = '.$cookie->id_lang.' WHERE c_l.id_lang = '.(int)$this->context->language->id.'
AND c.iso_code IN ('; AND c.iso_code IN (';
foreach($this->limited_countries as $iso) foreach($this->limited_countries as $iso)
$query .= "'".strtoupper($iso)."', "; $query .= "'".strtoupper($iso)."', ";
@@ -652,9 +644,7 @@ class Twenga extends PaymentModule
else else
$tarifs_link = 'https://rts.twenga.com/media/prices_'.$defaultIsoCountry.'.jpg'; $tarifs_link = 'https://rts.twenga.com/media/prices_'.$defaultIsoCountry.'.jpg';
global $cookie; $isoUser = strtolower($this->context->language->iso_code);
$isoUser = strtolower(Language::getIsoById(intval($cookie->id_lang)));
$tarif_arr = array(950, 565); $tarif_arr = array(950, 565);
if (file_exists($tarifs_link)) if (file_exists($tarifs_link))
@@ -711,9 +701,7 @@ class Twenga extends PaymentModule
*/ */
private function displayTwengaLogin() private function displayTwengaLogin()
{ {
global $cookie; $isoUser = strtolower($this->context->language->id);
$isoUser = strtolower(Language::getIsoById(intval($cookie->id_lang)));
if ($isoUser == 'en') if ($isoUser == 'en')
$lost_link = 'https://rts.twenga.co.uk/lost_password'; $lost_link = 'https://rts.twenga.co.uk/lost_password';
else else
+5 -12
View File
@@ -426,7 +426,6 @@ class UpsCarrier extends CarrierModule
private function _displayFormGeneral() private function _displayFormGeneral()
{ {
global $cookie;
$configCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); $configCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
$html = '<script> $html = '<script>
@@ -511,7 +510,7 @@ class UpsCarrier extends CarrierModule
<select name="ups_carrier_country" id="ups_carrier_country"> <select name="ups_carrier_country" id="ups_carrier_country">
<option value="0">'.$this->l('Select a country ...').'</option>'; <option value="0">'.$this->l('Select a country ...').'</option>';
$idcountries = array(); $idcountries = array();
foreach (Country::getCountries($cookie->id_lang) as $v) foreach (Country::getCountries($this->context->language->id) as $v)
{ {
$html .= '<option value="'.$v['id_country'].'" '.($v['id_country'] == (int)(Tools::getValue('ups_carrier_country', Configuration::get('UPS_CARRIER_COUNTRY'))) ? 'selected="selected"' : '').'>'.$v['name'].'</option>'; $html .= '<option value="'.$v['id_country'].'" '.($v['id_country'] == (int)(Tools::getValue('ups_carrier_country', Configuration::get('UPS_CARRIER_COUNTRY'))) ? 'selected="selected"' : '').'>'.$v['name'].'</option>';
$idcountries[] = $v['id_country']; $idcountries[] = $v['id_country'];
@@ -732,8 +731,6 @@ class UpsCarrier extends CarrierModule
private function _getPathInTab($id_category) private function _getPathInTab($id_category)
{ {
global $cookie;
$category = Db::getInstance()->getRow(' $category = Db::getInstance()->getRow('
SELECT id_category, level_depth, nleft, nright SELECT id_category, level_depth, nleft, nright
FROM '._DB_PREFIX_.'category FROM '._DB_PREFIX_.'category
@@ -745,7 +742,7 @@ class UpsCarrier extends CarrierModule
SELECT c.id_category, cl.name, cl.link_rewrite SELECT c.id_category, cl.name, cl.link_rewrite
FROM '._DB_PREFIX_.'category c FROM '._DB_PREFIX_.'category c
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category) LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category)
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)($cookie->id_lang).' WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)$this->context->language->id.'
ORDER BY c.level_depth ASC ORDER BY c.level_depth ASC
LIMIT '.(int)($category['level_depth'] + 1)); LIMIT '.(int)($category['level_depth'] + 1));
@@ -790,8 +787,6 @@ class UpsCarrier extends CarrierModule
private function _displayFormCategory() private function _displayFormCategory()
{ {
global $cookie;
// Check if the module is configured // Check if the module is configured
if (!Configuration::get('UPS_CARRIER_RATE_SERVICE_GROUP')) if (!Configuration::get('UPS_CARRIER_RATE_SERVICE_GROUP'))
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />'; return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
@@ -917,7 +912,7 @@ class UpsCarrier extends CarrierModule
<div class="margin-form"> <div class="margin-form">
<select name="id_category"> <select name="id_category">
<option value="0">'.$this->l('Select a category ...').'</option> <option value="0">'.$this->l('Select a category ...').'</option>
'.$this->_getChildCategories(Category::getCategories($cookie->id_lang), 0).' '.$this->_getChildCategories(Category::getCategories($this->context->language->id), 0).'
</select> </select>
</div> </div>
<label>'.$this->l('Packaging Type').' : </label> <label>'.$this->l('Packaging Type').' : </label>
@@ -1049,8 +1044,6 @@ class UpsCarrier extends CarrierModule
private function _displayFormProduct() private function _displayFormProduct()
{ {
global $cookie;
// Check if the module is configured // Check if the module is configured
if (!Configuration::get('UPS_CARRIER_RATE_SERVICE_GROUP')) if (!Configuration::get('UPS_CARRIER_RATE_SERVICE_GROUP'))
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />'; return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
@@ -1077,7 +1070,7 @@ class UpsCarrier extends CarrierModule
foreach ($configProductList as $k => $c) foreach ($configProductList as $k => $c)
{ {
// Loading Product // Loading Product
$product = new Product((int)$c['id_product'], false, (int)$cookie->id_lang); $product = new Product((int)$c['id_product'], false, (int)$this->context->language->id);
// Loading config currency // Loading config currency
$configCurrency = new Currency($c['id_currency']); $configCurrency = new Currency($c['id_currency']);
@@ -1124,7 +1117,7 @@ class UpsCarrier extends CarrierModule
{ {
// Loading config // Loading config
$configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'ups_rate_config` WHERE `id_ups_rate_config` = '.(int)(Tools::getValue('id_ups_rate_config'))); $configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'ups_rate_config` WHERE `id_ups_rate_config` = '.(int)(Tools::getValue('id_ups_rate_config')));
$product = new Product((int)$configSelected['id_product'], false, (int)$cookie->id_lang); $product = new Product((int)$configSelected['id_product'], false, $this->context->language->id);
$html .= '<p align="center"><b>'.$this->l('Update a rule').' (<a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=add">'.$this->l('Add a rule').' ?</a>)</b></p> $html .= '<p align="center"><b>'.$this->l('Update a rule').' (<a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=add">'.$this->l('Add a rule').' ?</a>)</b></p>
<form action="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=edit&id_ups_rate_config='.(int)(Tools::getValue('id_ups_rate_config')).'" method="post" class="form"> <form action="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=edit&id_ups_rate_config='.(int)(Tools::getValue('id_ups_rate_config')).'" method="post" class="form">
+6 -13
View File
@@ -410,7 +410,6 @@ class UspsCarrier extends CarrierModule
private function _displayFormGeneral() private function _displayFormGeneral()
{ {
global $cookie;
$configCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); $configCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
$html = '<script> $html = '<script>
@@ -488,7 +487,7 @@ class UspsCarrier extends CarrierModule
<select name="usps_carrier_country" id="usps_carrier_country"> <select name="usps_carrier_country" id="usps_carrier_country">
<option value="0">'.$this->l('Select a country ...').'</option>'; <option value="0">'.$this->l('Select a country ...').'</option>';
$idcountries = array(); $idcountries = array();
foreach (Country::getCountries($cookie->id_lang) as $v) foreach (Country::getCountries($this->context->language->id) as $v)
{ {
$html .= '<option value="'.$v['id_country'].'" '.($v['id_country'] == (int)(Tools::getValue('usps_carrier_country', Configuration::get('USPS_CARRIER_COUNTRY'))) ? 'selected="selected"' : '').'>'.$v['name'].'</option>'; $html .= '<option value="'.$v['id_country'].'" '.($v['id_country'] == (int)(Tools::getValue('usps_carrier_country', Configuration::get('USPS_CARRIER_COUNTRY'))) ? 'selected="selected"' : '').'>'.$v['name'].'</option>';
$idcountries[] = $v['id_country']; $idcountries[] = $v['id_country'];
@@ -679,8 +678,6 @@ class UspsCarrier extends CarrierModule
private function _getPathInTab($id_category) private function _getPathInTab($id_category)
{ {
global $cookie;
$category = Db::getInstance()->getRow(' $category = Db::getInstance()->getRow('
SELECT id_category, level_depth, nleft, nright SELECT id_category, level_depth, nleft, nright
FROM '._DB_PREFIX_.'category FROM '._DB_PREFIX_.'category
@@ -692,7 +689,7 @@ class UspsCarrier extends CarrierModule
SELECT c.id_category, cl.name, cl.link_rewrite SELECT c.id_category, cl.name, cl.link_rewrite
FROM '._DB_PREFIX_.'category c FROM '._DB_PREFIX_.'category c
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category) LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category)
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)($cookie->id_lang).' WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)($this->context->language->id).'
ORDER BY c.level_depth ASC ORDER BY c.level_depth ASC
LIMIT '.(int)($category['level_depth'] + 1)); LIMIT '.(int)($category['level_depth'] + 1));
@@ -737,8 +734,6 @@ class UspsCarrier extends CarrierModule
private function _displayFormCategory() private function _displayFormCategory()
{ {
global $cookie;
// Check if the module is configured // Check if the module is configured
if (!$this->_webserviceTestResult) if (!$this->_webserviceTestResult)
return '<p><b>'.$this->l('You must configure "General Settings" before using this tab.').'</b></p><br />'; return '<p><b>'.$this->l('You must configure "General Settings" before using this tab.').'</b></p><br />';
@@ -883,7 +878,7 @@ class UspsCarrier extends CarrierModule
<div class="margin-form"> <div class="margin-form">
<select name="id_category"> <select name="id_category">
<option value="0">'.$this->l('Select a category ...').'</option> <option value="0">'.$this->l('Select a category ...').'</option>
'.$this->_getChildCategories(Category::getCategories($cookie->id_lang), 0).' '.$this->_getChildCategories(Category::getCategories($this->context->language->id), 0).'
</select> </select>
</div> </div>
<label>'.$this->l('Packaging Type').' : </label> <label>'.$this->l('Packaging Type').' : </label>
@@ -1035,8 +1030,6 @@ class UspsCarrier extends CarrierModule
private function _displayFormProduct() private function _displayFormProduct()
{ {
global $cookie;
// Check if the module is configured // Check if the module is configured
if (!$this->_webserviceTestResult) if (!$this->_webserviceTestResult)
return '<p><b>'.$this->l('You must configure "General Settings" before using this tab.').'</b></p><br />'; return '<p><b>'.$this->l('You must configure "General Settings" before using this tab.').'</b></p><br />';
@@ -1065,7 +1058,7 @@ class UspsCarrier extends CarrierModule
foreach ($configProductList as $k => $c) foreach ($configProductList as $k => $c)
{ {
// Loading Product // Loading Product
$product = new Product((int)$c['id_product'], false, (int)$cookie->id_lang); $product = new Product((int)$c['id_product'], false, (int)$this->context->language->id);
// Loading config currency // Loading config currency
$configCurrency = new Currency($c['id_currency']); $configCurrency = new Currency($c['id_currency']);
@@ -1113,7 +1106,7 @@ class UspsCarrier extends CarrierModule
{ {
// Loading config // Loading config
$configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'usps_rate_config` WHERE `id_usps_rate_config` = '.(int)(Tools::getValue('id_usps_rate_config'))); $configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'usps_rate_config` WHERE `id_usps_rate_config` = '.(int)(Tools::getValue('id_usps_rate_config')));
$product = new Product((int)$configSelected['id_product'], false, (int)$cookie->id_lang); $product = new Product((int)$configSelected['id_product'], false, (int)$this->context->language->id);
$html .= '<p align="center"><b>'.$this->l('Update a rule').' (<a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=add">'.$this->l('Add a rule').' ?</a>)</b></p> $html .= '<p align="center"><b>'.$this->l('Update a rule').' (<a href="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=add">'.$this->l('Add a rule').' ?</a>)</b></p>
<form action="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=edit&id_usps_rate_config='.(int)(Tools::getValue('id_usps_rate_config')).'" method="post" class="form"> <form action="index.php?tab='.Tools::getValue('tab').'&configure='.Tools::getValue('configure').'&token='.Tools::getValue('token').'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name').'&id_tab=3&section=product&action=edit&id_usps_rate_config='.(int)(Tools::getValue('id_usps_rate_config')).'" method="post" class="form">
@@ -1169,7 +1162,7 @@ class UspsCarrier extends CarrierModule
<option value="0">'.$this->l('Select a product ...').'</option>'; <option value="0">'.$this->l('Select a product ...').'</option>';
$productsList = Db::getInstance()->ExecuteS(' $productsList = Db::getInstance()->ExecuteS('
SELECT pl.* FROM `'._DB_PREFIX_.'product` p SELECT pl.* FROM `'._DB_PREFIX_.'product` p
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)$this->context->language->id.')
WHERE p.`active` = 1 WHERE p.`active` = 1
ORDER BY pl.`name`'); ORDER BY pl.`name`');
foreach ($productsList as $product) foreach ($productsList as $product)
+1 -3
View File
@@ -147,8 +147,6 @@ class VatNumber extends Module
public function getContent() public function getContent()
{ {
global $cookie;
$echo = ''; $echo = '';
if (Tools::isSubmit('submitVatNumber')) if (Tools::isSubmit('submitVatNumber'))
@@ -166,7 +164,7 @@ class VatNumber extends Module
<div class="margin-form"> <div class="margin-form">
<select name="vatnumber_country"> <select name="vatnumber_country">
<option value="0">'.$this->l('-- Choose a country --').'</option>'; <option value="0">'.$this->l('-- Choose a country --').'</option>';
foreach (Country::getCountries((int)($cookie->id_lang)) as $country) foreach (Country::getCountries($this->context->language->id) as $country)
$echo .= ' <option value="'.$country['id_country'].'" '.(Tools::getValue('VATNUMBER_COUNTRY', Configuration::get('VATNUMBER_COUNTRY')) == $country['id_country'] ? 'selected="selected"' : '').'>'.$country['name'].'</option>'; $echo .= ' <option value="'.$country['id_country'].'" '.(Tools::getValue('VATNUMBER_COUNTRY', Configuration::get('VATNUMBER_COUNTRY')) == $country['id_country'] ? 'selected="selected"' : '').'>'.$country['name'].'</option>';
$echo .= ' </select> $echo .= ' </select>
</div> </div>
-1
View File
@@ -226,7 +226,6 @@ class Watermark extends Module
//we assume here only jpg files //we assume here only jpg files
public function hookwatermark($params) public function hookwatermark($params)
{ {
global $smarty;
$image = new Image($params['id_image']); $image = new Image($params['id_image']);
$image->id_product = $params['id_product']; $image->id_product = $params['id_product'];
$file = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'-watermark.jpg'; $file = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'-watermark.jpg';
+1 -2
View File
@@ -86,11 +86,10 @@ class Tools extends ToolsCore
{ {
if (!preg_match('@^https?://@i', $url)) if (!preg_match('@^https?://@i', $url))
{ {
global $link;
if (strpos($url, __PS_BASE_URI__) !== FALSE && strpos($url, __PS_BASE_URI__) == 0) if (strpos($url, __PS_BASE_URI__) !== FALSE && strpos($url, __PS_BASE_URI__) == 0)
$url = substr($url, strlen(__PS_BASE_URI__)); $url = substr($url, strlen(__PS_BASE_URI__));
$explode = explode('?', $url); $explode = explode('?', $url);
$url = $link->getPageLink($explode[0]); $url = Context::getContext()->link->getPageLink($explode[0]);
if (isset($explode[1])) if (isset($explode[1]))
$url .= '?'.$explode[1]; $url .= '?'.$explode[1];
} }