// Context part 27
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7812 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -169,9 +169,8 @@ class BankWire extends PaymentModule
|
||||
if (!$this->_checkCurrency($cart))
|
||||
Tools::redirect('index.php?controller=order');
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'nbProducts' => $cart->nbProducts(),
|
||||
'cust_currency' => $cart->id_currency,
|
||||
'currencies' => $this->getCurrency((int)$cart->id_currency),
|
||||
@@ -190,9 +189,8 @@ class BankWire extends PaymentModule
|
||||
if (!$this->_checkCurrency($params['cart']))
|
||||
return ;
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'this_path' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
|
||||
));
|
||||
@@ -204,10 +202,9 @@ class BankWire extends PaymentModule
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
$context = Context::getContext();
|
||||
$state = $params['objOrder']->getCurrentState();
|
||||
if ($state == Configuration::get('PS_OS_BANKWIRE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK'))
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
|
||||
'bankwireDetails' => Tools::nl2br($this->details),
|
||||
'bankwireAddress' => Tools::nl2br($this->address),
|
||||
@@ -216,7 +213,7 @@ class BankWire extends PaymentModule
|
||||
'id_order' => $params['objOrder']->id
|
||||
));
|
||||
else
|
||||
$context->smarty->assign('status', 'failed');
|
||||
$this->context->smarty->assign('status', 'failed');
|
||||
return $this->display(__FILE__, 'payment_return.tpl');
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,6 @@ class BlockAdvertising extends Module
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$this->postProcess();
|
||||
$output = '';
|
||||
@@ -175,7 +174,7 @@ class BlockAdvertising extends Module
|
||||
<a href="'.$this->adv_link.'" target="_blank" title="'.$this->adv_title.'">';
|
||||
if ($this->adv_img)
|
||||
{
|
||||
$output .= '<img src="'.$context->link->protocol_content.$this->adv_img.'" alt="'.$this->adv_title.'" title="'.$this->adv_title.'" style="height:163px;margin-left: 100px;width:163px"/>';
|
||||
$output .= '<img src="'.$this->context->link->protocol_content.$this->adv_img.'" alt="'.$this->adv_title.'" title="'.$this->adv_title.'" style="height:163px;margin-left: 100px;width:163px"/>';
|
||||
$output .= '<input class="button" type="submit" name="submitDeleteImgConf" value="'.$this->l('Delete image').'" style=""/>';
|
||||
}
|
||||
else
|
||||
@@ -208,11 +207,10 @@ class BlockAdvertising extends Module
|
||||
*/
|
||||
function hookRightColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS($this->_path.'blockadvertising.css', 'all');
|
||||
$context->smarty->assign('image', $context->link->protocol_content.$this->adv_img);
|
||||
$context->smarty->assign('adv_link', $this->adv_link);
|
||||
$context->smarty->assign('adv_title', $this->adv_title);
|
||||
$this->context->controller->addCSS($this->_path.'blockadvertising.css', 'all');
|
||||
$this->context->smarty->assign('image', $this->context->link->protocol_content.$this->adv_img);
|
||||
$this->context->smarty->assign('adv_link', $this->adv_link);
|
||||
$this->context->smarty->assign('adv_title', $this->adv_title);
|
||||
|
||||
return $this->display(__FILE__, 'blockadvertising.tpl');
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@ class BlockBestSellers extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
|
||||
$context = Context::getContext();
|
||||
$currency = new Currency((int)($params['cookie']->id_currency));
|
||||
$bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 5);
|
||||
if (!$bestsellers AND !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY'))
|
||||
@@ -113,7 +112,7 @@ class BlockBestSellers extends Module
|
||||
$best_sellers[] = $bestseller;
|
||||
}
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'best_sellers' => $best_sellers,
|
||||
'mediumSize' => Image::getSize('medium'),
|
||||
));
|
||||
@@ -129,8 +128,7 @@ class BlockBestSellers extends Module
|
||||
{
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blockbestsellers.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blockbestsellers.css', 'all');
|
||||
}
|
||||
|
||||
public function hookHome($params)
|
||||
@@ -138,7 +136,6 @@ class BlockBestSellers extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
$currency = new Currency((int)($params['cookie']->id_currency));
|
||||
$bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 4);
|
||||
if (!$bestsellers AND !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY'))
|
||||
@@ -152,7 +149,7 @@ class BlockBestSellers extends Module
|
||||
$best_sellers[] = $bestseller;
|
||||
}
|
||||
|
||||
$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'best_sellers' => $best_sellers,
|
||||
'homeSize' => Image::getSize('home')));
|
||||
return $this->display(__FILE__, 'blockbestsellers-home.tpl');
|
||||
|
||||
@@ -47,7 +47,6 @@ class BlockCart extends Module
|
||||
public function smartyAssigns(&$smarty, &$params)
|
||||
{
|
||||
global $errors;
|
||||
$context = Context::getContext();
|
||||
|
||||
// Set currency
|
||||
if (!(int)($params['cart']->id_currency))
|
||||
@@ -100,8 +99,8 @@ class BlockCart extends Module
|
||||
));
|
||||
if (sizeof($errors))
|
||||
$smarty->assign('errors', $errors);
|
||||
if(isset($context->cookie->ajax_blockcart_display))
|
||||
$smarty->assign('colapseExpandStatus', $context->cookie->ajax_blockcart_display);
|
||||
if(isset($this->context->cookie->ajax_blockcart_display))
|
||||
$smarty->assign('colapseExpandStatus', $this->context->cookie->ajax_blockcart_display);
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
@@ -160,9 +159,8 @@ class BlockCart extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return;
|
||||
|
||||
$context = Context::getContext();
|
||||
$context->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false);
|
||||
$this->smartyAssigns($context->smarty, $params);
|
||||
$this->context->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false);
|
||||
$this->smartyAssigns($this->context->smarty, $params);
|
||||
return $this->display(__FILE__, 'blockcart.tpl');
|
||||
}
|
||||
|
||||
@@ -176,8 +174,7 @@ class BlockCart extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return;
|
||||
|
||||
$context = Context::getContext();
|
||||
$this->smartyAssigns($context->smarty, $params);
|
||||
$this->smartyAssigns($this->context->smarty, $params);
|
||||
$res = $this->display(__FILE__, 'blockcart-json.tpl');
|
||||
return $res;
|
||||
}
|
||||
@@ -186,10 +183,9 @@ class BlockCart extends Module
|
||||
{
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return;
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blockcart.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blockcart.css', 'all');
|
||||
if ((int)(Configuration::get('PS_BLOCK_CART_AJAX')))
|
||||
$context->controller->addJS(($this->_path).'ajax-cart.js');
|
||||
$this->context->controller->addJS(($this->_path).'ajax-cart.js');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,8 +138,7 @@ class BlockCategories extends Module
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_current_shop = $context->shop->getID();
|
||||
$id_current_shop = $this->context->shop->getID();
|
||||
|
||||
$id_customer = (int)($params['cookie']->id_customer);
|
||||
// Get all groups for this customer and concatenate them as a string: "1,2,3..."
|
||||
@@ -182,34 +181,34 @@ class BlockCategories extends Module
|
||||
unset($resultIds);
|
||||
//TODO clean that
|
||||
$res = $blockCategTree;
|
||||
$shopcurrentroot = $context->shop->getCategory();
|
||||
$shopcurrentroot = $this->context->shop->getCategory();
|
||||
if ($blockCategTree['id'] != $shopcurrentroot)
|
||||
$blockCategTree = $this->cleanTree($blockCategTree['children']);
|
||||
$isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false);
|
||||
if (Tools::isSubmit('id_category'))
|
||||
{
|
||||
$context->cookie->last_visited_category = $id_category;
|
||||
$context->smarty->assign('currentCategoryId', $context->cookie->last_visited_category);
|
||||
$this->context->cookie->last_visited_category = $id_category;
|
||||
$this->context->smarty->assign('currentCategoryId', $this->context->cookie->last_visited_category);
|
||||
}
|
||||
if (Tools::isSubmit('id_product'))
|
||||
{
|
||||
if (!isset($context->cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $context->cookie->last_visited_category))))
|
||||
if (!isset($this->context->cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $this->context->cookie->last_visited_category))))
|
||||
{
|
||||
$product = new Product($id_product);
|
||||
if (isset($product) AND Validate::isLoadedObject($product))
|
||||
$context->cookie->last_visited_category = (int)($product->id_category_default);
|
||||
$this->context->cookie->last_visited_category = (int)($product->id_category_default);
|
||||
}
|
||||
$context->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category));
|
||||
$this->context->smarty->assign('currentCategoryId', (int)($this->context->cookie->last_visited_category));
|
||||
}
|
||||
$context->smarty->assign('blockCategTree', $blockCategTree);
|
||||
$this->context->smarty->assign('blockCategTree', $blockCategTree);
|
||||
|
||||
if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories.tpl'))
|
||||
$context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl');
|
||||
$this->context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl');
|
||||
else
|
||||
$context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
|
||||
$context->smarty->assign('isDhtml', $isDhtml);
|
||||
$this->context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
|
||||
$this->context->smarty->assign('isDhtml', $isDhtml);
|
||||
}
|
||||
$context->smarty->cache_lifetime = 31536000; // 1 Year
|
||||
$this->context->smarty->cache_lifetime = 31536000; // 1 Year
|
||||
$display = $this->display(__FILE__, 'blockcategories.tpl', $smartyCacheId);
|
||||
Tools::restoreCacheSettings();
|
||||
return $display;
|
||||
@@ -217,8 +216,8 @@ class BlockCategories extends Module
|
||||
|
||||
public function hookFooter($params)
|
||||
{
|
||||
$context = $this->context;
|
||||
$id_current_shop = $context->shop->getID();
|
||||
$this->context = $this->context;
|
||||
$id_current_shop = $this->context->shop->getID();
|
||||
|
||||
$id_customer = (int)($params['cookie']->id_customer);
|
||||
// Get all groups for this customer and concatenate them as a string: "1,2,3..."
|
||||
@@ -257,43 +256,43 @@ class BlockCategories extends Module
|
||||
$nbrColumns=3;
|
||||
$numberColumn = abs(sizeof($result)/$nbrColumns);
|
||||
$widthColumn= floor(100/$nbrColumns);
|
||||
$context->smarty->assign('numberColumn', $numberColumn);
|
||||
$context->smarty->assign('widthColumn', $widthColumn);
|
||||
$this->context->smarty->assign('numberColumn', $numberColumn);
|
||||
$this->context->smarty->assign('widthColumn', $widthColumn);
|
||||
|
||||
$blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH'));
|
||||
unset($resultParents);
|
||||
unset($resultIds);
|
||||
//TODO clean that
|
||||
$res = $blockCategTree;
|
||||
if($blockCategTree['id'] != $context->shop->getCategory())
|
||||
if($blockCategTree['id'] != $this->context->shop->getCategory())
|
||||
$blockCategTree = $this->cleanTree($blockCategTree['children']);
|
||||
$isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false);
|
||||
$isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false);
|
||||
|
||||
if (Tools::isSubmit('id_category'))
|
||||
{
|
||||
$context->cookie->last_visited_category = $id_category;
|
||||
$context->smarty->assign('currentCategoryId', $context->cookie->last_visited_category);
|
||||
$this->context->cookie->last_visited_category = $id_category;
|
||||
$this->context->smarty->assign('currentCategoryId', $this->context->cookie->last_visited_category);
|
||||
}
|
||||
if (Tools::isSubmit('id_product'))
|
||||
{
|
||||
if (!isset($context->cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $context->cookie->last_visited_category))))
|
||||
if (!isset($this->context->cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $this->context->cookie->last_visited_category))))
|
||||
{
|
||||
$product = new Product($id_product);
|
||||
if (isset($product) AND Validate::isLoadedObject($product))
|
||||
$context->cookie->last_visited_category = (int)($product->id_category_default);
|
||||
$this->context->cookie->last_visited_category = (int)($product->id_category_default);
|
||||
}
|
||||
$context->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category));
|
||||
$this->context->smarty->assign('currentCategoryId', (int)($this->context->cookie->last_visited_category));
|
||||
}
|
||||
$context->smarty->assign('blockCategTree', $blockCategTree);
|
||||
$this->context->smarty->assign('blockCategTree', $blockCategTree);
|
||||
|
||||
if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories_footer.tpl'))
|
||||
$context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl');
|
||||
$this->context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl');
|
||||
else
|
||||
$context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
|
||||
$context->smarty->assign('isDhtml', $isDhtml);
|
||||
$this->context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl');
|
||||
$this->context->smarty->assign('isDhtml', $isDhtml);
|
||||
}
|
||||
$context->smarty->cache_lifetime = 31536000; // 1 Year
|
||||
$this->context->smarty->cache_lifetime = 31536000; // 1 Year
|
||||
$display = $this->display(__FILE__, 'blockcategories_footer.tpl', $smartyCacheId);
|
||||
Tools::restoreCacheSettings();
|
||||
return $display;
|
||||
|
||||
@@ -117,14 +117,13 @@ class BlockCms extends Module
|
||||
|
||||
private function getBlocksCMS($location)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
return Db::getInstance()->ExecuteS('
|
||||
SELECT bc.`id_cms_block`, bcl.`name` block_name, ccl.`name` category_name, bc.`position`, bc.`id_cms_category`, bc.`display_store`
|
||||
FROM `'._DB_PREFIX_.'cms_block` bc
|
||||
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl ON (bc.`id_cms_category` = ccl.`id_cms_category`)
|
||||
INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl ON (bc.`id_cms_block` = bcl.`id_cms_block`)
|
||||
WHERE ccl.`id_lang` = '.(int)$context->language->id.' AND bc.`location` = '.(int)$location.' AND bcl.`id_lang` = '.(int)$context->language->id.'
|
||||
WHERE ccl.`id_lang` = '.(int)$this->context->language->id.' AND bc.`location` = '.(int)$location.' AND bcl.`id_lang` = '.(int)$this->context->language->id.'
|
||||
ORDER BY bc.`position`');
|
||||
}
|
||||
|
||||
@@ -133,10 +132,9 @@ class BlockCms extends Module
|
||||
return array_merge($this->getBlocksCMS(self::LEFT_COLUMN), $this->getBlocksCMS(self::RIGHT_COLUMN));
|
||||
}
|
||||
|
||||
static public function getCMStitlesFooter($context = null)
|
||||
static public function getCMStitlesFooter()
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
$context = Context::getContext();
|
||||
|
||||
$footerCms = Configuration::get('FOOTER_CMS');
|
||||
if (empty($footerCms))
|
||||
@@ -176,10 +174,9 @@ class BlockCms extends Module
|
||||
return $content;
|
||||
}
|
||||
|
||||
static public function getCMStitles($location, $context = null)
|
||||
static public function getCMStitles($location)
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
$context = Context::getContext();
|
||||
|
||||
$cmsCategories = Db::getInstance()->ExecuteS('
|
||||
SELECT bc.`id_cms_block`, bc.`id_cms_category`, bc.`display_store`, ccl.`link_rewrite`, ccl.`name` category_name, bcl.`name` block_name
|
||||
@@ -301,7 +298,7 @@ class BlockCms extends Module
|
||||
|
||||
private function _displayForm()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$this->context = Context::getContext();
|
||||
$cms_blocks_left = $this->getBlocksCMS(0);
|
||||
$cms_blocks_right = $this->getBlocksCMS(1);
|
||||
|
||||
@@ -412,7 +409,7 @@ class BlockCms extends Module
|
||||
<th width="3%">'.$this->l('ID').'</th>
|
||||
<th width="94%">'.$this->l('Name').'</th>
|
||||
</tr>';
|
||||
$this->displayRecurseCheckboxes(CMSCategory::getRecurseCategory($context->language->id), explode('|', Configuration::get('FOOTER_CMS')));
|
||||
$this->displayRecurseCheckboxes(CMSCategory::getRecurseCategory($this->context->language->id), explode('|', Configuration::get('FOOTER_CMS')));
|
||||
$this->_html .= '
|
||||
</table>
|
||||
<p class="center"><input type="submit" class="button" name="submitFooterCMS" value="'.$this->l('Save').'" /></p>
|
||||
@@ -422,7 +419,6 @@ class BlockCms extends Module
|
||||
|
||||
private function _displayAddForm()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$defaultLanguage = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
$languages = Language::getLanguages(false);
|
||||
$divLangName = 'name';
|
||||
@@ -461,7 +457,7 @@ class BlockCms extends Module
|
||||
<label for="id_category">'.$this->l('Choose a CMS category:').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="id_category" id="id_category" onchange="CMSCategory_js($(this).val(), \''.$this->secure_key.'\')">';
|
||||
$categories = CMSCategory::getCategories($context->language->id, false);
|
||||
$categories = CMSCategory::getCategories($this->context->language->id, false);
|
||||
$this->_html .= CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, ($cmsBlock != NULL ? $cmsBlock[0]['id_cms_category'] : 1), 1);
|
||||
$this->_html .= '
|
||||
</select>
|
||||
@@ -705,9 +701,9 @@ class BlockCms extends Module
|
||||
|
||||
public function hookLeftColumn()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$this->context = Context::getContext();
|
||||
$cms_titles = self::getCMStitles(self::LEFT_COLUMN);
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'block' => 1,
|
||||
'cms_titles' => $cms_titles,
|
||||
'theme_dir' => _PS_THEME_DIR_
|
||||
@@ -717,10 +713,9 @@ class BlockCms extends Module
|
||||
|
||||
public function hookRightColumn()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$cms_titles = self::getCMStitles(self::RIGHT_COLUMN);
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'block' => 1,
|
||||
'cms_titles' => $cms_titles,
|
||||
'theme_dir' => _PS_THEME_DIR_
|
||||
@@ -730,12 +725,11 @@ class BlockCms extends Module
|
||||
|
||||
public function hookFooter()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
if (Configuration::get('FOOTER_BLOCK_ACTIVATION'))
|
||||
{
|
||||
$cms_titles = self::getCMStitlesFooter();
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'block' => 0,
|
||||
'cmslinks' => $cms_titles,
|
||||
'theme_dir' => _PS_THEME_DIR_,
|
||||
@@ -749,8 +743,7 @@ class BlockCms extends Module
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blockcms.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blockcms.css', 'all');
|
||||
}
|
||||
|
||||
public function getL($key)
|
||||
|
||||
@@ -54,10 +54,9 @@ class blockcustomerprivacy extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = Language::getLanguages(false);
|
||||
$iso = $context->language->iso_code;
|
||||
$iso = $this->context->language->iso_code;
|
||||
|
||||
if (Tools::isSubmit('submitCustPrivMess'))
|
||||
{
|
||||
@@ -151,10 +150,9 @@ class blockcustomerprivacy extends Module
|
||||
{
|
||||
if (!$this->active)
|
||||
return ;
|
||||
$context = Context::getContext();
|
||||
|
||||
$context->smarty->assign(array(
|
||||
'privacy_message' => Configuration::get('CUSTPRIV_MESSAGE', $context->language->id),
|
||||
$this->context->smarty->assign(array(
|
||||
'privacy_message' => Configuration::get('CUSTPRIV_MESSAGE', $this->context->language->id),
|
||||
'error_message' => $this->l('Please agree with the customer data privacy by ticking the checkbox below.')
|
||||
));
|
||||
return $this->display(__FILE__, 'blockcustomerprivacy.tpl');
|
||||
|
||||
@@ -91,11 +91,10 @@ class BlockLayered extends Module
|
||||
if ($id_parent == 1)
|
||||
return;
|
||||
|
||||
$context = Context::getContext();
|
||||
$context->controller->addJS($this->_path.'blocklayered.js');
|
||||
$context->controller->addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js');
|
||||
$context->controller->addCSS(_PS_CSS_DIR_.'jquery-ui-1.8.10.custom.css', 'all');
|
||||
$context->controller->addCSS(($this->_path).'blocklayered.css', 'all');
|
||||
$this->context->controller->addJS($this->_path.'blocklayered.js');
|
||||
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js');
|
||||
$this->context->controller->addCSS(_PS_CSS_DIR_.'jquery-ui-1.8.10.custom.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blocklayered.css', 'all');
|
||||
}
|
||||
|
||||
public function hookFooter($params)
|
||||
@@ -134,7 +133,6 @@ class BlockLayered extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$errors = array();
|
||||
$html = '';
|
||||
@@ -313,7 +311,7 @@ class BlockLayered extends Module
|
||||
<td>'.(int)$filtersTemplate['id_layered_filter'].'</td>
|
||||
<td style="text-align: left; padding-left: 10px; width: 270px;">'.$filtersTemplate['name'].'</td>
|
||||
<td style="text-align: center;">'.(int)$filtersTemplate['n_categories'].'</td>
|
||||
<td>'.Tools::displayDate($filtersTemplate['date_add'], (int)$context->language->id, true).'</td>
|
||||
<td>'.Tools::displayDate($filtersTemplate['date_add'], (int)$this->context->language->id, true).'</td>
|
||||
<td>
|
||||
<a href="#" onclick="updElements('.($filtersTemplate['n_categories'] ? 0 : 1).', '.(int)$filtersTemplate['id_layered_filter'].');"><img src="../img/admin/edit.gif" alt="" title="'.$this->l('Edit').'" /></a>
|
||||
<a href="'.$_SERVER['REQUEST_URI'].'&deleteFilterTemplate=1&id_layered_filter='.(int)$filtersTemplate['id_layered_filter'].'" onclick="return confirm(\''.addslashes($this->l('Delete filter template #').(int)$filtersTemplate['id_layered_filter'].$this->l('?')).'\');"><img src="../img/admin/delete.gif" alt="" title="'.$this->l('Delete').'" /></a>
|
||||
@@ -648,7 +646,6 @@ class BlockLayered extends Module
|
||||
if (!empty($this->products))
|
||||
return $this->products;
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
/* If the current category isn't defined of if it's homepage, we have nothing to display */
|
||||
$id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1));
|
||||
@@ -736,14 +733,14 @@ class BlockLayered extends Module
|
||||
p.ean13, pl.available_later, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend, m.name manufacturer_name, p.condition, p.id_manufacturer, stock.quantity,
|
||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
'.$context->shop->sqlAsso('product', 'p').'
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.$context->shop->sqlLang('pl').')
|
||||
'.$this->context->shop->sqlAsso('product', 'p').'
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.$this->context->shop->sqlLang('pl').')
|
||||
'.Product::sqlStock('p', 0).'
|
||||
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1)
|
||||
LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = '.(int)$context->language->id.')
|
||||
LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
|
||||
WHERE p.`active` = 1
|
||||
AND pl.id_lang = '.(int)$context->language->id
|
||||
AND pl.id_lang = '.(int)$this->context->language->id
|
||||
.$queryFilters.
|
||||
' ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby')).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')).
|
||||
' LIMIT '.(((int)(Tools::getValue('p', 1)) - 1) * $n.','.$n);
|
||||
@@ -754,7 +751,6 @@ class BlockLayered extends Module
|
||||
|
||||
public function generateFiltersBlock($selectedFilters = array())
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
/* If the current category isn't defined of if it's homepage, we have nothing to display */
|
||||
$id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1));
|
||||
@@ -771,7 +767,7 @@ class BlockLayered extends Module
|
||||
FROM '._DB_PREFIX_.'category c
|
||||
LEFT JOIN '._DB_PREFIX_.'category_group cg ON (cg.id_category = c.id_category)
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category)
|
||||
WHERE c.nleft > '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1 AND c.id_parent = '.(int)$category->id.' AND cl.id_lang = '.(int)$context->language->id.'
|
||||
WHERE c.nleft > '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1 AND c.id_parent = '.(int)$category->id.' AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||
AND cg.id_group '.pSQL(sizeof($groups) ? 'IN ('.implode(',', $groups).')' : '= 1').'
|
||||
GROUP BY c.id_category
|
||||
ORDER BY c.position ASC');
|
||||
@@ -836,7 +832,7 @@ class BlockLayered extends Module
|
||||
SELECT fvl.id_feature_value, fvl.value
|
||||
FROM '._DB_PREFIX_.'feature_value fv
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fv.id_feature_value)
|
||||
WHERE (fv.custom IS NULL OR fv.custom = 0) AND fv.id_feature = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND fvl.id_lang = '.(int)$context->language->id);
|
||||
WHERE (fv.custom IS NULL OR fv.custom = 0) AND fv.id_feature = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND fvl.id_lang = '.(int)$this->context->language->id);
|
||||
break;
|
||||
|
||||
case 'id_attribute_group':
|
||||
@@ -846,7 +842,7 @@ class BlockLayered extends Module
|
||||
SELECT al.id_attribute, al.name, a.color
|
||||
FROM '._DB_PREFIX_.'attribute a
|
||||
LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON (al.id_attribute = a.id_attribute)
|
||||
WHERE a.id_attribute_group = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND al.id_lang = '.(int)$context->language->id);
|
||||
WHERE a.id_attribute_group = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND al.id_lang = '.(int)$this->context->language->id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -857,7 +853,7 @@ class BlockLayered extends Module
|
||||
$fNames = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT id_feature, name
|
||||
FROM '._DB_PREFIX_.'feature_lang
|
||||
WHERE id_lang = '.(int)$context->language->id.' AND id_feature IN ('.implode(',', $f).')');
|
||||
WHERE id_lang = '.(int)$this->context->language->id.' AND id_feature IN ('.implode(',', $f).')');
|
||||
$fNameByID = array();
|
||||
foreach ($fNames AS $fName)
|
||||
$fNameByID[(int)$fName['id_feature']] = $fName['name'];
|
||||
@@ -870,7 +866,7 @@ class BlockLayered extends Module
|
||||
SELECT ag.id_attribute_group, agl.public_name, ag.is_color_group
|
||||
FROM '._DB_PREFIX_.'attribute_group ag
|
||||
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.id_attribute_group = ag.id_attribute_group)
|
||||
WHERE agl.id_lang = '.(int)$context->language->id.' AND ag.id_attribute_group IN ('.implode(',', $a).')');
|
||||
WHERE agl.id_lang = '.(int)$this->context->language->id.' AND ag.id_attribute_group IN ('.implode(',', $a).')');
|
||||
|
||||
$aNameByID = $colorGroups = array();
|
||||
foreach ($aNames AS $aName)
|
||||
@@ -1085,9 +1081,9 @@ class BlockLayered extends Module
|
||||
foreach($_GET AS $key => $val)
|
||||
$params .= $key.'='.$val.'&';
|
||||
|
||||
$share_url = $context->link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$context->language->id], $context->language->id).rtrim($params, '&');
|
||||
$share_url = $this->context->link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$this->context->language->id], $this->context->language->id).rtrim($params, '&');
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'display_share' => (int)Configuration::get('PS_LAYERED_SHARE'),
|
||||
'share_url' => $this->getShortLink($share_url),
|
||||
'layered_show_qties' => (int)Configuration::get('PS_LAYERED_SHOW_QTIES'),
|
||||
@@ -1102,7 +1098,6 @@ class BlockLayered extends Module
|
||||
|
||||
public function ajaxCallBackOffice($categoryBox = array(), $id_layered_filter = NULL)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
if (!empty($id_layered_filter))
|
||||
{
|
||||
@@ -1123,7 +1118,7 @@ class BlockLayered extends Module
|
||||
LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_attribute = a.id_attribute)
|
||||
LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product_attribute = pac.id_product_attribute)
|
||||
LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = pa.id_product)' : '').'
|
||||
WHERE agl.id_lang = '.(int)$context->language->id.
|
||||
WHERE agl.id_lang = '.(int)$this->context->language->id.
|
||||
(sizeof($categoryBox) ? ' AND cp.id_category IN ('.implode(',', $categoryBox).')' : '').'
|
||||
GROUP BY ag.id_attribute_group');
|
||||
|
||||
@@ -1134,7 +1129,7 @@ class BlockLayered extends Module
|
||||
'.(sizeof($categoryBox) ? '
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_product fp ON (fp.id_feature = fv.id_feature)
|
||||
LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = fp.id_product)' : '').'
|
||||
WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = '.(int)$context->language->id.
|
||||
WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = '.(int)$this->context->language->id.
|
||||
(sizeof($categoryBox) ? ' AND cp.id_category IN ('.implode(',', $categoryBox).')' : '').'
|
||||
GROUP BY fl.id_feature');
|
||||
|
||||
@@ -1215,11 +1210,10 @@ class BlockLayered extends Module
|
||||
|
||||
public function ajaxCall()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$selectedFilters = $this->getSelectedFilters();
|
||||
$products = $this->getProductByFilters($selectedFilters);
|
||||
$products = Product::getProductsProperties($context->language->id, $products);
|
||||
$products = Product::getProductsProperties($this->context->language->id, $products);
|
||||
$nbProducts = $this->nbr_products;
|
||||
$range = 2; /* how many pages around page selected */
|
||||
|
||||
@@ -1241,7 +1235,7 @@ class BlockLayered extends Module
|
||||
if ($stop > $pages_nb)
|
||||
$stop = (int)($pages_nb);
|
||||
|
||||
$context->smarty->assign('nb_products', $nbProducts);
|
||||
$this->context->smarty->assign('nb_products', $nbProducts);
|
||||
$pagination_infos = array(
|
||||
'pages_nb' => (int)($pages_nb),
|
||||
'p' => (int)$p,
|
||||
@@ -1251,15 +1245,15 @@ class BlockLayered extends Module
|
||||
'stop' => (int)$stop,
|
||||
'nArray' => $nArray = (int)Configuration::get('PS_PRODUCTS_PER_PAGE') != 10 ? array((int)Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50)
|
||||
);
|
||||
$context->smarty->assign($pagination_infos);
|
||||
$this->context->smarty->assign($pagination_infos);
|
||||
|
||||
$context->smarty->assign('products', $products);
|
||||
$this->context->smarty->assign('products', $products);
|
||||
|
||||
/* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
|
||||
return Tools::jsonEncode(array(
|
||||
'filtersBlock' => $this->generateFiltersBlock($selectedFilters),
|
||||
'productList' => $context->smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'),
|
||||
'pagination' => $context->smarty->fetch(_PS_THEME_DIR_.'pagination.tpl')
|
||||
'productList' => $this->context->smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'),
|
||||
'pagination' => $this->context->smarty->fetch(_PS_THEME_DIR_.'pagination.tpl')
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -84,14 +84,13 @@ class BlockLink extends Module
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$links = $this->getLinks();
|
||||
$links = $this->getLinks();
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'blocklink_links' => $links,
|
||||
'title' => Configuration::get('PS_BLOCKLINK_TITLE', $context->language->id),
|
||||
'title' => Configuration::get('PS_BLOCKLINK_TITLE', $this->context->language->id),
|
||||
'url' => Configuration::get('PS_BLOCKLINK_URL'),
|
||||
'lang' => 'text_'.$context->language->id
|
||||
'lang' => 'text_'.$this->context->language->id
|
||||
));
|
||||
if (!$links)
|
||||
return false;
|
||||
@@ -329,8 +328,7 @@ class BlockLink extends Module
|
||||
private function _list()
|
||||
{
|
||||
$links = $this->getLinks();
|
||||
$context = Context::getContext();
|
||||
$languages = Language::getLanguages();
|
||||
$languages = Language::getLanguages();
|
||||
if ($links)
|
||||
{
|
||||
$this->_html .= '
|
||||
@@ -370,7 +368,7 @@ class BlockLink extends Module
|
||||
$this->_html .= '
|
||||
<tr>
|
||||
<td>'.$link['id'].'</td>
|
||||
<td>'.$link['text_'.$context->language->id].'</td>
|
||||
<td>'.$link['text_'.$this->context->language->id].'</td>
|
||||
<td>'.$link['url'].'</td>
|
||||
<td>
|
||||
<img src="../img/admin/edit.gif" alt="" title="" onclick="linkEdition('.$link['id'].')" style="cursor: pointer" />
|
||||
|
||||
@@ -54,11 +54,10 @@ class BlockManufacturer extends Module
|
||||
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'manufacturers' => Manufacturer::getManufacturers(),
|
||||
'link' => $context->link,
|
||||
'link' => $this->context->link,
|
||||
'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
|
||||
'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'),
|
||||
'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'),
|
||||
@@ -128,7 +127,6 @@ class BlockManufacturer extends Module
|
||||
|
||||
function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blockmanufacturer.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blockmanufacturer.css', 'all');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,9 @@ class BlockMyAccount extends Module
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
if (!$params['cookie']->isLogged())
|
||||
return false;
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')),
|
||||
'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN')),
|
||||
'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock')
|
||||
@@ -85,8 +84,7 @@ class BlockMyAccount extends Module
|
||||
}
|
||||
function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blockmyaccount.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blockmyaccount.css', 'all');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,11 +96,10 @@ class BlockNewProducts extends Module
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR')));
|
||||
if (!$newProducts AND !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
|
||||
return;
|
||||
$context->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));
|
||||
$this->context->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));
|
||||
|
||||
return $this->display(__FILE__, 'blocknewproducts.tpl');
|
||||
}
|
||||
@@ -112,8 +111,7 @@ class BlockNewProducts extends Module
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blocknewproducts.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blocknewproducts.css', 'all');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -222,9 +222,8 @@ class Blocknewsletter extends Module
|
||||
|
||||
private function sendVoucher($email)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
if ($discount = Configuration::get('NW_VOUCHER_CODE'))
|
||||
return Mail::Send($context->language->id, 'newsletter_voucher', Mail::l('Newsletter voucher'), array('{discount}' => $discount), $email, NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
return Mail::Send($this->context->language->id, 'newsletter_voucher', Mail::l('Newsletter voucher'), array('{discount}' => $discount), $email, NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -235,14 +234,13 @@ class Blocknewsletter extends Module
|
||||
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
if (Tools::isSubmit('submitNewsletter'))
|
||||
{
|
||||
$this->newsletterRegistration();
|
||||
if ($this->error)
|
||||
{
|
||||
$context->smarty->assign(array('color' => 'red',
|
||||
$this->context->smarty->assign(array('color' => 'red',
|
||||
'msg' => $this->error,
|
||||
'nw_value' => isset($_POST['email']) ? pSQL($_POST['email']) : false,
|
||||
'nw_error' => true,
|
||||
@@ -252,19 +250,18 @@ class Blocknewsletter extends Module
|
||||
{
|
||||
if (Configuration::get('NW_CONFIRMATION_EMAIL') AND isset($_POST['action']) AND (int)($_POST['action']) == 0)
|
||||
Mail::Send($params['cookie']->id_lang, 'newsletter_conf', Mail::l('Newsletter confirmation'), array(), pSQL($_POST['email']), NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/');
|
||||
$context->smarty->assign(array('color' => 'green',
|
||||
$this->context->smarty->assign(array('color' => 'green',
|
||||
'msg' => $this->valid,
|
||||
'nw_error' => false));
|
||||
}
|
||||
}
|
||||
$context->smarty->assign('this_path', $this->_path);
|
||||
$this->context->smarty->assign('this_path', $this->_path);
|
||||
return $this->display(__FILE__, 'blocknewsletter.tpl');
|
||||
}
|
||||
|
||||
function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blocknewsletter.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blocknewsletter.css', 'all');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ class BlockPaymentLogo extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$html = '
|
||||
<h2>'.$this->l('Payment logo').'</h2>
|
||||
';
|
||||
@@ -76,7 +75,7 @@ class BlockPaymentLogo extends Module
|
||||
$html .= $this->displayConfirmation($this->l('Settings are updated'));
|
||||
}
|
||||
|
||||
$cmss = CMS::listCms($context->language->id);
|
||||
$cmss = CMS::listCms($this->context->language->id);
|
||||
|
||||
if (!sizeof($cmss))
|
||||
$html .= $this->displayError($this->l('No CMS page is available'));
|
||||
@@ -112,14 +111,13 @@ class BlockPaymentLogo extends Module
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
if (!Configuration::get('PS_PAYMENT_LOGO_CMS_ID'))
|
||||
return;
|
||||
$cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $context->language->id);
|
||||
$cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $this->context->language->id);
|
||||
if (!Validate::isLoadedObject($cms))
|
||||
return;
|
||||
$context->smarty->assign('cms_payement_logo', $cms);
|
||||
$this->context->smarty->assign('cms_payement_logo', $cms);
|
||||
return $this->display(__FILE__, 'blockpaymentlogo.tpl');
|
||||
}
|
||||
|
||||
@@ -136,8 +134,7 @@ class BlockPaymentLogo extends Module
|
||||
{
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return ;
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blockpaymentlogo.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blockpaymentlogo.css', 'all');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -132,7 +132,6 @@ class Blockrss extends Module
|
||||
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
// Conf
|
||||
$title = strval(Configuration::get('RSS_FEED_TITLE'));
|
||||
@@ -148,7 +147,7 @@ class Blockrss extends Module
|
||||
$rss_links[] = array('title' => $item->title, 'url' => $item->link);
|
||||
|
||||
// Display smarty
|
||||
$context->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links));
|
||||
$this->context->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links));
|
||||
|
||||
return $this->display(__FILE__, 'blockrss.tpl');
|
||||
}
|
||||
@@ -160,8 +159,7 @@ class Blockrss extends Module
|
||||
|
||||
function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blockrss.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blockrss.css', 'all');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,23 +80,22 @@ class BlockSearch extends Module
|
||||
*/
|
||||
private function _hookCommon($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$context->smarty->assign('ENT_QUOTES', ENT_QUOTES);
|
||||
$context->smarty->assign('search_ssl', (int)(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'));
|
||||
$this->context->smarty->assign('ENT_QUOTES', ENT_QUOTES);
|
||||
$this->context->smarty->assign('search_ssl', (int)(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'));
|
||||
|
||||
$ajaxSearch=(int)(Configuration::get('PS_SEARCH_AJAX'));
|
||||
$context->smarty->assign('ajaxsearch', $ajaxSearch);
|
||||
$this->context->smarty->assign('ajaxsearch', $ajaxSearch);
|
||||
|
||||
$instantSearch = (int)(Configuration::get('PS_INSTANT_SEARCH'));
|
||||
$context->smarty->assign('instantsearch', $instantSearch);
|
||||
$this->context->smarty->assign('instantsearch', $instantSearch);
|
||||
if ($ajaxSearch)
|
||||
{
|
||||
$context->controller->addCSS(_PS_CSS_DIR_.'jquery.autocomplete.css');
|
||||
$context->controller->addJS(_PS_JS_DIR_.'jquery/jquery.autocomplete.js');
|
||||
$this->context->controller->addCSS(_PS_CSS_DIR_.'jquery.autocomplete.css');
|
||||
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery.autocomplete.js');
|
||||
}
|
||||
$context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||
$context->controller->addCSS(($this->_path).'blocksearch.css', 'all');
|
||||
$this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||
$this->context->controller->addCSS(($this->_path).'blocksearch.css', 'all');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,17 +63,15 @@ class BlockStore extends Module
|
||||
|
||||
function hookRightColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
|
||||
$context->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG'));
|
||||
$this->context->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG'));
|
||||
return $this->display(__FILE__, 'blockstore.tpl');
|
||||
}
|
||||
|
||||
function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS($this->_path.'/blockstore.css', 'all');
|
||||
$this->context->controller->addCSS($this->_path.'/blockstore.css', 'all');
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
|
||||
@@ -60,10 +60,9 @@ class BlockSupplier extends Module
|
||||
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'suppliers' => Supplier::getSuppliers(false),
|
||||
'link' => $context->link,
|
||||
'link' => $this->context->link,
|
||||
'text_list' => Configuration::get('SUPPLIER_DISPLAY_TEXT'),
|
||||
'text_list_nb' => Configuration::get('SUPPLIER_DISPLAY_TEXT_NB'),
|
||||
'form_list' => Configuration::get('SUPPLIER_DISPLAY_FORM'),
|
||||
@@ -133,8 +132,7 @@ class BlockSupplier extends Module
|
||||
|
||||
function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blocksupplier.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blocksupplier.css', 'all');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,14 +100,13 @@ class BlockTags extends Module
|
||||
*/
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$tags = Tag::getMainTags((int)($params['cookie']->id_lang), (int)(Configuration::get('BLOCKTAGS_NBR')));
|
||||
if (!sizeof($tags))
|
||||
return false;
|
||||
foreach ($tags AS &$tag)
|
||||
$tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']);
|
||||
$context->smarty->assign('tags', $tags);
|
||||
$this->context->smarty->assign('tags', $tags);
|
||||
|
||||
return $this->display(__FILE__, 'blocktags.tpl');
|
||||
}
|
||||
@@ -119,8 +118,7 @@ class BlockTags extends Module
|
||||
|
||||
function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blocktags.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blocktags.css', 'all');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,14 +59,13 @@ class BlockUserInfo extends Module
|
||||
{
|
||||
if (!$this->active)
|
||||
return;
|
||||
$context = Context::getContext();
|
||||
$context->smarty->assign(array(
|
||||
'cart' => $context->cart,
|
||||
'cart_qties' => $context->cart->nbProducts(),
|
||||
'logged' => $context->cookie->isLogged(),
|
||||
'customerName' => ($context->cookie->logged ? $context->customer->firstname.' '.$context->customer->lastname : false),
|
||||
'firstName' => ($context->cookie->logged ? $context->customer->firstname : false),
|
||||
'lastName' => ($context->cookie->logged ? $context->customer->lastname : false),
|
||||
$this->context->smarty->assign(array(
|
||||
'cart' => $this->context->cart,
|
||||
'cart_qties' => $this->context->cart->nbProducts(),
|
||||
'logged' => $this->context->cookie->isLogged(),
|
||||
'customerName' => ($this->context->cookie->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
|
||||
'firstName' => ($this->context->cookie->logged ? $this->context->customer->firstname : false),
|
||||
'lastName' => ($this->context->cookie->logged ? $this->context->customer->lastname : false),
|
||||
'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
|
||||
));
|
||||
return $this->display(__FILE__, 'blockuserinfo.tpl');
|
||||
@@ -74,8 +73,7 @@ class BlockUserInfo extends Module
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blockuserinfo.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blockuserinfo.css', 'all');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ class BlockViewed extends Module
|
||||
|
||||
function hookRightColumn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_product = (int)(Tools::getValue('id_product'));
|
||||
$productsViewed = (isset($params['cookie']->viewed) AND !empty($params['cookie']->viewed)) ? array_slice(explode(',', $params['cookie']->viewed), 0, Configuration::get('PRODUCTS_VIEWED_NBR')) : array();
|
||||
|
||||
@@ -153,7 +152,7 @@ class BlockViewed extends Module
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = cp.`id_category`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer_group` cug ON (cug.`id_group` = cg.`id_group`)
|
||||
WHERE p.`id_product` = '.(int)($id_product).'
|
||||
'.($context->customer->id ? 'AND cug.`id_customer` = '.(int)$context->customer->id :
|
||||
'.($this->context->customer->id ? 'AND cug.`id_customer` = '.(int)$this->context->customer->id :
|
||||
'AND cg.`id_group` = 1')
|
||||
);
|
||||
if ($result['total'])
|
||||
@@ -167,7 +166,7 @@ class BlockViewed extends Module
|
||||
if (!sizeof($productsViewedObj))
|
||||
return ;
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'productsViewedObj' => $productsViewedObj,
|
||||
'mediumSize' => Image::getSize('medium')));
|
||||
|
||||
@@ -185,7 +184,6 @@ class BlockViewed extends Module
|
||||
|
||||
function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blockviewed.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blockviewed.css', 'all');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,12 +68,10 @@ class WishList extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'wishlist_email` WHERE `id_wishlist` = '.(int)($this->id));
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'wishlist_product` WHERE `id_wishlist` = '.(int)($this->id));
|
||||
if (isset($context->cookie->id_wishlist))
|
||||
unset($context->cookie->id_wishlist);
|
||||
if (isset($this->context->cookie->id_wishlist))
|
||||
unset($this->context->cookie->id_wishlist);
|
||||
|
||||
return (parent::delete());
|
||||
}
|
||||
@@ -103,7 +101,6 @@ class WishList extends ObjectModel
|
||||
public static function isExistsByNameForUser($name)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT COUNT(*) AS total
|
||||
FROM `'._DB_PREFIX_.'wishlist`
|
||||
|
||||
@@ -169,15 +169,13 @@ class BlockWishList extends Module
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'blockwishlist.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'blockwishlist.css', 'all');
|
||||
return $this->display(__FILE__, 'blockwishlist-header.tpl');
|
||||
}
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
global $errors;
|
||||
$context = Context::getContext();
|
||||
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
if ($params['cookie']->isLogged())
|
||||
@@ -196,7 +194,7 @@ class BlockWishList extends Module
|
||||
}
|
||||
else
|
||||
$id_wishlist = $params['cookie']->id_wishlist;
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'id_wishlist' => $id_wishlist,
|
||||
'isLogged' => true,
|
||||
'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $params['cookie']->id_customer, $params['cookie']->id_lang, null, true)),
|
||||
@@ -204,7 +202,7 @@ class BlockWishList extends Module
|
||||
'ptoken' => Tools::getToken(false)));
|
||||
}
|
||||
else
|
||||
$context->smarty->assign(array('wishlist_products' => false, 'wishlists' => false));
|
||||
$this->context->smarty->assign(array('wishlist_products' => false, 'wishlists' => false));
|
||||
return ($this->display(__FILE__, 'blockwishlist.tpl'));
|
||||
}
|
||||
|
||||
@@ -215,8 +213,7 @@ class BlockWishList extends Module
|
||||
|
||||
public function hookProductActions($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->smarty->assign('id_product', (int)(Tools::getValue('id_product')));
|
||||
$this->context->smarty->assign('id_product', (int)(Tools::getValue('id_product')));
|
||||
return ($this->display(__FILE__, 'blockwishlist-extra.tpl'));
|
||||
}
|
||||
|
||||
@@ -232,19 +229,18 @@ class BlockWishList extends Module
|
||||
|
||||
private function _displayProducts($id_wishlist)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
include_once(dirname(__FILE__).'/WishList.php');
|
||||
|
||||
$wishlist = new WishList($id_wishlist);
|
||||
$products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $context->language->id);
|
||||
$products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $this->context->language->id);
|
||||
for ($i = 0; $i < sizeof($products); ++$i)
|
||||
{
|
||||
$obj = new Product((int)($products[$i]['id_product']), false, $context->language->id);
|
||||
$obj = new Product((int)($products[$i]['id_product']), false, $this->context->language->id);
|
||||
if (!Validate::isLoadedObject($obj))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
$images = $obj->getImages($context->language->id);
|
||||
$images = $obj->getImages($this->context->language->id);
|
||||
foreach ($images AS $k => $image)
|
||||
{
|
||||
if ($image['cover'])
|
||||
@@ -254,7 +250,7 @@ class BlockWishList extends Module
|
||||
}
|
||||
}
|
||||
if (!isset($products[$i]['cover']))
|
||||
$products[$i]['cover'] = $context->language->iso_code.'-default';
|
||||
$products[$i]['cover'] = $this->context->language->iso_code.'-default';
|
||||
}
|
||||
}
|
||||
$this->_html .= '
|
||||
|
||||
@@ -55,9 +55,8 @@ class CarrierCompare extends Module
|
||||
{
|
||||
if (!$this->isModuleAvailable())
|
||||
return;
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'style.css', 'all');
|
||||
$context->controller->addJS(($this->_path).'carriercompare.js');
|
||||
$this->context->controller->addCSS(($this->_path).'style.css', 'all');
|
||||
$this->context->controller->addJS(($this->_path).'carriercompare.js');
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -68,7 +67,7 @@ class CarrierCompare extends Module
|
||||
if (!$this->isModuleAvailable())
|
||||
return;
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'countries' => Country::getCountries($this->context->language->id),
|
||||
'id_carrier' => ($params['cart']->id_carrier ? $params['cart']->id_carrier : Configuration::get('PS_CARRIER_DEFAULT')),
|
||||
'id_country' => (isset($this->context->customer->geoloc_id_country) ? $this->context->customer->geoloc_id_country : Configuration::get('PS_COUNTRY_DEFAULT')),
|
||||
@@ -112,7 +111,6 @@ class CarrierCompare extends Module
|
||||
|
||||
public function saveSelection($id_country, $id_state, $zipcode, $id_carrier)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$errors = array();
|
||||
|
||||
if (!Validate::isInt($id_state))
|
||||
@@ -138,11 +136,11 @@ class CarrierCompare extends Module
|
||||
if (sizeof($errors))
|
||||
return $errors;
|
||||
|
||||
$context->cookie->id_country = $id_country;
|
||||
$context->cookie->id_state = $id_state;
|
||||
$context->cookie->postcode = $zipcode;
|
||||
$context->cart->id_carrier = $id_carrier;
|
||||
if (!$context->cart->update())
|
||||
$this->context->cookie->id_country = $id_country;
|
||||
$this->context->cookie->id_state = $id_state;
|
||||
$this->context->cookie->postcode = $zipcode;
|
||||
$this->context->cart->id_carrier = $id_carrier;
|
||||
if (!$this->context->cart->update())
|
||||
return array($this->l('Can\'t update the cart'));
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ class CashOnDelivery extends PaymentModule
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
$context = Context::getContext();
|
||||
// Check if cart has product download
|
||||
foreach ($params['cart']->getProducts() AS $product)
|
||||
{
|
||||
@@ -67,7 +66,7 @@ class CashOnDelivery extends PaymentModule
|
||||
return false;
|
||||
}
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'this_path' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
|
||||
));
|
||||
|
||||
@@ -166,10 +166,9 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
public function createDisposition($cart)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$currency = new Currency((int)($cart->id_currency));
|
||||
$language = $this->_getSupportedLanguageIsoById($context->language->id);
|
||||
$language = $this->_getSupportedLanguageIsoById($this->context->language->id);
|
||||
$mid = Configuration::get($this->prefix.'MERCHANT_ID_'.$currency->iso_code);
|
||||
$mtid = $cart->id.'-'.time();
|
||||
$amount = number_format((float)($cart->getOrderTotal(true, Cart::BOTH)), 2, '.','');
|
||||
@@ -353,14 +352,13 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
private function _displayInfos()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
|
||||
return '<fieldset id="infos_cashticket">
|
||||
<legend><img src="'._MODULE_DIR_.$this->name.'/img/payment-small.png" alt="" />'.$this->displayName.'</legend>
|
||||
<center><img src="'._MODULE_DIR_.$this->name.'/img/payment.png" alt="" class="logo" /></center>
|
||||
'.$this->getL('introduction').'
|
||||
<br /><br />
|
||||
<a style="color: blue; text-decoration: underline" href="'.$this->_getRegisterLink($context->language->id).'">'.$this->getL('register').'</a>
|
||||
<a style="color: blue; text-decoration: underline" href="'.$this->_getRegisterLink($this->context->language->id).'">'.$this->getL('register').'</a>
|
||||
</fieldset>
|
||||
<div class="clear" /><br />';
|
||||
}
|
||||
@@ -534,7 +532,6 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
// check currency
|
||||
$currency = new Currency((int)($params['cart']->id_currency));
|
||||
@@ -555,7 +552,7 @@ abstract class PrepaidServices extends PaymentModule
|
||||
if ($amount > $this->max_amount)
|
||||
return false;
|
||||
|
||||
$context->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
|
||||
$this->context->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
|
||||
'payment_name' => $this->displayName,
|
||||
'module_name' => $this->name));
|
||||
|
||||
@@ -565,19 +562,17 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
public function hookPaymentReturn($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
if ($params['objOrder']->module != $this->name)
|
||||
return;
|
||||
|
||||
$context->smarty->assign('payment_name', $this->displayName);
|
||||
$this->context->smarty->assign('payment_name', $this->displayName);
|
||||
return $this->display(__FILE__, $this->name.'-confirmation.tpl');
|
||||
}
|
||||
|
||||
|
||||
public function hookAdminOrder($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$error = 0;
|
||||
$order = new Order((int)($params['id_order']));
|
||||
|
||||
@@ -593,12 +588,12 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
// check disposition state
|
||||
$res = PrepaidServicesAPI::getSerialNumbers($this->getAPIConfiguration($disposition['currency']), Configuration::get($this->prefix.'MERCHANT_ID_'.$disposition['currency']), $disposition['mtid'], $disposition['currency']);
|
||||
$currency = $context->currency;
|
||||
$currency = $this->context->currency;
|
||||
|
||||
// if the disposition is not "active"
|
||||
if ($res[5] != PrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PrepaidServicesAPI::DISPOSITION_DEBITED)
|
||||
{
|
||||
$context->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
|
||||
$this->context->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
|
||||
return $this->display($this->module_dir.'/'.$this->name, 'disposition-error.tpl');
|
||||
}
|
||||
|
||||
@@ -629,7 +624,7 @@ abstract class PrepaidServices extends PaymentModule
|
||||
if (Tools::getIsset('pp_error'))
|
||||
$error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error'));
|
||||
|
||||
$context->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
|
||||
$this->context->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
|
||||
'payment_name' => $order->payment,
|
||||
'error' => $error_msg,
|
||||
'currency' => $currency->getSign('right'),
|
||||
|
||||
@@ -155,14 +155,13 @@ class Cheque extends PaymentModule
|
||||
if (!$this->_checkCurrency($cart))
|
||||
Tools::redirect('index.php?controller=order');
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'nbProducts' => $cart->nbProducts(),
|
||||
'cust_currency' => $cart->id_currency,
|
||||
'currencies' => $this->getCurrency((int)$cart->id_currency),
|
||||
'total' => $cart->getOrderTotal(true, Cart::BOTH),
|
||||
'isoCode' => $context->language->iso_code,
|
||||
'isoCode' => $this->context->language->iso_code,
|
||||
'chequeName' => $this->chequeName,
|
||||
'chequeAddress' => Tools::nl2br($this->address),
|
||||
'this_path' => $this->_path,
|
||||
@@ -179,8 +178,7 @@ class Cheque extends PaymentModule
|
||||
if (!$this->_checkCurrency($params['cart']))
|
||||
return ;
|
||||
|
||||
$context = Context::getContext();
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'this_path' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
|
||||
));
|
||||
@@ -192,10 +190,9 @@ class Cheque extends PaymentModule
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
$context = Context::getContext();
|
||||
$state = $params['objOrder']->getCurrentState();
|
||||
if ($state == Configuration::get('PS_OS_CHEQUE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK'))
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),
|
||||
'chequeName' => $this->chequeName,
|
||||
'chequeAddress' => Tools::nl2br($this->address),
|
||||
@@ -203,7 +200,7 @@ class Cheque extends PaymentModule
|
||||
'id_order' => $params['objOrder']->id
|
||||
));
|
||||
else
|
||||
$context->smarty->assign('status', 'failed');
|
||||
$this->context->smarty->assign('status', 'failed');
|
||||
return $this->display(__FILE__, 'payment_return.tpl');
|
||||
}
|
||||
|
||||
|
||||
@@ -115,11 +115,8 @@ class Criteo extends Module
|
||||
}
|
||||
}
|
||||
|
||||
public static function buildCSV(Context $context = null)
|
||||
public static function buildCSV()
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
global $country_infos;
|
||||
|
||||
$country_infos = array('id_group' => 0, 'id_tax' => 1);
|
||||
@@ -165,7 +162,7 @@ class Criteo extends Module
|
||||
$line[] = $product->manufacturer_name.' - '.$product->name[intval($conf['PS_LANG_DEFAULT'])];
|
||||
$line[] = Tools::getProtocol().$_SERVER['HTTP_HOST']._THEME_PROD_DIR_.$imageObj->getExistingImgPath().'-small.jpg';
|
||||
$line[] = Tools::getProtocol().$_SERVER['HTTP_HOST']._THEME_PROD_DIR_.$imageObj->getExistingImgPath().'-thickbox.jpg';
|
||||
$line[] = $context->link->getProductLink(intval($product->id), $product->link_rewrite[intval($conf['PS_LANG_DEFAULT'])], $product->ean13).'&utm_source=criteo&aff=criteo';
|
||||
$line[] = $this->context->link->getProductLink(intval($product->id), $product->link_rewrite[intval($conf['PS_LANG_DEFAULT'])], $product->ean13).'&utm_source=criteo&aff=criteo';
|
||||
$line[] = str_replace(array("\n", "\r", "\t", '|'), '', strip_tags(html_entity_decode($product->description_short[intval($conf['PS_LANG_DEFAULT'])], ENT_COMPAT, 'UTF-8')));
|
||||
|
||||
$price = $product->getPrice(true, intval(Product::getDefaultAttribute($product->id)));
|
||||
@@ -184,12 +181,11 @@ class Criteo extends Module
|
||||
echo $html;
|
||||
}
|
||||
|
||||
public static function buildXML(Context $context = null)
|
||||
public static function buildXML()
|
||||
{
|
||||
global $country_infos;
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
$country_infos = array('id_group' => 0, 'id_tax' => 1);
|
||||
$html = '<products>'."\n";
|
||||
/* First line, columns */
|
||||
|
||||
@@ -96,8 +96,7 @@ class CrossSelling extends Module
|
||||
|
||||
public function hookHeader()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context->controller->addCSS(($this->_path).'crossselling.css', 'all');
|
||||
$this->context->controller->addCSS(($this->_path).'crossselling.css', 'all');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +104,6 @@ class CrossSelling extends Module
|
||||
*/
|
||||
public function hookProductFooter($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT o.id_order
|
||||
@@ -127,7 +125,7 @@ class CrossSelling extends Module
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id)
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default)
|
||||
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id)
|
||||
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$context->language->id.' AND cl.id_lang = '.(int)$context->language->id.'
|
||||
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$this->context->language->id.' AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||
AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND p.active = 1
|
||||
ORDER BY RAND()
|
||||
LIMIT 10');
|
||||
@@ -135,15 +133,15 @@ class CrossSelling extends Module
|
||||
$taxCalc = Product::getTaxCalculationMethod();
|
||||
foreach ($orderProducts AS &$orderProduct)
|
||||
{
|
||||
$orderProduct['image'] = $context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium');
|
||||
$orderProduct['link'] = $context->link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']);
|
||||
$orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium');
|
||||
$orderProduct['link'] = $this->context->link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']);
|
||||
if (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND ($taxCalc == 0 OR $taxCalc == 2))
|
||||
$orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], true, NULL);
|
||||
elseif (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND $taxCalc == 1)
|
||||
$orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], false, NULL);
|
||||
}
|
||||
|
||||
$context->smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0),
|
||||
$this->context->smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0),
|
||||
'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE')));
|
||||
}
|
||||
return $this->display(__FILE__, 'crossselling.tpl');
|
||||
|
||||
@@ -98,7 +98,6 @@ class DateOfDelivery extends Module
|
||||
|
||||
public function hookBeforeCarrier($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
if (!sizeof($params['carriers']))
|
||||
return false;
|
||||
|
||||
@@ -111,7 +110,7 @@ class DateOfDelivery extends Module
|
||||
foreach ($params['carriers'] as $carrier)
|
||||
$datesDelivery[(int)($carrier['id_carrier'])] = $this->_getDatesOfDelivery((int)($carrier['id_carrier']), $oos);
|
||||
|
||||
$context->smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'datesDelivery' => $datesDelivery,
|
||||
'id_carrier' => ($params['cart']->id_carrier ? (int)($params['cart']->id_carrier) : (int)(Configuration::get('PS_CARRIER_DEFAULT')))
|
||||
));
|
||||
@@ -121,7 +120,6 @@ class DateOfDelivery extends Module
|
||||
|
||||
public function hookOrderDetailDisplayed($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$oos = false; // For out of stock management
|
||||
foreach ($params['order']->getProducts() as $product)
|
||||
@@ -134,7 +132,7 @@ class DateOfDelivery extends Module
|
||||
if (!is_array($datesDelivery) OR !sizeof($datesDelivery))
|
||||
return ;
|
||||
|
||||
$context->smarty->assign('datesDelivery', $datesDelivery);
|
||||
$this->context->smarty->assign('datesDelivery', $datesDelivery);
|
||||
|
||||
return $this->display(__FILE__, 'orderDetail.tpl');
|
||||
}
|
||||
@@ -312,9 +310,8 @@ class DateOfDelivery extends Module
|
||||
|
||||
private function _setCarrierRuleForm()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$carriers = Carrier::getCarriers($context->language->id, true , false,false, NULL, ALL_CARRIERS);
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true , false,false, NULL, ALL_CARRIERS);
|
||||
if (Tools::isSubmit('editCarrierRule') AND $this->_isCarrierRuleExists(Tools::getValue('id_carrier_rule')))
|
||||
$carrier_rule = $this->_getCarrierRule(Tools::getValue('id_carrier_rule'));
|
||||
|
||||
|
||||
+63
-72
@@ -33,7 +33,6 @@ class Dejala extends CarrierModule
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
//TODO Iso code of countries where the module can be used, if none module available for all countries
|
||||
$this->limited_countries = array('fr');
|
||||
@@ -41,10 +40,10 @@ class Dejala extends CarrierModule
|
||||
$this->tab = 'shipping_logistics';
|
||||
$this->version = 1.4;
|
||||
$this->internal_version = '1.3';
|
||||
$this->id_lang = $context->language->id;
|
||||
$this->wday_labels = array($this->l('Sunday'), $this->l('Monday'), $this->l('Tuesday'), $this->l('Wednesday'), $this->l('Thursday'), $this->l('Friday'), $this->l('Saturday'));
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->id_lang = $this->context->language->id;
|
||||
$this->wday_labels = array($this->l('Sunday'), $this->l('Monday'), $this->l('Tuesday'), $this->l('Wednesday'), $this->l('Thursday'), $this->l('Friday'), $this->l('Saturday'));
|
||||
|
||||
// The parent construct is required for translations
|
||||
$this->page = basename(__FILE__, '.php');
|
||||
@@ -122,12 +121,11 @@ class Dejala extends CarrierModule
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
// If Dejala is default carrier, try to set another one as default
|
||||
$djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ;
|
||||
if (Configuration::get('PS_CARRIER_DEFAULT') == (int)($djlCarrier->id))
|
||||
{
|
||||
$carriers = Carrier::getCarriers($context->language->id, true, false, false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true, false, false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
foreach($carriers as $carrier)
|
||||
{
|
||||
if ($carrier['active'] AND !$carrier['deleted'] AND ($carrier['external_module_name'] != $this->name))
|
||||
@@ -231,7 +229,6 @@ class Dejala extends CarrierModule
|
||||
**/
|
||||
public function _postProcess()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$errors = array();
|
||||
$method = Tools::getValue('method');
|
||||
@@ -392,9 +389,8 @@ class Dejala extends CarrierModule
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
//$context->smarty->assign('country', $this->dejalaConfig->country);
|
||||
//$this->context->smarty->assign('country', $this->dejalaConfig->country);
|
||||
$output = $this->display(__FILE__, 'dejala_header.tpl');
|
||||
if (!empty($_POST))
|
||||
{
|
||||
@@ -420,18 +416,17 @@ class Dejala extends CarrierModule
|
||||
|
||||
public function displayForm()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$errors = array();
|
||||
$outputMain = '';
|
||||
$context->smarty->assign("djl_mode", $this->dejalaConfig->mode);
|
||||
$context->smarty->assign("disabled", '');
|
||||
$this->context->smarty->assign("djl_mode", $this->dejalaConfig->mode);
|
||||
$this->context->smarty->assign("disabled", '');
|
||||
if ($this->dejalaConfig->mode == 'PROD')
|
||||
$context->smarty->assign("disabled", 'disabled="disabled"');
|
||||
$this->context->smarty->assign("disabled", 'disabled="disabled"');
|
||||
if (true !== extension_loaded('curl'))
|
||||
{
|
||||
$errors[] = $this->l('This module requires php extension cURL to function properly. Please install the php extension "cURL" first.');
|
||||
$context->smarty->assign("disabled", 'disabled="disabled"');
|
||||
$this->context->smarty->assign("disabled", 'disabled="disabled"');
|
||||
}
|
||||
|
||||
$registered = TRUE;
|
||||
@@ -453,7 +448,7 @@ class Dejala extends CarrierModule
|
||||
}
|
||||
}
|
||||
|
||||
$context->smarty->assign("registered", $registered?"1":"0");
|
||||
$this->context->smarty->assign("registered", $registered?"1":"0");
|
||||
|
||||
|
||||
if (!isset($_GET['cat']) || ($_GET['cat']==='home') || ($_GET['cat']===''))
|
||||
@@ -461,19 +456,19 @@ class Dejala extends CarrierModule
|
||||
else
|
||||
$currentTab=$_GET['cat'];
|
||||
|
||||
$context->smarty->assign("currentTab", $currentTab);
|
||||
$context->smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']);
|
||||
$context->smarty->assign("formAction", $_SERVER['REQUEST_URI']);
|
||||
$this->context->smarty->assign("currentTab", $currentTab);
|
||||
$this->context->smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']);
|
||||
$this->context->smarty->assign("formAction", $_SERVER['REQUEST_URI']);
|
||||
$outputMenu = $this->display(__FILE__, 'dejala_menu.tpl');
|
||||
|
||||
if ($currentTab==='home')
|
||||
{
|
||||
$context->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8'));
|
||||
$this->context->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8'));
|
||||
if ($registered)
|
||||
{
|
||||
$context->smarty->assign("visibility_status", $this->dejalaConfig->visibility_status);
|
||||
$context->smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list);
|
||||
$context->smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8'));
|
||||
$this->context->smarty->assign("visibility_status", $this->dejalaConfig->visibility_status);
|
||||
$this->context->smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list);
|
||||
$this->context->smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8'));
|
||||
$smartifyErrors = $this->smartyfyStoreAttributes();
|
||||
if (isset($smartifyErrors) && count($smartifyErrors))
|
||||
$errors = $smartifyErrors;
|
||||
@@ -483,7 +478,7 @@ class Dejala extends CarrierModule
|
||||
$shopName = Configuration::get('PS_SHOP_NAME');
|
||||
if (strlen($shopName) >= 15)
|
||||
$shopName = substr($shopName, 0, 15);
|
||||
$context->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8'));
|
||||
$this->context->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8'));
|
||||
}
|
||||
$outputMain = $this->display(__FILE__, 'dejala_home.tpl');
|
||||
}
|
||||
@@ -496,7 +491,7 @@ class Dejala extends CarrierModule
|
||||
{
|
||||
foreach ($contacts as $contactName=>$contactData) {
|
||||
foreach ($contactData as $key=>$value) {
|
||||
$context->smarty->assign($contactName.'_'.$key, $value);
|
||||
$this->context->smarty->assign($contactName.'_'.$key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,7 +505,7 @@ class Dejala extends CarrierModule
|
||||
if ('200' == $responseArray['status'])
|
||||
{
|
||||
foreach ($location as $key=>$value)
|
||||
$context->smarty->assign($key, $value);
|
||||
$this->context->smarty->assign($key, $value);
|
||||
|
||||
$outputMain = $this->display(__FILE__, 'dejala_location.tpl');
|
||||
}
|
||||
@@ -523,7 +518,7 @@ class Dejala extends CarrierModule
|
||||
if ('200' == $responseArray['status'])
|
||||
{
|
||||
foreach ($processes as $key=>$value)
|
||||
$context->smarty->assign($key, $value);
|
||||
$this->context->smarty->assign($key, $value);
|
||||
|
||||
$outputMain = $this->display(__FILE__, 'dejala_processes.tpl');
|
||||
}
|
||||
@@ -544,7 +539,7 @@ class Dejala extends CarrierModule
|
||||
$product['public_price'] = number_format(round($product['price'] + $product['margin'], 2), 2, '.', '');
|
||||
$product['public_price_notax'] = number_format(round($product['public_price']/$vat_factor, 2), 2, '.', '');
|
||||
}
|
||||
$context->smarty->assign('products', $products);
|
||||
$this->context->smarty->assign('products', $products);
|
||||
$outputMain = $this->display(__FILE__, 'dejala_products.tpl');
|
||||
}
|
||||
}
|
||||
@@ -582,10 +577,10 @@ class Dejala extends CarrierModule
|
||||
$delivery['delivery_time'] = date('H\hi', $delivery['delivery_utc']);
|
||||
}
|
||||
}
|
||||
$context->smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php');
|
||||
$context->smarty->assign('defaultDateFrom', date('01/m/Y'));
|
||||
$context->smarty->assign('defaultDateTo', date('d/m/Y'));
|
||||
$context->smarty->assign('deliveries', $deliveries);
|
||||
$this->context->smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php');
|
||||
$this->context->smarty->assign('defaultDateFrom', date('01/m/Y'));
|
||||
$this->context->smarty->assign('defaultDateTo', date('d/m/Y'));
|
||||
$this->context->smarty->assign('deliveries', $deliveries);
|
||||
$outputMain = $this->display(__FILE__, 'dejala_deliveries.tpl');
|
||||
}
|
||||
}
|
||||
@@ -608,9 +603,9 @@ class Dejala extends CarrierModule
|
||||
$m_status['checked'] = '0';
|
||||
$orderStatuses[] = $m_status;
|
||||
}
|
||||
$context->smarty->assign('statuses', $orderStatuses);
|
||||
$this->context->smarty->assign('statuses', $orderStatuses);
|
||||
|
||||
$context->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses);
|
||||
$this->context->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses);
|
||||
$outputMain = $this->display(__FILE__, 'dejala_technical_options.tpl');
|
||||
}
|
||||
|
||||
@@ -630,7 +625,6 @@ class Dejala extends CarrierModule
|
||||
// put in smarty context store attributes
|
||||
function smartyfyStoreAttributes()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$errors = array();
|
||||
$djlUtil = new DejalaUtils();
|
||||
$storeAttrs = array();
|
||||
@@ -639,20 +633,20 @@ class Dejala extends CarrierModule
|
||||
$errors[] = $this->l('An error occurred while getting store, please try again later or contact Dejala.com');
|
||||
else
|
||||
{
|
||||
$context->smarty->assign("account_balance", $storeAttrs['account_balance']);
|
||||
$context->smarty->assign("store_name", $storeAttrs['name']);
|
||||
$this->context->smarty->assign("account_balance", $storeAttrs['account_balance']);
|
||||
$this->context->smarty->assign("store_name", $storeAttrs['name']);
|
||||
|
||||
// Check if account exists in production
|
||||
$responsePing = $djlUtil->ping($this->dejalaConfig, 'PROD');
|
||||
if ('200' == $responsePing['status'])
|
||||
$context->smarty->assign('isLiveReady', '1');
|
||||
$this->context->smarty->assign('isLiveReady', '1');
|
||||
else
|
||||
{
|
||||
$context->smarty->assign('isLiveReady', '0');
|
||||
$this->context->smarty->assign('isLiveReady', '0');
|
||||
if (isset($storeAttrs['attributes']) && isset($storeAttrs['attributes']['request_live']) && ($storeAttrs['attributes']['request_live']=='true'))
|
||||
$context->smarty->assign('isLiveRequested', '1');
|
||||
$this->context->smarty->assign('isLiveRequested', '1');
|
||||
else
|
||||
$context->smarty->assign('isLiveRequested', '0');
|
||||
$this->context->smarty->assign('isLiveRequested', '0');
|
||||
}
|
||||
}
|
||||
return ($errors);
|
||||
@@ -665,7 +659,6 @@ class Dejala extends CarrierModule
|
||||
}
|
||||
|
||||
function displayDeliveryOptions(){
|
||||
$context = Context::getContext();
|
||||
/*
|
||||
Au moment du choix du créneau
|
||||
Pour déterminer le créneau de départ proposé :
|
||||
@@ -682,26 +675,26 @@ class Dejala extends CarrierModule
|
||||
$response = $djlUtil->getStoreAttributes($this->dejalaConfig, $store);
|
||||
if ($response['status'] == 200)
|
||||
{
|
||||
$context->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']);
|
||||
$context->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']);
|
||||
$this->context->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']);
|
||||
$this->context->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']);
|
||||
if (isset($store['attributes']['delivery_partial']))
|
||||
$context->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']);
|
||||
$this->context->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']);
|
||||
}
|
||||
|
||||
$wday_selected = array(1, 1, 1, 1, 1, 1, 1);
|
||||
|
||||
$context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
||||
$context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
||||
$context->smarty->assign("weekdayLabels", $this->wday_labels);
|
||||
$context->smarty->assign("weekdaySelected", $wday_selected);
|
||||
$this->context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
||||
$this->context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
||||
$this->context->smarty->assign("weekdayLabels", $this->wday_labels);
|
||||
$this->context->smarty->assign("weekdaySelected", $wday_selected);
|
||||
|
||||
|
||||
$calendar = array();
|
||||
$response = $djlUtil->getStoreCalendar($this->dejalaConfig, $calendar);
|
||||
if ($response['status'] == 200)
|
||||
{
|
||||
$context->smarty->assign("calendar", $calendar);
|
||||
$context->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl");
|
||||
$this->context->smarty->assign("calendar", $calendar);
|
||||
$this->context->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl");
|
||||
}
|
||||
$output = $output . $this->display(__FILE__, 'dejala_delivery_options.tpl');
|
||||
|
||||
@@ -733,7 +726,6 @@ class Dejala extends CarrierModule
|
||||
*/
|
||||
public function hookExtraCarrier($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$cart = $params['cart'];
|
||||
|
||||
@@ -743,9 +735,9 @@ class Dejala extends CarrierModule
|
||||
if ($this->dejalaConfig->visibility_status == "invisible")
|
||||
return ;
|
||||
|
||||
if (($this->dejalaConfig->visibility_status == "visible_limited") && ((int)$context->customer->id > 0))
|
||||
if (($this->dejalaConfig->visibility_status == "visible_limited") && ((int)$this->context->customer->id > 0))
|
||||
{
|
||||
$customer = $context->customer;
|
||||
$customer = $this->context->customer;
|
||||
if (!in_array($customer->email, preg_split("/[\s,]+/", $this->dejalaConfig->visible_users_list)))
|
||||
return ;
|
||||
}
|
||||
@@ -771,7 +763,7 @@ class Dejala extends CarrierModule
|
||||
if (isset($cart->id_address_delivery) AND $cart->id_address_delivery)
|
||||
$id_zone = (int)Address::getZoneById((int)($cart->id_address_delivery));
|
||||
else
|
||||
$id_zone = (int)$context->country->id_zone;
|
||||
$id_zone = (int)$this->context->country->id_zone;
|
||||
|
||||
$djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ;
|
||||
|
||||
@@ -871,8 +863,8 @@ class Dejala extends CarrierModule
|
||||
|
||||
|
||||
$this->mylog("date$=" . $this->logValue($dates,1));
|
||||
$context->smarty->assign('nb_days', $nbDeliveryDates);
|
||||
$context->smarty->assign('dates', $dates);
|
||||
$this->context->smarty->assign('nb_days', $nbDeliveryDates);
|
||||
$this->context->smarty->assign('dates', $dates);
|
||||
for ($i=0; $i < 24; $i++)
|
||||
{
|
||||
$endHour = (($i+$electedProduct['timelimit'])%24);
|
||||
@@ -880,10 +872,10 @@ class Dejala extends CarrierModule
|
||||
$endHour = 24;
|
||||
$hourLabels[] = $i . 'h-' . $endHour . 'h';
|
||||
}
|
||||
$context->smarty->assign('hourLabels', $hourLabels);
|
||||
$this->context->smarty->assign('hourLabels', $hourLabels);
|
||||
|
||||
$context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
||||
$context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
||||
$this->context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css');
|
||||
$this->context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js');
|
||||
|
||||
$this->mylog("electedCarrier->id=" . $this->logValue($djlCarrier->id));
|
||||
$mCarrier = $djlCarrier;
|
||||
@@ -896,9 +888,9 @@ class Dejala extends CarrierModule
|
||||
|
||||
$resultsArray[] = $row;
|
||||
|
||||
$context->smarty->assign('carriers', $resultsArray);
|
||||
$context->smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ;
|
||||
$context->smarty->assign('product', $electedProduct);
|
||||
$this->context->smarty->assign('carriers', $resultsArray);
|
||||
$this->context->smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ;
|
||||
$this->context->smarty->assign('product', $electedProduct);
|
||||
|
||||
|
||||
$djlCart = new DejalaCart($cart->id);
|
||||
@@ -915,21 +907,21 @@ class Dejala extends CarrierModule
|
||||
{
|
||||
if ($l_date['value'] == $deliveryDateSelected)
|
||||
{
|
||||
$context->smarty->assign("deliveryDateIndexSelected", $l_key);
|
||||
$context->smarty->assign("deliveryDateSelected", $deliveryDateSelected);
|
||||
$context->smarty->assign("deliveryHourSelected", $m_hour);
|
||||
$this->context->smarty->assign("deliveryDateIndexSelected", $l_key);
|
||||
$this->context->smarty->assign("deliveryDateSelected", $deliveryDateSelected);
|
||||
$this->context->smarty->assign("deliveryHourSelected", $m_hour);
|
||||
$setDefaultDate = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($setDefaultDate)
|
||||
{
|
||||
$context->smarty->assign("deliveryDateIndexSelected", 0);
|
||||
$context->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc));
|
||||
$context->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc)));
|
||||
$this->context->smarty->assign("deliveryDateIndexSelected", 0);
|
||||
$this->context->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc));
|
||||
$this->context->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc)));
|
||||
}
|
||||
|
||||
$context->smarty->assign("isCartOutOfStock", $isCartOutOfStock);
|
||||
$this->context->smarty->assign("isCartOutOfStock", $isCartOutOfStock);
|
||||
if (!$isCartOutOfStock)
|
||||
{
|
||||
$buffer = $this->display(__FILE__, 'dejala_carrier.tpl');
|
||||
@@ -937,7 +929,7 @@ class Dejala extends CarrierModule
|
||||
}
|
||||
else
|
||||
{
|
||||
$context->smarty->assign('nostock_info', $this->l('I will select my shipping date when my product is available.'));
|
||||
$this->context->smarty->assign('nostock_info', $this->l('I will select my shipping date when my product is available.'));
|
||||
$buffer = $this->display(__FILE__, 'dejala_carrier_nostock.tpl');
|
||||
}
|
||||
return $buffer;
|
||||
@@ -1025,7 +1017,6 @@ class Dejala extends CarrierModule
|
||||
public function hookProcessCarrier($params)
|
||||
{
|
||||
// FO: Temporary. Necessary to go around the product's cart re-instanciation bug.
|
||||
$context = Context::getContext();
|
||||
|
||||
$cartParams = $params['cart'];
|
||||
$this->hooklog("processCarrier", $params) ;
|
||||
@@ -1073,7 +1064,7 @@ class Dejala extends CarrierModule
|
||||
}
|
||||
|
||||
// FO: VERY DIRTY HACK.... Re-assign the global cart to what it was before.
|
||||
$context->cart = $cartParams ;
|
||||
$this->context->cart = $cartParams ;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
return ($l_array);
|
||||
}
|
||||
|
||||
global $smarty;
|
||||
$dejalaConfig = new DejalaConfig();
|
||||
$dejalaConfig->loadConfig();
|
||||
|
||||
@@ -66,7 +65,7 @@
|
||||
}
|
||||
$l_deliveries[$key] = $l_delivery;
|
||||
}
|
||||
$smarty->assign('deliveries', $l_deliveries);
|
||||
$smarty->display(dirname(__FILE__).'/dejala_deliveries_csv.tpl');
|
||||
Context::getContext()->smarty->assign('deliveries', $l_deliveries);
|
||||
Context::getContext()->smarty->display(dirname(__FILE__).'/dejala_deliveries_csv.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
+4
-11
@@ -66,11 +66,6 @@ class dibs extends PaymentModule
|
||||
* @staticvar
|
||||
*/
|
||||
private static $site_url;
|
||||
/**
|
||||
* Set the smarty object
|
||||
* @var Smarty
|
||||
*/
|
||||
private $smarty;
|
||||
|
||||
/**
|
||||
* Only this langs array are allowed in DIBS API
|
||||
@@ -91,8 +86,6 @@ class dibs extends PaymentModule
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $smarty;
|
||||
$this->smarty = $smarty;
|
||||
$this->name = 'dibs';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '1.0';
|
||||
@@ -153,9 +146,9 @@ class dibs extends PaymentModule
|
||||
return;
|
||||
|
||||
if ($params['objOrder']->valid)
|
||||
$this->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id));
|
||||
$this->context->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id));
|
||||
else
|
||||
$this->smarty->assign('status', 'failed');
|
||||
$this->context->smarty->assign('status', 'failed');
|
||||
return $this->display(__FILE__, 'hookorderconfirmation.tpl');
|
||||
}
|
||||
|
||||
@@ -397,8 +390,8 @@ class dibs extends PaymentModule
|
||||
$dibsParams['priceinfo2.ProductsAmount'] = $params['cart']->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING);
|
||||
$dibsParams['priceinfo3.AmountWithoutTax'] = $params['cart']->getOrderTotal(false, Cart::BOTH);
|
||||
$dibsParams['priceinfo4.AmountTotalTax'] = (float)($params['cart']->getOrderTotal(true, Cart::BOTH) - $params['cart']->getOrderTotal(false, Cart::BOTH));
|
||||
$this->smarty->assign('p', $dibsParams);
|
||||
$this->smarty->assign('logo_color', self::$MORE_SETTINGS['logo_color']);
|
||||
$this->context->smarty->assign('p', $dibsParams);
|
||||
$this->context->smarty->assign('logo_color', self::$MORE_SETTINGS['logo_color']);
|
||||
return $this->display(__FILE__, 'dibs.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
+21
-40
@@ -54,8 +54,6 @@ class Ebay extends Module
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->name = 'ebay';
|
||||
$this->tab = 'market_place';
|
||||
$this->version = '1.1';
|
||||
@@ -65,7 +63,7 @@ class Ebay extends Module
|
||||
$this->id_lang = Language::getIdByIso('fr');
|
||||
|
||||
// Check the country and ask the bypass if not 'fr'
|
||||
if (strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) != 'fr' && !isset($cookie->ebay_country_default_fr))
|
||||
if (strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) != 'fr' && !isset($this->context->cookie->ebay_country_default_fr))
|
||||
{
|
||||
$this->warning = $this->l('eBay module currently works only for eBay.fr');
|
||||
return false;
|
||||
@@ -144,8 +142,6 @@ class Ebay extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
// Install SQL
|
||||
include(dirname(__FILE__).'/sql-install.php');
|
||||
foreach ($sql as $s)
|
||||
@@ -181,8 +177,6 @@ class Ebay extends Module
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
// Uninstall Config
|
||||
foreach ($this->_fieldsList as $keyConfiguration => $name)
|
||||
if (!Configuration::deleteByName($keyConfiguration))
|
||||
@@ -225,8 +219,8 @@ class Ebay extends Module
|
||||
return false;
|
||||
|
||||
// Clean Cookie
|
||||
$cookie->eBaySession = '';
|
||||
$cookie->eBayUsername = '';
|
||||
$this->context->cookie->eBaySession = '';
|
||||
$this->context->cookie->eBayUsername = '';
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -415,14 +409,12 @@ class Ebay extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie;
|
||||
$this->_html .= '<h2>' . $this->l('eBay').'</h2>';
|
||||
|
||||
|
||||
// Checking Country
|
||||
if (Tools::getValue('ebay_country_default_fr') == 'ok')
|
||||
$cookie->ebay_country_default_fr = true;
|
||||
if (strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) != 'fr' && !isset($cookie->ebay_country_default_fr))
|
||||
$this->context->cookie->ebay_country_default_fr = true;
|
||||
if (strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) != 'fr' && !isset($this->context->cookie->ebay_country_default_fr))
|
||||
return $this->_html.$this->displayError($this->l('eBay module currently works only for eBay.fr').'. <a href="'.$_SERVER['REQUEST_URI'].'&ebay_country_default_fr=ok">'.$this->l('Continue anyway ?').'</a>');
|
||||
|
||||
|
||||
@@ -466,7 +458,7 @@ class Ebay extends Module
|
||||
|
||||
// Displaying Information from Prestashop
|
||||
$context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5)));
|
||||
$prestashopContent = @file_get_contents('http://www.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'®istered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context);
|
||||
$prestashopContent = @file_get_contents('http://www.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'®istered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context);
|
||||
|
||||
|
||||
// Displaying page
|
||||
@@ -528,18 +520,17 @@ class Ebay extends Module
|
||||
|
||||
private function _displayFormRegister()
|
||||
{
|
||||
global $cookie;
|
||||
$ebay = new eBayRequest();
|
||||
|
||||
if (!empty($cookie->eBaySession) && isset($_GET['action']) && $_GET['action'] == 'logged')
|
||||
if (!empty($this->context->cookie->eBaySession) && isset($_GET['action']) && $_GET['action'] == 'logged')
|
||||
{
|
||||
if (isset($_POST['eBayUsername']))
|
||||
{
|
||||
$cookie->eBayUsername = $_POST['eBayUsername'];
|
||||
$this->context->cookie->eBayUsername = $_POST['eBayUsername'];
|
||||
Configuration::updateValue('EBAY_API_USERNAME', $_POST['eBayUsername']);
|
||||
}
|
||||
$ebay->session = $cookie->eBaySession;
|
||||
$ebay->username = $cookie->eBayUsername;
|
||||
$ebay->session = $this->context->cookie->eBaySession;
|
||||
$ebay->username = $this->context->cookie->eBayUsername;
|
||||
|
||||
$html = '
|
||||
<script>
|
||||
@@ -565,10 +556,10 @@ class Ebay extends Module
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($cookie->eBaySession))
|
||||
if (empty($this->context->cookie->eBaySession))
|
||||
{
|
||||
$ebay->login();
|
||||
$cookie->eBaySession = $ebay->session;
|
||||
$this->context->cookie->eBaySession = $ebay->session;
|
||||
Configuration::updateValue('EBAY_API_SESSION', $ebay->session);
|
||||
}
|
||||
|
||||
@@ -583,7 +574,7 @@ class Ebay extends Module
|
||||
return false;
|
||||
}
|
||||
else
|
||||
window.open(\''.$ebay->getLoginUrl().'?SignIn&runame='.$ebay->runame.'&SessID='.$cookie->eBaySession.'\');
|
||||
window.open(\''.$ebay->getLoginUrl().'?SignIn&runame='.$ebay->runame.'&SessID='.$this->context->cookie->eBaySession.'\');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -593,7 +584,7 @@ class Ebay extends Module
|
||||
<label>'.$this->l('Click on the button below').'</label>
|
||||
<div class="margin-form">
|
||||
<br class="clear"/>
|
||||
<label for="eBayUsername">'.$this->l('eBay User ID').' </label><input id="eBayUsername" type="text" name="eBayUsername" value="'.$cookie->eBayUsername.'" />
|
||||
<label for="eBayUsername">'.$this->l('eBay User ID').' </label><input id="eBayUsername" type="text" name="eBayUsername" value="'.$this->context->cookie->eBayUsername.'" />
|
||||
<br class="clear"/><br />
|
||||
<input type="submit" id="button_ebay" class="button" value="'.$this->l('Register the module on eBay').'" />
|
||||
</div>
|
||||
@@ -667,8 +658,6 @@ class Ebay extends Module
|
||||
|
||||
private function _displayFormParameters()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
// Loading config currency
|
||||
$configCurrency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
|
||||
|
||||
@@ -797,8 +786,6 @@ class Ebay extends Module
|
||||
|
||||
private function _displayFormCategory()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
// Check if the module is configured
|
||||
if (!Configuration::get('EBAY_PAYPAL_EMAIL'))
|
||||
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
|
||||
@@ -818,7 +805,7 @@ class Ebay extends Module
|
||||
$categoryConfigListTmp = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'ebay_category_configuration`');
|
||||
foreach ($categoryConfigListTmp as $c)
|
||||
$categoryConfigList[$c['id_category']] = $c;
|
||||
$categoryList = $this->_getChildCategories(Category::getCategories($cookie->id_lang), 0);
|
||||
$categoryList = $this->_getChildCategories(Category::getCategories($this->context->language->id), 0);
|
||||
$eBayCategoryList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'ebay_category` WHERE `id_category_ref` = `id_category_ref_parent`');
|
||||
|
||||
|
||||
@@ -917,7 +904,6 @@ class Ebay extends Module
|
||||
private function _postProcessCategory()
|
||||
{
|
||||
// Init Var
|
||||
global $cookie;
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$services = Tools::getValue('service');
|
||||
|
||||
@@ -992,13 +978,11 @@ class Ebay extends Module
|
||||
|
||||
private function _displayFormTemplateManager()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
// Check if the module is configured
|
||||
if (!Configuration::get('EBAY_PAYPAL_EMAIL'))
|
||||
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
|
||||
|
||||
$iso = Language::getIsoById((int)($cookie->id_lang));
|
||||
$iso = $context->language->iso_code;
|
||||
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
|
||||
$ad = dirname($_SERVER["PHP_SELF"]);
|
||||
|
||||
@@ -1083,8 +1067,6 @@ class Ebay extends Module
|
||||
|
||||
private function _displayFormEbaySync()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
// Check if the module is configured
|
||||
if (!Configuration::get('EBAY_PAYPAL_EMAIL'))
|
||||
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
|
||||
@@ -1170,7 +1152,7 @@ class Ebay extends Module
|
||||
$categoryConfigListTmp = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'ebay_category_configuration`');
|
||||
foreach ($categoryConfigListTmp as $c)
|
||||
$categoryConfigList[$c['id_category']] = $c;
|
||||
$categoryList = $this->_getChildCategories(Category::getCategories($cookie->id_lang), 0);
|
||||
$categoryList = $this->_getChildCategories(Category::getCategories($this->context->language->id), 0);
|
||||
$html .= '<table class="table tableDnD" cellpadding="0" cellspacing="0" width="90%">
|
||||
<thead>
|
||||
<tr class="nodrag nodrop">
|
||||
@@ -1256,7 +1238,6 @@ class Ebay extends Module
|
||||
|
||||
private function _syncProducts($productsList)
|
||||
{
|
||||
global $link;
|
||||
$fees = 0;
|
||||
$count = 0;
|
||||
$count_success = 0;
|
||||
@@ -1288,9 +1269,9 @@ class Ebay extends Module
|
||||
$images = $product->getImages($this->id_lang);
|
||||
foreach ($images as $image)
|
||||
{
|
||||
$pictures[] = $prefix.$link->getImageLink('', $product->id.'-'.$image['id_image'], NULL);
|
||||
$picturesMedium[] = $prefix.$link->getImageLink('', $product->id.'-'.$image['id_image'], 'medium');
|
||||
$picturesLarge[] = $prefix.$link->getImageLink('', $product->id.'-'.$image['id_image'], 'large');
|
||||
$pictures[] = $prefix.$this->context->link->getImageLink('', $product->id.'-'.$image['id_image'], NULL);
|
||||
$picturesMedium[] = $prefix.$this->context->link->getImageLink('', $product->id.'-'.$image['id_image'], 'medium');
|
||||
$picturesLarge[] = $prefix.$this->context->link->getImageLink('', $product->id.'-'.$image['id_image'], 'large');
|
||||
}
|
||||
|
||||
// Load Variations
|
||||
@@ -1326,7 +1307,7 @@ class Ebay extends Module
|
||||
if (isset($combinationsImages) && !empty($combinationsImages) && count($combinationsImages) > 0)
|
||||
foreach ($combinationsImages as $ci)
|
||||
foreach ($ci as $i)
|
||||
$variations[$product->id.'-'.$i['id_product_attribute']]['pictures'][] = $prefix.$link->getImageLink('', $product->id.'-'.$i['id_image'], NULL);
|
||||
$variations[$product->id.'-'.$i['id_product_attribute']]['pictures'][] = $prefix.$this->context->link->getImageLink('', $product->id.'-'.$i['id_image'], NULL);
|
||||
|
||||
|
||||
// Load basic price
|
||||
|
||||
@@ -117,7 +117,6 @@ class Editorial extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
/* display the module name */
|
||||
$this->_html = '<h2>'.$this->displayName.'</h2>';
|
||||
@@ -132,7 +131,7 @@ class Editorial extends Module
|
||||
{
|
||||
unlink(dirname(__FILE__).'/homepage_logo.jpg');
|
||||
Configuration::updateValue('EDITORIAL_IMAGE_DISABLE', 1);
|
||||
Tools::redirectAdmin('index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$context->employee->id));
|
||||
Tools::redirectAdmin('index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$this->context->employee->id));
|
||||
}
|
||||
$this->_html .= $errors;
|
||||
}
|
||||
@@ -180,11 +179,10 @@ class Editorial extends Module
|
||||
|
||||
private function _displayForm()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
/* Languages preliminaries */
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = Language::getLanguages(false);
|
||||
$iso = $context->language->iso_code;
|
||||
$iso = $this->context->language->iso_code;
|
||||
$divLangName = 'title¤subheading¤cpara¤logo_subheading';
|
||||
|
||||
$editorial = new EditorialClass(1);
|
||||
@@ -294,15 +292,14 @@ class Editorial extends Module
|
||||
|
||||
public function hookHome($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$editorial = new EditorialClass(1, $context->language->id);
|
||||
$context->smarty->assign(array(
|
||||
$editorial = new EditorialClass(1, $this->context->language->id);
|
||||
$this->context->smarty->assign(array(
|
||||
'editorial' => $editorial,
|
||||
'default_lang' => (int)$context->language->id,
|
||||
'default_lang' => (int)$this->context->language->id,
|
||||
'image_width' => Configuration::get('EDITORIAL_IMAGE_WIDTH'),
|
||||
'image_height' => Configuration::get('EDITORIAL_IMAGE_HEIGHT'),
|
||||
'id_lang' => $context->language->id,
|
||||
'id_lang' => $this->context->language->id,
|
||||
'homepage_logo' => !Configuration::get('EDITORIAL_IMAGE_DISABLE') && file_exists('modules/editorial/homepage_logo.jpg'),
|
||||
'image_path' => $this->_path.'homepage_logo.jpg'
|
||||
));
|
||||
|
||||
@@ -36,8 +36,6 @@ class Envoimoinscher extends Module
|
||||
const INSTALL_SQL_FILE = 'install.sql';
|
||||
function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->name = 'envoimoinscher';
|
||||
$this->tab = 'shipping_logistics';
|
||||
$this->version = '1.0';
|
||||
@@ -81,8 +79,6 @@ class Envoimoinscher extends Module
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE))
|
||||
return false;
|
||||
elseif (!$sql = file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE))
|
||||
@@ -121,8 +117,6 @@ class Envoimoinscher extends Module
|
||||
*/
|
||||
public function uninstall()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'envoimoinscher_contenu`');
|
||||
|
||||
$tab = new Tab(Tab::getIdFromClassName('AdminEnvoiMoinsCher'));
|
||||
@@ -158,12 +152,11 @@ class Envoimoinscher extends Module
|
||||
|
||||
private function _displayForm()
|
||||
{
|
||||
global $cookie;
|
||||
$genderTab = array(1 => 'M.', 2 => 'Mme', 9 => '', 0 => '');
|
||||
$features = Feature::getFeatures($cookie->id_lang);
|
||||
$order_states = OrderState::getOrderStates($cookie->id_lang);
|
||||
$carriers = Carrier::getCarriers($cookie->id_lang);
|
||||
$countries = Country::getCountries($cookie->id_lang);
|
||||
$features = Feature::getFeatures($this->context->language->id);
|
||||
$order_states = OrderState::getOrderStates($this->context->language->id);
|
||||
$carriers = Carrier::getCarriers($this->context->language->id);
|
||||
$countries = Country::getCountries($this->context->language->id);
|
||||
$confs = Configuration::getMultiple(array('PS_SHOP_NAME', 'EMC_LOGIN', 'EMC_GENDER', 'EMC_LAST_NAME', 'EMC_FIRST_NAME', 'EMC_ADDRESS', 'EMC_ZIP_CODE', 'EMC_CITY', 'EMC_COUNTRY',
|
||||
'EMC_PHONE', 'EMC_EMAIL'));
|
||||
$link = '<a href="http://www.envoimoinscher.com/inscription.html?tracking=prestashop_module_v1
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
include('../../config/config.inc.php');
|
||||
include('../../init.php');
|
||||
|
||||
global $cookie;
|
||||
|
||||
$validReturn = array('infoexterne', 'token', 'etat', 'envoi');
|
||||
|
||||
$return = array();
|
||||
@@ -56,7 +54,7 @@ if (isset($return['infoexterne']) AND isset($return['token']) AND isset($return[
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int)($id_order);
|
||||
$history->changeIdOrderState((int)($confs['EMC_ORDER_PAST_STATE']), (int)($history->id_order));
|
||||
$history->id_employee = (int)($cookie->id_employee);
|
||||
$history->id_employee = (int)$this->context->employee->id;
|
||||
$history->addWithemail();
|
||||
|
||||
$db = Db::getInstance();
|
||||
@@ -77,7 +75,7 @@ if (isset($return['infoexterne']) AND isset($return['token']) AND isset($return[
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int)($id_order);
|
||||
$history->changeIdOrderState((int)($confs['EMC_SEND_STATE']), (int)($history->id_order));
|
||||
$history->id_employee = (int)($cookie->id_employee);
|
||||
$history->id_employee = (int)$this->context->employee->id;
|
||||
$history->addWithemail();
|
||||
break;
|
||||
// Cancel
|
||||
@@ -94,7 +92,7 @@ if (isset($return['infoexterne']) AND isset($return['token']) AND isset($return[
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int)($id_order);
|
||||
$history->changeIdOrderState((int)($confs['EMC_DELIVERY_STATE']), (int)($history->id_order));
|
||||
$history->id_employee = (int)($cookie->id_employee);
|
||||
$history->id_employee = (int)$this->context->employee->id;
|
||||
$history->addWithemail();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -440,7 +440,6 @@ class FedexCarrier extends CarrierModule
|
||||
|
||||
private function _displayFormGeneral()
|
||||
{
|
||||
global $cookie;
|
||||
$configCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
|
||||
$html = '<script>
|
||||
@@ -525,7 +524,7 @@ class FedexCarrier extends CarrierModule
|
||||
<select name="fedex_carrier_country" id="fedex_carrier_country">
|
||||
<option value="0">'.$this->l('Select a country ...').'</option>';
|
||||
$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('fedex_carrier_country', Configuration::get('FEDEX_CARRIER_COUNTRY'))) ? 'selected="selected"' : '').'>'.$v['name'].'</option>';
|
||||
$idcountries[] = $v['id_country'];
|
||||
@@ -715,8 +714,6 @@ class FedexCarrier extends CarrierModule
|
||||
|
||||
private function _getPathInTab($id_category)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$category = Db::getInstance()->getRow('
|
||||
SELECT id_category, level_depth, nleft, nright
|
||||
FROM '._DB_PREFIX_.'category
|
||||
@@ -728,7 +725,7 @@ class FedexCarrier extends CarrierModule
|
||||
SELECT c.id_category, cl.name, cl.link_rewrite
|
||||
FROM '._DB_PREFIX_.'category c
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category)
|
||||
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND 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
|
||||
LIMIT '.(int)($category['level_depth'] + 1));
|
||||
|
||||
@@ -773,8 +770,6 @@ class FedexCarrier extends CarrierModule
|
||||
|
||||
private function _displayFormCategory()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
// Check if the module is configured
|
||||
if (!$this->_webserviceTestResult)
|
||||
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
|
||||
@@ -909,7 +904,7 @@ class FedexCarrier extends CarrierModule
|
||||
<div class="margin-form">
|
||||
<select name="id_category">
|
||||
<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>
|
||||
</div>
|
||||
<label>'.$this->l('Pickup Type').' : </label>
|
||||
@@ -1051,8 +1046,6 @@ class FedexCarrier extends CarrierModule
|
||||
|
||||
private function _displayFormProduct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
// Check if the module is configured
|
||||
if (!$this->_webserviceTestResult)
|
||||
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
|
||||
@@ -1080,7 +1073,7 @@ class FedexCarrier extends CarrierModule
|
||||
foreach ($configProductList as $k => $c)
|
||||
{
|
||||
// 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
|
||||
$configCurrency = new Currency($c['id_currency']);
|
||||
@@ -1127,7 +1120,7 @@ class FedexCarrier extends CarrierModule
|
||||
{
|
||||
// Loading config
|
||||
$configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'fedex_rate_config` WHERE `id_fedex_rate_config` = '.(int)(Tools::getValue('id_fedex_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§ion=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§ion=product&action=edit&id_fedex_rate_config='.(int)(Tools::getValue('id_fedex_rate_config')).'" method="post" class="form">
|
||||
@@ -1175,7 +1168,7 @@ class FedexCarrier extends CarrierModule
|
||||
<option value="0">'.$this->l('Select a product ...').'</option>';
|
||||
$productsList = Db::getInstance()->ExecuteS('
|
||||
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
|
||||
ORDER BY pl.`name`');
|
||||
foreach ($productsList as $product)
|
||||
|
||||
@@ -58,8 +58,6 @@ class Feeder extends Module
|
||||
|
||||
function hookHeader($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
$id_category = (int)(Tools::getValue('id_category'));
|
||||
if (!$id_category)
|
||||
{
|
||||
@@ -79,7 +77,7 @@ class Feeder extends Module
|
||||
$category = new Category($id_category);
|
||||
$orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));
|
||||
$orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));
|
||||
$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'feedUrl' => Tools::getShopDomain(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/rss.php?id_category='.$id_category.'&orderby='.$orderBy.'&orderway='.$orderWay,
|
||||
));
|
||||
return $this->display(__FILE__, 'feederHeader.tpl');
|
||||
|
||||
@@ -157,8 +157,6 @@ class Fianetfraud extends Module
|
||||
|
||||
private function _postProcess()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$error = false;
|
||||
|
||||
Configuration::updateValue('SAC_PRODUCTION', ((Tools::getValue('fianetfraud_production') == 1 ) ? 1 : 0));
|
||||
@@ -176,11 +174,11 @@ class Fianetfraud extends Module
|
||||
Configuration::updateValue('SAC_PAYMENT_TYPE_'.$payment,Tools::getValue($payment));
|
||||
}
|
||||
|
||||
$categories = Category::getSimpleCategories($cookie->id_lang);
|
||||
$categories = Category::getSimpleCategories($this->context->language->id);
|
||||
foreach ($categories AS $category)
|
||||
Configuration::updateValue('SAC_CATEGORY_TYPE_'.$category['id_category'],Tools::getValue('cat_'.$category['id_category']));
|
||||
|
||||
$carriers = Carrier::getCarriers($cookie->id_lang);
|
||||
$carriers = Carrier::getCarriers($this->context->language->id);
|
||||
foreach ($carriers as $carrier)
|
||||
{
|
||||
if (isset($_POST['carrier_'.$carrier['id_carrier']]))
|
||||
|
||||
@@ -231,8 +231,7 @@ class FianetSceau extends Module
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
global $cookie;
|
||||
return '<a href="javascript:;" onclick="varwin=window.open(\'https://www.fia-net.com/certif/certificat.php?key='.Configuration::get('FIANET_SCEAU_SITEID').'&lang='.Language::getIsoById((int)($cookie->id_lang)).'\', \'certificat\', \'width=650, height=510\', \'toolbar=no, location=no,directories=no, status=no, menubar=no, scrollbars=no, resizable=yes,dependent=yes\');"><img src="https://www.fia-net.com/img/logos/'.(($cookie->id_lang != 2 ) ? 'en/' : '' ).'rouge3bc.gif" title="Voir la fiche marchand sur Fia-net.com" alt="Voir la fiche marchand sur Fia-net.com" /></a>';
|
||||
return '<a href="javascript:;" onclick="varwin=window.open(\'https://www.fia-net.com/certif/certificat.php?key='.Configuration::get('FIANET_SCEAU_SITEID').'&lang='.$this->context->language->iso_code.'\', \'certificat\', \'width=650, height=510\', \'toolbar=no, location=no,directories=no, status=no, menubar=no, scrollbars=no, resizable=yes,dependent=yes\');"><img src="https://www.fia-net.com/img/logos/'.(($this->context->language->id != 2 ) ? 'en/' : '' ).'rouge3bc.gif" title="Voir la fiche marchand sur Fia-net.com" alt="Voir la fiche marchand sur Fia-net.com" /></a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,20 +126,18 @@ class GAnalytics extends Module
|
||||
|
||||
function hookHeader($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
// hookOrderConfirmation() already send the sats bypass this step
|
||||
if (strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__.'order-confirmation.php') === 0) return '';
|
||||
|
||||
// Otherwise, create Google Analytics stats
|
||||
$ganalytics_id = Configuration::get('GANALYTICS_ID');
|
||||
$multilang = (Language::countActiveLanguages() > 1);
|
||||
$defaultMetaOrder = Meta::getMetaByPage('order',(int)$cookie->id_lang);
|
||||
$defaultMetaOrder = Meta::getMetaByPage('order',$this->context->language->id);
|
||||
$order = ($multilang?((string)Tools::getValue('isolang').'/'):'').$defaultMetaOrder['url_rewrite'];
|
||||
$pageTrack = ((strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__.'order.php') === 0 || strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__.($multilang?((string)Tools::getValue('isolang').'/'):'').$defaultMetaOrder['url_rewrite']) === 0) ? '/order/step'.(int)(Tools::getValue('step')).'.html' : '');
|
||||
$smarty->assign('ganalytics_id', $ganalytics_id);
|
||||
$smarty->assign('pageTrack', $pageTrack);
|
||||
$smarty->assign('isOrder', false);
|
||||
$this->context->smarty->assign('ganalytics_id', $ganalytics_id);
|
||||
$this->context->smarty->assign('pageTrack', $pageTrack);
|
||||
$this->context->smarty->assign('isOrder', false);
|
||||
return $this->display(__FILE__, 'header.tpl');
|
||||
}
|
||||
|
||||
@@ -152,7 +150,6 @@ class GAnalytics extends Module
|
||||
|
||||
function hookOrderConfirmation($params)
|
||||
{
|
||||
global $smarty;
|
||||
// Setting parameters
|
||||
$parameters = Configuration::getMultiple(array('PS_LANG_DEFAULT'));
|
||||
|
||||
@@ -198,11 +195,11 @@ class GAnalytics extends Module
|
||||
}
|
||||
$ganalytics_id = Configuration::get('GANALYTICS_ID');
|
||||
$pageTrack = (strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__.'order.php') === 0 ? '/order/step'.intval($step).'.html' : '');
|
||||
$smarty->assign('items', $items);
|
||||
$smarty->assign('trans', $trans);
|
||||
$smarty->assign('ganalytics_id', $ganalytics_id);
|
||||
$smarty->assign('pageTrack', $pageTrack);
|
||||
$smarty->assign('isOrder', true);
|
||||
$this->context->smarty->assign('items', $items);
|
||||
$this->context->smarty->assign('trans', $trans);
|
||||
$this->context->smarty->assign('ganalytics_id', $ganalytics_id);
|
||||
$this->context->smarty->assign('pageTrack', $pageTrack);
|
||||
$this->context->smarty->assign('isOrder', true);
|
||||
return $this->display(__FILE__, 'header.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,8 +74,6 @@ class GCheckout extends PaymentModule
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (Tools::isSubmit('submitGoogleCheckout'))
|
||||
{
|
||||
$errors = array();
|
||||
@@ -177,9 +175,7 @@ class GCheckout extends PaymentModule
|
||||
if (!$this->active)
|
||||
return;
|
||||
|
||||
global $smarty;
|
||||
|
||||
$smarty->assign('buttonText', $this->l('Pay with GoogleCheckout'));
|
||||
$this->context->smarty->assign('buttonText', $this->l('Pay with GoogleCheckout'));
|
||||
return $this->display(__FILE__, 'payment.tpl');
|
||||
}
|
||||
|
||||
@@ -192,19 +188,17 @@ class GCheckout extends PaymentModule
|
||||
|
||||
public function preparePayment()
|
||||
{
|
||||
global $smarty, $cart, $cookie;
|
||||
|
||||
require_once(dirname(__FILE__).'/library/googlecart.php');
|
||||
require_once(dirname(__FILE__).'/library/googleitem.php');
|
||||
require_once(dirname(__FILE__).'/library/googleshipping.php');
|
||||
|
||||
$currency = $this->getCurrency((int)$cart->id_currency);
|
||||
$currency = $this->getCurrency($this->context->cart->id_currency);
|
||||
|
||||
if ($cart->id_currency != $currency->id)
|
||||
if ($this->context->cart->id_currency != $currency->id)
|
||||
{
|
||||
$cart->id_currency = (int)$currency->id;
|
||||
$cookie->id_currency = (int)$cart->id_currency;
|
||||
$cart->update();
|
||||
$this->context->cart->id_currency = (int)$currency->id;
|
||||
$this->context->cookie->id_currency = (int)$this->context->cart->id_currency;
|
||||
$this->context->cart->update();
|
||||
Tools::redirect('modules/'.$this->name.'/payment.php');
|
||||
}
|
||||
|
||||
@@ -213,34 +207,34 @@ class GCheckout extends PaymentModule
|
||||
Configuration::get('GCHECKOUT_MERCHANT_KEY'),
|
||||
Configuration::get('GCHECKOUT_MODE'), $currency->iso_code);
|
||||
|
||||
foreach ($cart->getProducts() AS $product)
|
||||
foreach ($this->context->cart->getProducts() AS $product)
|
||||
$googleCart->AddItem(new GoogleItem(utf8_decode($product['name'].
|
||||
((isset($product['attributes']) AND !empty($product['attributes'])) ?
|
||||
' - '.$product['attributes'] : '')), utf8_decode($product['description_short']),
|
||||
(int)$product['cart_quantity'], $product['price_wt'],
|
||||
strtoupper(Configuration::get('PS_WEIGHT_UNIT')), (float)$product['weight']));
|
||||
|
||||
if ($wrapping = $cart->getOrderTotal(true, Cart::ONLY_WRAPPING))
|
||||
if ($wrapping = $this->context->cart->getOrderTotal(true, Cart::ONLY_WRAPPING))
|
||||
$googleCart->AddItem(new GoogleItem(utf8_decode($this->l('Wrapping')), '', 1, $wrapping));
|
||||
foreach ($cart->getDiscounts() AS $voucher)
|
||||
foreach ($this->context->cart->getDiscounts() AS $voucher)
|
||||
$googleCart->AddItem(new GoogleItem(utf8_decode($voucher['name']),
|
||||
utf8_decode($voucher['description']), 1, '-'.$voucher['value_real']));
|
||||
|
||||
if (!Configuration::get('GCHECKOUT_NO_SHIPPING'))
|
||||
{
|
||||
$carrier = new Carrier((int)($cart->id_carrier), (int)($cookie->id_lang));
|
||||
$carrier = new Carrier((int)($this->context->cart->id_carrier), $this->context->language->id);
|
||||
$googleCart->AddShipping(new GoogleFlatRateShipping(utf8_decode($carrier->name),
|
||||
$cart->getOrderShippingCost($cart->id_carrier)));
|
||||
$this->context->cart->getOrderShippingCost($this->context->cart->id_carrier)));
|
||||
}
|
||||
|
||||
$googleCart->SetEditCartUrl(Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'order.php');
|
||||
$googleCart->SetContinueShoppingUrl(Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'order-confirmation.php');
|
||||
$googleCart->SetRequestBuyerPhone(false);
|
||||
$googleCart->SetMerchantPrivateData($cart->id.'|'.$cart->secure_key);
|
||||
$googleCart->SetMerchantPrivateData($this->context->cart->id.'|'.$this->context->cart->secure_key);
|
||||
|
||||
$total = $cart->getOrderTotal();
|
||||
$total = $this->context->cart->getOrderTotal();
|
||||
|
||||
$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'googleCheckoutExtraForm' => $googleCart->CheckoutButtonCode($this->l('Pay with GoogleCheckout'), 'LARGE'),
|
||||
'total' => $total,
|
||||
'googleTotal' => $total));
|
||||
|
||||
+19
-26
@@ -128,9 +128,7 @@ class Hipay extends PaymentModule
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
global $smarty, $cart;
|
||||
|
||||
$currency = new Currency($this->getModuleCurrency($cart));
|
||||
$currency = new Currency($this->getModuleCurrency($this->context->cart));
|
||||
$hipayAccount = ($this->prod ? Configuration::get('HIPAY_ACCOUNT_'.$currency->iso_code) : Configuration::get('HIPAY_ACCOUNT_TEST_'.$currency->iso_code));
|
||||
$hipayPassword = ($this->prod ? Configuration::get('HIPAY_PASSWORD_'.$currency->iso_code) : Configuration::get('HIPAY_PASSWORD_TEST_'.$currency->iso_code));
|
||||
$hipaySiteId = ($this->prod ? Configuration::get('HIPAY_SITEID_'.$currency->iso_code) : Configuration::get('HIPAY_SITEID_TEST_'.$currency->iso_code));
|
||||
@@ -138,8 +136,8 @@ class Hipay extends PaymentModule
|
||||
|
||||
if ($hipayAccount AND $hipayPassword AND $hipaySiteId AND $hipayCategory AND Configuration::get('HIPAY_RATING'))
|
||||
{
|
||||
$smarty->assign('hipay_prod', $this->prod);
|
||||
$smarty->assign(array('this_path' => $this->_path, 'this_path_ssl' => self::getHttpHost(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'));
|
||||
$this->context->smarty->assign('hipay_prod', $this->prod);
|
||||
$this->context->smarty->assign(array('this_path' => $this->_path, 'this_path_ssl' => self::getHttpHost(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'));
|
||||
return $this->display(__FILE__, 'payment.tpl');
|
||||
}
|
||||
}
|
||||
@@ -158,19 +156,17 @@ class Hipay extends PaymentModule
|
||||
|
||||
public function payment()
|
||||
{
|
||||
global $cookie, $cart;
|
||||
|
||||
$id_currency = (int)$this->getModuleCurrency($cart);
|
||||
$id_currency = (int)$this->getModuleCurrency($this->context->cart);
|
||||
// If the currency is forced to a different one than the current one, then the cart must be updated
|
||||
if ($cart->id_currency != $id_currency)
|
||||
if (Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'cart SET id_currency = '.(int)$id_currency.' WHERE id_cart = '.(int)$cart->id))
|
||||
$cart->id_currency = $id_currency;
|
||||
if ($this->context->cart->id_currency != $id_currency)
|
||||
if (Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'cart SET id_currency = '.(int)$id_currency.' WHERE id_cart = '.(int)$this->context->cart->id))
|
||||
$this->context->cart->id_currency = $id_currency;
|
||||
|
||||
$currency = new Currency($id_currency);
|
||||
$language = new Language($cart->id_lang);
|
||||
$customer = new Customer($cart->id_customer);
|
||||
$carrier = new Carrier($cart->id_carrier, $cart->id_lang);
|
||||
$id_zone = self::MysqlGetValue('SELECT id_zone FROM '._DB_PREFIX_.'address a INNER JOIN '._DB_PREFIX_.'country c ON a.id_country = c.id_country WHERE id_address = '.(int)$cart->id_address_delivery);
|
||||
$language = new Language($this->context->cart->id_lang);
|
||||
$customer = new Customer($this->context->cart->id_customer);
|
||||
$carrier = new Carrier($this->context->cart->id_carrier, $this->context->cart->id_lang);
|
||||
$id_zone = self::MysqlGetValue('SELECT id_zone FROM '._DB_PREFIX_.'address a INNER JOIN '._DB_PREFIX_.'country c ON a.id_country = c.id_country WHERE id_address = '.(int)$this->context->cart->id_address_delivery);
|
||||
|
||||
require_once(dirname(__FILE__).'/mapi/mapi_package.php');
|
||||
|
||||
@@ -188,12 +184,12 @@ class Hipay extends PaymentModule
|
||||
$paymentParams->setPaymentMethod(HIPAY_MAPI_METHOD_SIMPLE);
|
||||
$paymentParams->setCaptureDay(HIPAY_MAPI_CAPTURE_IMMEDIATE);
|
||||
$paymentParams->setCurrency(strtoupper($currency->iso_code));
|
||||
$paymentParams->setIdForMerchant($cart->id);
|
||||
$paymentParams->setIdForMerchant($this->context->cart->id);
|
||||
$paymentParams->setMerchantSiteId($hipaySiteId);
|
||||
$paymentParams->setUrlCancel(self::getHttpHost(true, true).'index.php?controller=order&step=3');
|
||||
$paymentParams->setUrlNok(self::getHttpHost(true, true).__PS_BASE_URI__.'index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->id.'&secure_key='.$customer->secure_key);
|
||||
$paymentParams->setUrlOk(self::getHttpHost(true, true).__PS_BASE_URI__.'index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->id.'&secure_key='.$customer->secure_key);
|
||||
$paymentParams->setUrlAck(self::getHttpHost(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/validation.php?token='.$cart->secure_key);
|
||||
$paymentParams->setUrlNok(self::getHttpHost(true, true).__PS_BASE_URI__.'index.php?controller=order-confirmation&id_cart='.(int)$this->context->cart->id.'&id_module='.(int)$this->id.'&secure_key='.$customer->secure_key);
|
||||
$paymentParams->setUrlOk(self::getHttpHost(true, true).__PS_BASE_URI__.'index.php?controller=order-confirmation&id_cart='.(int)$this->context->cart->id.'&id_module='.(int)$this->id.'&secure_key='.$customer->secure_key);
|
||||
$paymentParams->setUrlAck(self::getHttpHost(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/validation.php?token='.$this->context->cart->secure_key);
|
||||
$paymentParams->setBackgroundColor('#FFFFFF');
|
||||
|
||||
if (!$paymentParams->check())
|
||||
@@ -203,9 +199,9 @@ class Hipay extends PaymentModule
|
||||
$item->setName($this->l('Cart'));
|
||||
$item->setInfo('');
|
||||
$item->setquantity(1);
|
||||
$item->setRef($cart->id);
|
||||
$item->setRef($this->context->cart->id);
|
||||
$item->setCategory($hipaycategory);
|
||||
$item->setPrice($cart->getOrderTotal());
|
||||
$item->setPrice($this->context->cart->getOrderTotal());
|
||||
|
||||
try {
|
||||
if (!$item->check())
|
||||
@@ -237,12 +233,11 @@ class Hipay extends PaymentModule
|
||||
Tools::redirectLink($url);
|
||||
else
|
||||
{
|
||||
global $smarty;
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
|
||||
$smarty->assign('errors', array('[Hipay] '.strval($err_msg).' ('.$output.')'));
|
||||
$this->context->smarty->assign('errors', array('[Hipay] '.strval($err_msg).' ('.$output.')'));
|
||||
$_SERVER['HTTP_REFERER'] = self::getHttpHost(true, true).'index.php?controller=order&step=3';
|
||||
$smarty->display(_PS_THEME_DIR_.'errors.tpl');
|
||||
$this->context->smarty->display(_PS_THEME_DIR_.'errors.tpl');
|
||||
|
||||
include(dirname(__FILE__).'/../../footer.php');
|
||||
}
|
||||
@@ -320,8 +315,6 @@ class Hipay extends PaymentModule
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$currencies = DB::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT c.iso_code, c.name, c.sign FROM '._DB_PREFIX_.'currency c');
|
||||
|
||||
if (Tools::isSubmit('submitHipayAZ'))
|
||||
|
||||
@@ -58,9 +58,7 @@ class iAdvize extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$lang = new Language((int)($cookie->id_lang));
|
||||
$lang = $this->context->language;
|
||||
if (!in_array($lang->iso_code, array('fr', 'en', 'es')))
|
||||
$lang->iso_code = 'en';
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ class importerosc extends ImportModule
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->name = 'importerosc';
|
||||
$this->tab = 'migration_tools';
|
||||
$this->version = '1.0';
|
||||
|
||||
@@ -100,15 +100,12 @@ class LiveZilla extends Module
|
||||
|
||||
private function displayBlock()
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
|
||||
if ($livezilla_script = Configuration::get('LIVEZILLA_SCRIPT'))
|
||||
$smarty->assign('LIVEZILLA_SCRIPT', $livezilla_script);
|
||||
$this->context->smarty->assign('LIVEZILLA_SCRIPT', $livezilla_script);
|
||||
elseif ($livezilla_url = Configuration::get('LIVEZILLA_URL'))
|
||||
$smarty->assign('LIVEZILLA_URL', $livezilla_url);
|
||||
$this->context->smarty->assign('LIVEZILLA_URL', $livezilla_url);
|
||||
else
|
||||
$smarty->assign('LIVEZILLA_UNDEFINED', 1);
|
||||
$this->context->smarty->assign('LIVEZILLA_UNDEFINED', 1);
|
||||
return $this->display(__FILE__, 'livezilla.tpl');
|
||||
}
|
||||
|
||||
|
||||
@@ -104,9 +104,8 @@ class LoyaltyModule extends ObjectModel
|
||||
{
|
||||
if (!(int)(Configuration::get('PS_LOYALTY_NONE_AWARD')) AND Product::isDiscounted((int)$product['id_product']))
|
||||
{
|
||||
global $smarty;
|
||||
if (isset($smarty) AND is_object($newProduct) AND $product['id_product'] == $newProduct->id)
|
||||
$smarty->assign('no_pts_discounted', 1);
|
||||
if (isset($this->context->smarty) AND is_object($newProduct) AND $product['id_product'] == $newProduct->id)
|
||||
$this->context->smarty->assign('no_pts_discounted', 1);
|
||||
continue;
|
||||
}
|
||||
$total += ($taxesEnabled == PS_TAX_EXC ? $product['price'] : $product['price_wt'])* (int)($product['cart_quantity']);
|
||||
@@ -120,23 +119,17 @@ class LoyaltyModule extends ObjectModel
|
||||
|
||||
public static function getVoucherValue($nbPoints, $id_currency = NULL)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (empty($id_currency))
|
||||
$id_currency = (int)$cookie->id_currency;
|
||||
|
||||
return (int)$nbPoints * (float)Tools::convertPrice(Configuration::get('PS_LOYALTY_POINT_VALUE'), new Currency((int)$id_currency));
|
||||
$currency = $id_currency ? new Currency($id_currency) : $this->context->currency->id;
|
||||
|
||||
return (int)$nbPoints * (float)Tools::convertPrice(Configuration::get('PS_LOYALTY_POINT_VALUE'), $currency);
|
||||
}
|
||||
|
||||
public static function getNbPointsByPrice($price)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (Configuration::get('PS_CURRENCY_DEFAULT') != $cookie->id_currency)
|
||||
if (Configuration::get('PS_CURRENCY_DEFAULT') != $this->context->currency->id)
|
||||
{
|
||||
$currency = new Currency((int)($cookie->id_currency));
|
||||
if ($currency->conversion_rate)
|
||||
$price = $price / $currency->conversion_rate;
|
||||
if ($this->context->currency->conversion_rate)
|
||||
$price = $price / $this->context->currency->conversion_rate;
|
||||
}
|
||||
|
||||
/* Prevent division by zero */
|
||||
|
||||
@@ -243,13 +243,11 @@ class Loyalty extends Module
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->instanceDefaultStates();
|
||||
$this->_postProcess();
|
||||
|
||||
$categories = Category::getCategories((int)($cookie->id_lang));
|
||||
$order_states = OrderState::getOrderStates((int)$cookie->id_lang);
|
||||
$categories = Category::getCategories($this->context->language->id);
|
||||
$order_states = OrderState::getOrderStates($this->context->language->id);
|
||||
$currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
|
||||
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = Language::getLanguages(false);
|
||||
@@ -442,8 +440,6 @@ class Loyalty extends Module
|
||||
{
|
||||
include_once(dirname(__FILE__).'/LoyaltyModule.php');
|
||||
|
||||
global $smarty;
|
||||
|
||||
$product = new Product((int)Tools::getValue('id_product'));
|
||||
if (Validate::isLoadedObject($product))
|
||||
{
|
||||
@@ -458,14 +454,14 @@ class Loyalty extends Module
|
||||
if (!(int)(Configuration::get('PS_LOYALTY_NONE_AWARD')) AND Product::isDiscounted((int)$product->id))
|
||||
{
|
||||
$points = 0;
|
||||
$smarty->assign('no_pts_discounted', 1);
|
||||
$this->context->smarty->assign('no_pts_discounted', 1);
|
||||
}
|
||||
else
|
||||
$points = (int)(LoyaltyModule::getNbPointsByPrice($product->getPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? false : true, (int)($product->getIdProductAttributeMostExpensive()))));
|
||||
$pointsAfter = $points;
|
||||
$pointsBefore = 0;
|
||||
}
|
||||
$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'points' => (int)($points),
|
||||
'total_points' => (int)($pointsAfter),
|
||||
'point_rate' => Configuration::get('PS_LOYALTY_POINT_RATE'),
|
||||
@@ -521,12 +517,10 @@ class Loyalty extends Module
|
||||
{
|
||||
include_once(dirname(__FILE__).'/LoyaltyModule.php');
|
||||
|
||||
global $smarty;
|
||||
|
||||
if (Validate::isLoadedObject($params['cart']))
|
||||
{
|
||||
$points = LoyaltyModule::getCartNbPoints($params['cart']);
|
||||
$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'points' => (int)$points,
|
||||
'voucher' => LoyaltyModule::getVoucherValue((int)$points),
|
||||
'guest_checkout' => (int)Configuration::get('PS_GUEST_CHECKOUT_ENABLED')
|
||||
|
||||
@@ -252,16 +252,14 @@ class MailAlerts extends Module
|
||||
|
||||
public function hookProductOutOfStock($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
if (!$this->_customer_qty)
|
||||
return ;
|
||||
|
||||
$id_product = (int)($params['product']->id);
|
||||
$id_product_attribute = 0;
|
||||
|
||||
if (!$cookie->isLogged())
|
||||
$smarty->assign('email', 1);
|
||||
if (!$this->context->cookie->isLogged())
|
||||
$this->context->smarty->assign('email', 1);
|
||||
else
|
||||
{
|
||||
$id_customer = (int)($params['cookie']->id_customer);
|
||||
@@ -269,7 +267,7 @@ class MailAlerts extends Module
|
||||
return ;
|
||||
}
|
||||
|
||||
$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'id_product' => $id_product,
|
||||
'id_product_attribute' => $id_product_attribute));
|
||||
|
||||
@@ -289,8 +287,6 @@ class MailAlerts extends Module
|
||||
|
||||
public function hookUpdateQuantity($params)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (is_object($params['product']))
|
||||
$params['product'] = get_object_vars($params['product']);
|
||||
|
||||
@@ -309,9 +305,8 @@ class MailAlerts extends Module
|
||||
'{qty}' => $qty,
|
||||
'{last_qty}' => (int)(Configuration::get('MA_LAST_QTIES')),
|
||||
'{product}' => strval($params['product']['name']).(isset($params['product']['attributes_small']) ? ' '.$params['product']['attributes_small'] : ''));
|
||||
$id_lang = (is_object($cookie) AND isset($cookie->id_lang)) ? (int)$cookie->id_lang : (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
$iso = Language::getIsoById((int)$id_lang);
|
||||
|
||||
|
||||
$iso = $this->context->language->iso_code;
|
||||
if ($params['product']['active'] == 1)
|
||||
{
|
||||
if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.txt') AND file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.html'))
|
||||
|
||||
@@ -44,22 +44,20 @@ class AdminMondialRelay extends AdminTab
|
||||
|
||||
private function displayOrdersTable()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$mondialrelay = new MondialRelay();
|
||||
$order_state = new OrderState((int)(Configuration::get('MONDIAL_RELAY_ORDER_STATE')), $cookie->id_lang);
|
||||
$order_state = new OrderState((int)(Configuration::get('MONDIAL_RELAY_ORDER_STATE')), $this->context->language->id);
|
||||
$mr_weight_coef = (int)(Configuration::get('MR_WEIGHT_COEF'));
|
||||
|
||||
$html = '';
|
||||
|
||||
$html .= $this->l('To generate labels, you must register a correct address for your store on').
|
||||
' <a href="index.php?tab=AdminContact&token='.Tools::getAdminToken('AdminContact'.
|
||||
(int)(Tab::getIdFromClassName('AdminContact')).(int)($cookie->id_employee)).'" class="green">'.
|
||||
(int)(Tab::getIdFromClassName('AdminContact')).(int)$this->context->employee->id).'" class="green">'.
|
||||
$this->l('The contact page').'</a>';
|
||||
$html .= '<p>'.$this->l('All orders which have the state').' "<b>'.$order_state->name.'</b>"';
|
||||
$html .= '. <a href="index.php?tab=AdminModules&configure=mondialrelay&token='.
|
||||
Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).
|
||||
(int)($cookie->id_employee)).'" class="green">' . $this->l('Change configuration') . '</a></p>
|
||||
(int)$this->context->employee->id).'" class="green">' . $this->l('Change configuration') . '</a></p>
|
||||
<div class="PS_MRErrorList error" id="otherErrors">
|
||||
<img src="'._PS_IMG_.'admin/error2.png" alt="" />
|
||||
<span></span>
|
||||
@@ -110,7 +108,7 @@ class AdminMondialRelay extends AdminTab
|
||||
$html .= '<td>'.$order['exp_number'].'</td>';
|
||||
$html .= '
|
||||
<td class="center">
|
||||
<a href="index.php?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'">
|
||||
<a href="index.php?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id).'">
|
||||
<img border="0" title="'.$this->l('View').'" alt="'.$this->l('View').'" src="'._PS_IMG_.'admin/details.gif"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -67,8 +67,6 @@ class MondialRelay extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$name = "shipping";
|
||||
$title = "Mondial Relay API";
|
||||
|
||||
@@ -404,8 +402,6 @@ class MondialRelay extends Module
|
||||
|
||||
public function hookOrderDetail($params)
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
$carrier = $params['carrier'];
|
||||
$order = $params['order'];
|
||||
|
||||
@@ -414,23 +410,21 @@ class MondialRelay extends Module
|
||||
$module = $carrier->external_module_name;
|
||||
include_once(_PS_MODULE_DIR_.$module.'/'.$module.'.php');
|
||||
$module_carrier = new $module();
|
||||
$smarty->assign('followup', $module_carrier->get_followup($order->shipping_number));
|
||||
$this->context->smarty->assign('followup', $module_carrier->get_followup($order->shipping_number));
|
||||
}
|
||||
else if ($carrier->url AND $order->shipping_number)
|
||||
$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
|
||||
$this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
|
||||
}
|
||||
|
||||
public function hookOrderDetailDisplayed($params)
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
$res = Db::getInstance()->getRow('
|
||||
SELECT s.`MR_Selected_LgAdr1`, s.`MR_Selected_LgAdr2`, s.`MR_Selected_LgAdr3`, s.`MR_Selected_LgAdr4`, s.`MR_Selected_CP`, s.`MR_Selected_Ville`, s.`MR_Selected_Pays`, s.`MR_Selected_Num`
|
||||
FROM `'._DB_PREFIX_.'mr_selected` s
|
||||
WHERE s.`id_cart` = '.$params['order']->id_cart);
|
||||
if ((!$res) OR ($res['MR_Selected_Num'] == 'LD1') OR ($res['MR_Selected_Num'] == 'LDS'))
|
||||
return '';
|
||||
$smarty->assign('mr_addr', $res['MR_Selected_LgAdr1'].($res['MR_Selected_LgAdr1'] ? ' - ' : '').$res['MR_Selected_LgAdr2'].($res['MR_Selected_LgAdr2'] ? ' - ' : '').$res['MR_Selected_LgAdr3'].($res['MR_Selected_LgAdr3'] ? ' - ' : '').$res['MR_Selected_LgAdr4'].($res['MR_Selected_LgAdr4'] ? ' - ' : '').$res['MR_Selected_CP'].' '.$res['MR_Selected_Ville'].' - '.$res['MR_Selected_Pays']);
|
||||
$this->context->smarty->assign('mr_addr', $res['MR_Selected_LgAdr1'].($res['MR_Selected_LgAdr1'] ? ' - ' : '').$res['MR_Selected_LgAdr2'].($res['MR_Selected_LgAdr2'] ? ' - ' : '').$res['MR_Selected_LgAdr3'].($res['MR_Selected_LgAdr3'] ? ' - ' : '').$res['MR_Selected_LgAdr4'].($res['MR_Selected_LgAdr4'] ? ' - ' : '').$res['MR_Selected_CP'].' '.$res['MR_Selected_Ville'].' - '.$res['MR_Selected_Pays']);
|
||||
return $this->display(__FILE__, 'orderDetail.tpl');
|
||||
}
|
||||
|
||||
@@ -509,7 +503,7 @@ class MondialRelay extends Module
|
||||
|
||||
public function hookextraCarrier($params)
|
||||
{
|
||||
global $smarty, $cart, $cookie, $defaultCountry, $nbcarriers;
|
||||
global $nbcarriers;
|
||||
|
||||
if (Configuration::get('MR_ENSEIGNE_WEBSERVICE') == '' OR
|
||||
Configuration::get('MR_CODE_MARQUE') == '' OR
|
||||
@@ -517,22 +511,22 @@ class MondialRelay extends Module
|
||||
Configuration::get('MR_LANGUAGE') == '')
|
||||
return '';
|
||||
|
||||
$totalweight = Configuration::get('MR_WEIGHT_COEF') * $cart->getTotalWeight();
|
||||
$totalweight = Configuration::get('MR_WEIGHT_COEF') * $this->context->cart->getTotalWeight();
|
||||
|
||||
if (Validate::isUnsignedInt($cart->id_carrier))
|
||||
if (Validate::isUnsignedInt($this->context->cart->id_carrier))
|
||||
{
|
||||
$carrier = new Carrier((int)($cart->id_carrier));
|
||||
$carrier = new Carrier((int)($this->context->cart->id_carrier));
|
||||
if ($carrier->active AND !$carrier->deleted)
|
||||
$checked = (int)($cart->id_carrier);
|
||||
$checked = (int)($this->context->cart->id_carrier);
|
||||
}
|
||||
if (!isset($checked) OR $checked == 0)
|
||||
$checked = (int)(Configuration::get('PS_CARRIER_DEFAULT'));
|
||||
|
||||
$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));
|
||||
$country = new Country((int)($address->id_country));
|
||||
|
||||
$query = self::getmrth((int)($cookie->id_lang), true, (int)($country->id_zone), $country->iso_code);
|
||||
$query = self::getmrth($this->context->language->id, true, (int)($country->id_zone), $country->iso_code);
|
||||
|
||||
$resultsArray = array();
|
||||
$i = 0;
|
||||
@@ -549,12 +543,12 @@ class MondialRelay extends Module
|
||||
if ($row['range_behavior'])
|
||||
{
|
||||
// Get id zone
|
||||
if (isset($cart->id_address_delivery) AND $cart->id_address_delivery)
|
||||
$id_zone = Address::getZoneById((int)($cart->id_address_delivery));
|
||||
if (isset($this->context->cart->id_address_delivery) AND $this->context->cart->id_address_delivery)
|
||||
$id_zone = Address::getZoneById((int)($this->context->cart->id_address_delivery));
|
||||
else
|
||||
$id_zone = (int)$defaultCountry->id_zone;
|
||||
if ((Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $cart->getTotalWeight(), $id_zone))) OR
|
||||
(!Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $cart->getOrderTotal(true, self::BOTH_WITHOUT_SHIPPING), $id_zone, $cart->id_currency))))
|
||||
$id_zone = (int)$this->context->country->id_zone;
|
||||
if ((Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $this->context->cart->getTotalWeight(), $id_zone))) OR
|
||||
(!Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $this->context->cart->getOrderTotal(true, self::BOTH_WITHOUT_SHIPPING), $id_zone, $this->context->cart->id_currency))))
|
||||
{
|
||||
unset($result[$k]);
|
||||
continue ;
|
||||
@@ -566,7 +560,7 @@ class MondialRelay extends Module
|
||||
$row['col'] = $settings[0]['mr_ModeCol'];
|
||||
$row['liv'] = $settings[0]['mr_ModeLiv'];
|
||||
$row['ass'] = $settings[0]['mr_ModeAss'];
|
||||
$row['price'] = $cart->getOrderShippingCost((int)($row['id_carrier']));
|
||||
$row['price'] = $this->context->cart->getOrderShippingCost((int)($row['id_carrier']));
|
||||
$row['img'] = file_exists(_PS_SHIP_IMG_DIR_.(int)($row['id_carrier']).'.jpg') ? _THEME_SHIP_DIR_.(int)($row['id_carrier']).'.jpg' : '';
|
||||
|
||||
$resultsArray[] = $row;
|
||||
@@ -577,12 +571,12 @@ class MondialRelay extends Module
|
||||
{
|
||||
include_once(_PS_MODULE_DIR_.'mondialrelay/page_iso.php');
|
||||
|
||||
$smarty->assign( array(
|
||||
$this->context->smarty->assign( array(
|
||||
'address_map' => $address->address1.', '.$address->postcode.', '.ote_accent($address->city).', '.$country->iso_code,
|
||||
'input_cp' => $address->postcode,
|
||||
'input_ville' => ote_accent($address->city),
|
||||
'input_pays' => $country->iso_code,
|
||||
'input_poids' => Configuration::get('MR_WEIGHT_COEF') * $cart->getTotalWeight(),
|
||||
'input_poids' => Configuration::get('MR_WEIGHT_COEF') * $this->context->cart->getTotalWeight(),
|
||||
'nbcarriers' => $nbcarriers,
|
||||
'checked' => (int)($checked),
|
||||
'google_api_key' => Configuration::get('MR_GOOGLE_MAP'),
|
||||
@@ -628,10 +622,10 @@ class MondialRelay extends Module
|
||||
- '.$this->l('Create a Carrier').'<br />
|
||||
- '.$this->l('Define a price for your carrier on').'
|
||||
<a href="index.php?tab=AdminCarriers&token='.Tools::getAdminToken('AdminCarriers'.(int)(Tab::getIdFromClassName('AdminCarriers')).
|
||||
(int)($cookie->id_employee)).'" class="green">'.$this->l('The Carrier page').'</a><br />
|
||||
(int)$this->context->employee->id).'" class="green">'.$this->l('The Carrier page').'</a><br />
|
||||
- '.$this->l('To generate labels, you must have a valid and registered address of your store on your').
|
||||
' <a href="index.php?tab=AdminContact&token='.Tools::getAdminToken('AdminContact'.(int)(Tab::getIdFromClassName('AdminContact')).
|
||||
(int)($cookie->id_employee)).'" class="green">'.$this->l('contact page').'</a><br />
|
||||
(int)$this->context->employee->id).'" class="green">'.$this->l('contact page').'</a><br />
|
||||
<p>
|
||||
'.$this->l('URL Cron Task:').' '.Tools::getHttpHost(true, true)._MODULE_DIR_.$this->name.'/cron.php?secure_key='.Configuration::get('MONDIAL_RELAY_SECURE_KEY').
|
||||
'</p>
|
||||
@@ -673,8 +667,6 @@ class MondialRelay extends Module
|
||||
|
||||
public function mrUpdate($type, $array, $keyArray)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if ($type == 'settings')
|
||||
{
|
||||
Configuration::updateValue('MR_ENSEIGNE_WEBSERVICE', $array[0]);
|
||||
@@ -841,8 +833,6 @@ class MondialRelay extends Module
|
||||
|
||||
public function shippingForm()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$query = Db::getInstance()->ExecuteS('
|
||||
SELECT m.*
|
||||
FROM `'._DB_PREFIX_.'mr_method` m
|
||||
@@ -861,8 +851,8 @@ class MondialRelay extends Module
|
||||
{
|
||||
$output .= '
|
||||
<li>
|
||||
<a href="' . 'index.php?tab=AdminModules&configure=mondialrelay&token='.Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)($cookie->id_employee)).'&delete_mr=' . $Options['id_mr_method'] . '"><img src="../img/admin/disabled.gif" alt="Delete" title="Delete" /></a>' . str_replace('_', ' ', $Options['mr_Name']) . ' (' . $Options['mr_ModeCol'] . '-' . $Options['mr_ModeLiv'] . ' - ' . $Options['mr_ModeAss'] . ' : '.$Options['mr_Pays_list'].')
|
||||
<a href="index.php?tab=AdminCarriers&id_carrier=' . (int)($Options['id_carrier']) . '&updatecarrier&token='.Tools::getAdminToken('AdminCarriers'.(int)(Tab::getIdFromClassName('AdminCarriers')).(int)($cookie->id_employee)).'">'.$this->l('Config Shipping.').'</a>
|
||||
<a href="' . 'index.php?tab=AdminModules&configure=mondialrelay&token='.Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$this->context->employee->id).'&delete_mr=' . $Options['id_mr_method'] . '"><img src="../img/admin/disabled.gif" alt="Delete" title="Delete" /></a>' . str_replace('_', ' ', $Options['mr_Name']) . ' (' . $Options['mr_ModeCol'] . '-' . $Options['mr_ModeLiv'] . ' - ' . $Options['mr_ModeAss'] . ' : '.$Options['mr_Pays_list'].')
|
||||
<a href="index.php?tab=AdminCarriers&id_carrier=' . (int)($Options['id_carrier']) . '&updatecarrier&token='.Tools::getAdminToken('AdminCarriers'.(int)(Tab::getIdFromClassName('AdminCarriers')).(int)$this->context->employee->id).'">'.$this->l('Config Shipping.').'</a>
|
||||
</li>';
|
||||
}
|
||||
$output .= '
|
||||
@@ -923,8 +913,6 @@ class MondialRelay extends Module
|
||||
|
||||
public function settingsstateorderForm()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->orderState = Configuration::get('MONDIAL_RELAY_ORDER_STATE');
|
||||
$output = '';
|
||||
$output .= '<form action="'.$_SERVER['REQUEST_URI'].'" method="post" class="form">';
|
||||
@@ -933,7 +921,7 @@ class MondialRelay extends Module
|
||||
$output .= '<div class="margin-form">';
|
||||
$output .= '<select id="id_order_state" name="id_order_state" style="width:250px">';
|
||||
|
||||
$order_states = OrderState::getOrderStates((int)($cookie->id_lang));
|
||||
$order_states = OrderState::getOrderStates($this->context->language->id);
|
||||
foreach ( $order_states as $order_state)
|
||||
{
|
||||
$output .= '<option value="' . $order_state['id_order_state'] . '" style="background-color:' . $order_state['color'] . ';"';
|
||||
@@ -942,7 +930,7 @@ class MondialRelay extends Module
|
||||
}
|
||||
$output .= '</select>';
|
||||
$output .= '<p>' . $this->l('Choose the order state for labels. You can manage the labels on').' ';
|
||||
$output .= '<a href="index.php?tab=AdminMondialRelay&token='.Tools::getAdminToken('AdminMondialRelay'.(int)(Tab::getIdFromClassName('AdminMondialRelay')).(int)($cookie->id_employee)).'" class="green">'.
|
||||
$output .= '<a href="index.php?tab=AdminMondialRelay&token='.Tools::getAdminToken('AdminMondialRelay'.(int)(Tab::getIdFromClassName('AdminMondialRelay')).(int)$this->context->employee->id).'" class="green">'.
|
||||
$this->l('the Mondial Relay administration page').'</a></p>';
|
||||
$output .= '</div>
|
||||
<div class="clear"></div>
|
||||
|
||||
@@ -209,7 +209,6 @@ class MoneyBookers extends PaymentModule
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
global $cookie;
|
||||
$errors = array();
|
||||
$output = '
|
||||
<p><img src="'.__PS_BASE_URI__.'modules/moneybookers/logo-mb.gif" alt="Moneybookers" /></p><br />';
|
||||
@@ -334,9 +333,9 @@ class MoneyBookers extends PaymentModule
|
||||
$output .= '</ul>';
|
||||
}
|
||||
|
||||
$lang = new Language((int)($cookie->id_lang));
|
||||
$iso_img = $lang->iso_code;
|
||||
if ($lang->iso_code != 'fr' AND $lang->iso_code != 'en')
|
||||
$lang = $this->context->language;
|
||||
$iso_img = $lang->id;
|
||||
if ($iso_img != 'fr' AND $iso_img != 'en')
|
||||
$iso_img = 'en';
|
||||
|
||||
$manual_links = array(
|
||||
@@ -345,7 +344,7 @@ class MoneyBookers extends PaymentModule
|
||||
'fr' => 'http://www.prestashop.com/partner/Manuel_Activation_Prestashop_FR.pdf');
|
||||
|
||||
$iso_manual = $lang->iso_code;
|
||||
if (!array_key_exists($lang->iso_code, $manual_links))
|
||||
if (!array_key_exists($iso_manual, $manual_links))
|
||||
$iso_manual = 'en';
|
||||
|
||||
$blockPositionList = array(
|
||||
@@ -567,8 +566,6 @@ class MoneyBookers extends PaymentModule
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
if (!Configuration::get('MB_PARAMETERS') OR !Configuration::get('MB_PARAMETERS_2') OR (Configuration::get('MB_LOCAL_METHODS') == '' AND Configuration::get('MB_INTER_METHODS') == ''))
|
||||
return;
|
||||
|
||||
@@ -591,7 +588,7 @@ class MoneyBookers extends PaymentModule
|
||||
$localMethods = Configuration::get('MB_LOCAL_METHODS');
|
||||
$interMethods = Configuration::get('MB_INTER_METHODS');
|
||||
|
||||
$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'display_mode' => (int)(Configuration::get('MB_DISPLAY_MODE')),
|
||||
'local' => $localMethods ? explode('|', $localMethods) : array(),
|
||||
'inter' => $interMethods ? explode('|', $interMethods) : array(),
|
||||
@@ -603,7 +600,7 @@ class MoneyBookers extends PaymentModule
|
||||
$countryObj = new Country((int)($address->id_country), Configuration::get('PS_LANG_DEFAULT'));
|
||||
$customer = new Customer((int)($params['cart']->id_customer));
|
||||
$currency = new Currency((int)($params['cart']->id_currency));
|
||||
$lang = new Language((int)($cookie->id_lang));
|
||||
$lang = $this->context->language;
|
||||
|
||||
$mbParams = array();
|
||||
|
||||
@@ -637,7 +634,7 @@ class MoneyBookers extends PaymentModule
|
||||
$mbParams['status_url'] = (Configuration::get('PS_SSL_ENABLED') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/'.$this->name.'/validation.php';
|
||||
|
||||
/* Assign settings to Smarty template */
|
||||
$smarty->assign($mbParams);
|
||||
$this->context->smarty->assign($mbParams);
|
||||
|
||||
/* Display the MoneyBookers iframe */
|
||||
return $this->display(__FILE__, 'moneybookers.tpl');
|
||||
@@ -649,22 +646,20 @@ class MoneyBookers extends PaymentModule
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
global $smarty;
|
||||
|
||||
switch($params['objOrder']->getCurrentState())
|
||||
{
|
||||
case _PS_OS_PAYMENT_:
|
||||
case _PS_OS_OUTOFSTOCK_:
|
||||
$smarty->assign('status', 'ok');
|
||||
$this->context->smarty->assign('status', 'ok');
|
||||
break;
|
||||
|
||||
case _PS_OS_BANKWIRE_:
|
||||
$smarty->assign('status', 'pending');
|
||||
$this->context->smarty->assign('status', 'pending');
|
||||
break;
|
||||
|
||||
case _PS_OS_ERROR_:
|
||||
default:
|
||||
$smarty->assign('status', 'failed');
|
||||
$this->context->smarty->assign('status', 'failed');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@ class Newsletter extends Module
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->name = 'newsletter';
|
||||
$this->tab = 'administration';
|
||||
$this->version = 2.0;
|
||||
@@ -55,7 +53,7 @@ class Newsletter extends Module
|
||||
$this->_postValid = array();
|
||||
|
||||
// Getting data...
|
||||
$_countries = Country::getCountries((int)($cookie->id_lang));
|
||||
$_countries = Country::getCountries($this->context->language->id);
|
||||
|
||||
// ...formatting array
|
||||
$countries[0] = $this->l('All countries');
|
||||
|
||||
+5
-10
@@ -146,8 +146,6 @@ class Ogone extends PaymentModule
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
$currency = new Currency((int)($params['cart']->id_currency));
|
||||
$lang = new Language((int)($params['cart']->id_lang));
|
||||
$customer = new Customer((int)($params['cart']->id_customer));
|
||||
@@ -177,26 +175,23 @@ class Ogone extends PaymentModule
|
||||
$shasign .= strtoupper($key).'='.$value.Configuration::get('OGONE_SHA_IN');
|
||||
$ogoneParams['SHASign'] = strtoupper(sha1($shasign));
|
||||
|
||||
$smarty->assign('ogone_params', $ogoneParams);
|
||||
$smarty->assign('OGONE_MODE', Configuration::get('OGONE_MODE'));
|
||||
$this->context->smarty->assign('ogone_params', $ogoneParams);
|
||||
$this->context->smarty->assign('OGONE_MODE', Configuration::get('OGONE_MODE'));
|
||||
|
||||
return $this->display(__FILE__, 'ogone.tpl');
|
||||
}
|
||||
|
||||
public function hookOrderConfirmation($params)
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
if ($params['objOrder']->module != $this->name)
|
||||
return;
|
||||
|
||||
if ($params['objOrder']->valid)
|
||||
$context->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id));
|
||||
$this->context->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id));
|
||||
else
|
||||
$context->smarty->assign('status', 'failed');
|
||||
$this->context->smarty->assign('status', 'failed');
|
||||
|
||||
$context->smarty->assign('ogone_link', (method_exists($link, 'getPageLink') ? $context->link->getPageLink('contact', true) : Tools::getHttpHost(true).'contact'));
|
||||
$this->context->smarty->assign('ogone_link', (method_exists($link, 'getPageLink') ? $this->context->link->getPageLink('contact', true) : Tools::getHttpHost(true).'contact'));
|
||||
return $this->display(__FILE__, 'hookorderconfirmation.tpl');
|
||||
}
|
||||
|
||||
|
||||
@@ -31,13 +31,11 @@ class PaypalExpress extends Paypal
|
||||
|
||||
public function getAuthorisation()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
// Getting cart informations
|
||||
$cart = new Cart((int)($cookie->id_cart));
|
||||
$cart = $this->context->cart;
|
||||
if (!Validate::isLoadedObject($cart))
|
||||
$this->_logs[] = $this->l('Not a valid cart');
|
||||
$currency = new Currency((int)($cart->id_currency));
|
||||
$currency = new Currency($cart->id_currency);
|
||||
if (!Validate::isLoadedObject($currency))
|
||||
$this->_logs[] = $this->l('Not a valid currency');
|
||||
|
||||
@@ -85,10 +83,8 @@ class PaypalExpress extends Paypal
|
||||
|
||||
public function getCustomerInfos()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
// Making request
|
||||
$request = '&TOKEN='.urlencode(strval($cookie->paypal_token));
|
||||
$request = '&TOKEN='.urlencode(strval($this->context->cookie->paypal_token));
|
||||
|
||||
// Calling PayPal API
|
||||
include(_PS_MODULE_DIR_.'paypal/api/paypallib.php');
|
||||
|
||||
@@ -38,13 +38,12 @@ if (!$paypal->active)
|
||||
|
||||
$ppExpress = new PaypalExpress();
|
||||
$errors = array();
|
||||
|
||||
// #####
|
||||
// Functions
|
||||
|
||||
function getAuthorization()
|
||||
{
|
||||
global $ppExpress, $cookie;
|
||||
global $ppExpress;
|
||||
|
||||
$result = $ppExpress->getAuthorisation();
|
||||
$logs = $ppExpress->getLogs();
|
||||
@@ -54,9 +53,9 @@ function getAuthorization()
|
||||
{
|
||||
if (isset($result['TOKEN']))
|
||||
{
|
||||
$cookie->paypal_token = strval($result['TOKEN']);
|
||||
$cookie->paypal_token_date = time();
|
||||
header('Location: https://'.$ppExpress->getPayPalURL().'/webscr&cmd=_express-checkout&token='.urldecode(strval($cookie->paypal_token)));
|
||||
Context::getContext()->cookie->paypal_token = strval($result['TOKEN']);
|
||||
Context::getContext()->cookie->paypal_token_date = time();
|
||||
header('Location: https://'.$ppExpress->getPayPalURL().'/webscr&cmd=_express-checkout&token='.urldecode(strval(Context::getContext()->cookie->paypal_token)));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@@ -70,7 +69,7 @@ function getAuthorization()
|
||||
|
||||
function getInfos()
|
||||
{
|
||||
global $ppExpress, $cookie;
|
||||
global $ppExpress;
|
||||
|
||||
$result = $ppExpress->getCustomerInfos();
|
||||
$logs = $ppExpress->getLogs();
|
||||
@@ -80,7 +79,7 @@ function getInfos()
|
||||
$logs[] = '<b>'.$ppExpress->l('Cannot retrieve PayPal account information', 'submit').'</b>';
|
||||
$ppExpress->displayPayPalAPIError($ppExpress->l('PayPal returned error', 'submit'), $logs);
|
||||
}
|
||||
elseif (!isset($result['TOKEN']) OR $result['TOKEN'] != $cookie->paypal_token)
|
||||
elseif (!isset($result['TOKEN']) OR $result['TOKEN'] != Context::getContext()->cookie->paypal_token)
|
||||
{
|
||||
$logs[] = '<b>'.$ppExpress->l('Token given by PayPal is not the same as the cookie token', 'submit').'</b>';
|
||||
$ppExpress->displayPayPalAPIError($ppExpress->l('PayPal returned error', 'submit'), $logs);
|
||||
@@ -90,18 +89,16 @@ function getInfos()
|
||||
|
||||
function displayProcess($payerID)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$cookie->paypal_token = strval($cookie->paypal_token);
|
||||
$cookie->paypal_payer_id = $payerID;
|
||||
Context::getContext()->cookie->paypal_token = strval(Context::getContext()->cookie->paypal_token);
|
||||
Context::getContext()->cookie->paypal_payer_id = $payerID;
|
||||
Tools::redirect('index.php?controller=order&step=1&back=paypal');
|
||||
}
|
||||
|
||||
function displayConfirm()
|
||||
{
|
||||
global $cookie, $smarty, $ppExpress, $cart, $payerID;
|
||||
global $ppExpress, $payerID;
|
||||
|
||||
if (!$cookie->isLogged(true))
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
die('Not logged');
|
||||
if (!$payerID AND !$payerID = Tools::htmlentitiesUTF8(strval(Tools::getValue('payerID'))))
|
||||
die('No payer ID');
|
||||
@@ -109,13 +106,13 @@ function displayConfirm()
|
||||
// Display all and exit
|
||||
include(_PS_ROOT_DIR_.'/header.php');
|
||||
|
||||
$smarty->assign(array(
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'back' => 'paypal',
|
||||
'logo' => $ppExpress->getLogo(),
|
||||
'ppToken' => strval($cookie->paypal_token),
|
||||
'cust_currency' => $cart->id_currency,
|
||||
'currencies' => $ppExpress->getCurrency((int)$cart->id_currency),
|
||||
'total' => $cart->getOrderTotal(true, Cart::BOTH),
|
||||
'ppToken' => strval(Context::getContext()->cookie->paypal_token),
|
||||
'cust_currency' => Context::getContext()->cart->id_currency,
|
||||
'currencies' => $ppExpress->getCurrency((int)Context::getContext()->cart->id_currency),
|
||||
'total' => Context::getContext()->cart->getOrderTotal(true, Cart::BOTH),
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'. $ppExpress->name.'/',
|
||||
'payerID' => $payerID,
|
||||
'mode' => 'express/'
|
||||
@@ -128,18 +125,18 @@ function displayConfirm()
|
||||
|
||||
function submitConfirm()
|
||||
{
|
||||
global $cookie, $smarty, $ppExpress, $cart;
|
||||
global $ppExpress;
|
||||
|
||||
if (!$cookie->isLogged(true))
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
die('Not logged');
|
||||
elseif (!$currency = (int)(Tools::getValue('currency_payement')))
|
||||
die('No currency');
|
||||
elseif (!$payerID = Tools::htmlentitiesUTF8(strval(Tools::getValue('payerID'))))
|
||||
die('No payer ID');
|
||||
elseif (!$cart->getOrderTotal(true, Cart::BOTH))
|
||||
elseif (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH))
|
||||
die('Empty cart');
|
||||
|
||||
$ppExpress->makePayPalAPIValidation($cookie, $cart, $currency, $payerID, 'express');
|
||||
$ppExpress->makePayPalAPIValidation(Context::getContext()->cookie, Context::getContext()->cart, $currency, $payerID, 'express');
|
||||
}
|
||||
|
||||
function submitAccount()
|
||||
@@ -250,20 +247,20 @@ function submitLogin()
|
||||
|
||||
function displayLogin()
|
||||
{
|
||||
global $cookie, $result, $email, $payerID, $errors, $ppExpress, $smarty;
|
||||
global $result, $email, $payerID, $errors, $ppExpress;
|
||||
|
||||
// Customer exists, login form
|
||||
|
||||
// If customer already logged, check if same mail than PayPal, and go through, or unlog
|
||||
if ($cookie->isLogged(true) AND isset($result['EMAIL']) AND $cookie->email == $result['EMAIL'])
|
||||
if (Context::getContext()->cookie->isLogged(true) AND isset($result['EMAIL']) AND Context::getContext()->cookie->email == $result['EMAIL'])
|
||||
displayProcess($payerID);
|
||||
elseif ($cookie->isLogged(true))
|
||||
$cookie->makeNewLog();
|
||||
elseif (Context::getContext()->cookie->isLogged(true))
|
||||
Context::getContext()->cookie->makeNewLog();
|
||||
|
||||
// Smarty assigns
|
||||
$smarty->assign(array(
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'email' => $email,
|
||||
'ppToken' => strval($cookie->paypal_token),
|
||||
'ppToken' => strval(Context::getContext()->cookie->paypal_token),
|
||||
'errors'=> $errors,
|
||||
'payerID' => $payerID
|
||||
));
|
||||
@@ -277,13 +274,13 @@ function displayLogin()
|
||||
|
||||
function displayAccount()
|
||||
{
|
||||
global $cookie, $result, $email, $payerID, $errors, $ppExpress, $smarty;
|
||||
global $result, $email, $payerID, $errors, $ppExpress;
|
||||
|
||||
// Customer does not exists, signup form
|
||||
|
||||
// If customer already logged, unlog him
|
||||
if ($cookie->isLogged(true))
|
||||
$cookie->makeNewLog();
|
||||
if (Context::getContext()->cookie->isLogged(true))
|
||||
Context::getContext()->cookie->makeNewLog();
|
||||
|
||||
// Generate years, months and days
|
||||
if (isset($_POST['years']) AND is_numeric($_POST['years']))
|
||||
@@ -303,10 +300,10 @@ function displayAccount()
|
||||
{
|
||||
$selectedCountry = Country::getByIso(strval($result['COUNTRYCODE']));
|
||||
}
|
||||
$countries = Country::getCountries((int)($cookie->id_lang), true);
|
||||
$countries = Country::getCountries((int)(Context::getContext()->cookie->id_lang), true);
|
||||
|
||||
// Smarty assigns
|
||||
$smarty->assign(array(
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'years' => $years,
|
||||
'sl_year' => (isset($selectedYears) ? $selectedYears : 0),
|
||||
'months' => $months,
|
||||
@@ -322,7 +319,7 @@ function displayAccount()
|
||||
'city' => (Tools::getValue('city') ? Tools::htmlentitiesUTF8(strval(Tools::getValue('city'))) : (isset($result['SHIPTOCITY']) ? $result['SHIPTOCITY'] : '')),
|
||||
'zip' => (Tools::getValue('postcode') ? Tools::htmlentitiesUTF8(strval(Tools::getValue('postcode'))) : (isset($result['SHIPTOZIP']) ? $result['SHIPTOZIP'] : '')),
|
||||
'payerID' => $payerID,
|
||||
'ppToken' => strval($cookie->paypal_token),
|
||||
'ppToken' => strval(Context::getContext()->cookie->paypal_token),
|
||||
'errors'=> $errors
|
||||
));
|
||||
|
||||
@@ -335,16 +332,16 @@ function displayAccount()
|
||||
|
||||
// #####
|
||||
// Process !!
|
||||
/*if (!$cookie->isLogged(true))
|
||||
/*if (!Context::getContext()->cookie->isLogged(true))
|
||||
{
|
||||
displayAccount();
|
||||
die('Not logged');
|
||||
}*/
|
||||
if (!$cart->getOrderTotal(true, Cart::BOTH))
|
||||
if (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH))
|
||||
die('Empty cart');
|
||||
|
||||
// No token, we need to get one by making PayPal Authorisation
|
||||
if (!isset($cookie->paypal_token) OR !$cookie->paypal_token)
|
||||
if (!isset(Context::getContext()->cookie->paypal_token) OR !Context::getContext()->cookie->paypal_token)
|
||||
getAuthorization();
|
||||
else
|
||||
{
|
||||
@@ -361,10 +358,10 @@ else
|
||||
// We got an error or we still not submit form
|
||||
if ((!Tools::isSubmit('submitAccount') AND !Tools::isSubmit('submitLogin')) OR sizeof($errors))
|
||||
{
|
||||
if (isset($cookie->paypal_token) AND isset($cookie->paypal_token_date) AND (time() - 10800 > $cookie->paypal_token_date))
|
||||
if (isset(Context::getContext()->cookie->paypal_token) AND isset(Context::getContext()->cookie->paypal_token_date) AND (time() - 10800 > Context::getContext()->cookie->paypal_token_date))
|
||||
{
|
||||
// Token expired, unset it
|
||||
unset($cookie->paypal_token);
|
||||
unset(Context::getContext()->cookie->paypal_token);
|
||||
Tools::redirect('modules/paypal/express/submit.php');
|
||||
}
|
||||
// We didn't submit form, getting PayPal informations
|
||||
@@ -386,7 +383,7 @@ else
|
||||
else
|
||||
{
|
||||
// Error in token, we need to make authorization again
|
||||
unset($cookie->paypal_token);
|
||||
unset(Context::getContext()->cookie->paypal_token);
|
||||
Tools::redirect('modules/paypal/express/submit.php');
|
||||
}
|
||||
if (Customer::customerExists($email) OR Tools::isSubmit('submitLogin'))
|
||||
|
||||
@@ -36,8 +36,7 @@ class PaypalPayment extends Paypal
|
||||
|
||||
public function getAuthorisation()
|
||||
{
|
||||
global $cookie, $cart;
|
||||
|
||||
$cart = Context::getContext()->cart;
|
||||
// Getting cart informations
|
||||
$currency = new Currency((int)($cart->id_currency));
|
||||
if (!Validate::isLoadedObject($currency))
|
||||
|
||||
@@ -46,7 +46,7 @@ $errors = array();
|
||||
|
||||
function getAuthorization()
|
||||
{
|
||||
global $ppPayment, $cookie, $cart;
|
||||
global $ppPayment;
|
||||
|
||||
$result = $ppPayment->getAuthorisation();
|
||||
$logs = $ppPayment->getLogs();
|
||||
@@ -56,9 +56,9 @@ function getAuthorization()
|
||||
{
|
||||
if (isset($result['TOKEN']))
|
||||
{
|
||||
$cookie->paypal_token = strval($result['TOKEN']);
|
||||
$cookie->paypal_token_date = time();
|
||||
header('Location: https://'.$ppPayment->getPayPalURL().'/webscr&cmd=_express-checkout&token='.urldecode(strval($cookie->paypal_token)).'&useraction=commit');
|
||||
Context::getContext()->cookie->paypal_token = strval($result['TOKEN']);
|
||||
Context::getContext()->cookie->paypal_token_date = time();
|
||||
header('Location: https://'.$ppPayment->getPayPalURL().'/webscr&cmd=_express-checkout&token='.urldecode(strval(Context::getContext()->cookie->paypal_token)).'&useraction=commit');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@@ -71,31 +71,31 @@ function getAuthorization()
|
||||
|
||||
function displayConfirm()
|
||||
{
|
||||
global $cookie, $smarty, $ppPayment, $cart;
|
||||
global $ppPayment;
|
||||
|
||||
if (!$cookie->isLogged(true))
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
{
|
||||
header('location:../../../'); exit;
|
||||
die('Not logged');
|
||||
}
|
||||
unset($cookie->paypal_token);
|
||||
unset(Context::getContext()->cookie->paypal_token);
|
||||
|
||||
if ($cart->id_currency != $ppPayment->getCurrency((int)$cart->id_currency)->id)
|
||||
if (Context::getContext()->cart->id_currency != $ppPayment->getCurrency((int)Context::getContext()->cart->id_currency)->id)
|
||||
{
|
||||
$cart->id_currency = (int)($ppPayment->getCurrency((int)$cart->id_currency)->id);
|
||||
$cookie->id_currency = (int)($cart->id_currency);
|
||||
$cart->update();
|
||||
Context::getContext()->cart->id_currency = (int)($ppPayment->getCurrency((int)Context::getContext()->cart->id_currency)->id);
|
||||
Context::getContext()->cookie->id_currency = (int)(Context::getContext()->cart->id_currency);
|
||||
Context::getContext()->cart->update();
|
||||
Tools::redirect('modules/'.$ppPayment->name.'/payment/submit.php');
|
||||
}
|
||||
|
||||
// Display all and exit
|
||||
include(_PS_ROOT_DIR_.'/header.php');
|
||||
|
||||
$smarty->assign(array(
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'logo' => $ppPayment->getLogo(),
|
||||
'cust_currency' => $cart->id_currency,
|
||||
'currency' => $ppPayment->getCurrency((int)$cart->id_currency),
|
||||
'total' => $cart->getOrderTotal(true, Cart::BOTH),
|
||||
'cust_currency' => Context::getContext()->cart->id_currency,
|
||||
'currency' => $ppPayment->getCurrency((int)Context::getContext()->cart->id_currency),
|
||||
'total' => Context::getContext()->cart->getOrderTotal(true, Cart::BOTH),
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'. $ppPayment->name.'/',
|
||||
'mode' => 'payment/'
|
||||
));
|
||||
@@ -107,54 +107,53 @@ function displayConfirm()
|
||||
|
||||
function submitConfirm()
|
||||
{
|
||||
global $cookie, $smarty, $ppPayment, $cart;
|
||||
global $ppPayment;
|
||||
|
||||
if (!$cookie->isLogged(true))
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
{
|
||||
header('location:../../../'); exit;
|
||||
die('Not logged');
|
||||
}
|
||||
elseif (!$id_currency = (int)(Tools::getValue('currency_payement')))
|
||||
die('No currency');
|
||||
elseif (!$cart->getOrderTotal(true, Cart::BOTH))
|
||||
elseif (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH))
|
||||
die('Empty cart');
|
||||
$currency = new Currency((int)($id_currency));
|
||||
if (!Validate::isLoadedObject($currency))
|
||||
die('Invalid currency');
|
||||
$cookie->id_currency = (int)($id_currency);
|
||||
Context::getContext()->cookie->id_currency = (int)($id_currency);
|
||||
getAuthorization();
|
||||
}
|
||||
|
||||
function validOrder()
|
||||
{
|
||||
global $cookie, $cart, $ppPayment;
|
||||
if (!$cookie->isLogged(true))
|
||||
global $ppPayment;
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
{
|
||||
header('location:../../../'); exit;
|
||||
die('Not logged');
|
||||
}
|
||||
elseif (!$cart->getOrderTotal(true, Cart::BOTH))
|
||||
elseif (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH))
|
||||
die('Empty cart');
|
||||
if (!$token = Tools::htmlentitiesUTF8(strval(Tools::getValue('token'))))
|
||||
{
|
||||
global $smarty;
|
||||
$smarty->assign('paypalError', 'Invalid token');
|
||||
Context::getContext()->smarty->assign('paypalError', 'Invalid token');
|
||||
displayConfirm();
|
||||
die('Invalid token');
|
||||
}
|
||||
if ($token != strval($cookie->paypal_token))
|
||||
if ($token != strval(Context::getContext()->cookie->paypal_token))
|
||||
die('Invalid cookie token');
|
||||
if (!$payerID = Tools::htmlentitiesUTF8(strval(Tools::getValue('PayerID'))))
|
||||
die('Invalid payerID');
|
||||
$ppPayment->makePayPalAPIValidation($cookie, $cart, $cart->id_currency, $payerID, 'payment');
|
||||
$ppPayment->makePayPalAPIValidation(Context::getContext()->cookie, Context::getContext()->cart, Context::getContext()->cart->id_currency, $payerID, 'payment');
|
||||
}
|
||||
|
||||
// #####
|
||||
// Process !!
|
||||
|
||||
if (!$cookie->isLogged(true))
|
||||
if (!Context::getContext()->cookie->isLogged(true))
|
||||
die('Not logged');
|
||||
elseif (!$cart->getOrderTotal(true, Cart::BOTH))
|
||||
elseif (!Context::getContext()->cart->getOrderTotal(true, Cart::BOTH))
|
||||
die('Empty cart');
|
||||
|
||||
// No submit, confirmation page
|
||||
@@ -162,7 +161,7 @@ if (!Tools::isSubmit('submitPayment') AND !Tools::getValue('fromPayPal'))
|
||||
displayConfirm();
|
||||
else
|
||||
{
|
||||
if (!isset($cookie->paypal_token) OR !$cookie->paypal_token)
|
||||
if (!isset(Context::getContext()->cookie->paypal_token) OR !Context::getContext()->cookie->paypal_token)
|
||||
submitConfirm();
|
||||
validOrder();
|
||||
}
|
||||
|
||||
+23
-55
@@ -57,9 +57,8 @@ class PayPal extends PaymentModule
|
||||
if (file_exists(_PS_ROOT_DIR_.'/modules/paypalapi/paypalapi.php') AND $this->active)
|
||||
$this->warning = $this->l('All features of Paypal API module are be include in the new Paypal module. In order to don\'t have any conflict, please don\'t use and remove PayPalAPI module.');
|
||||
|
||||
global $cookie;
|
||||
$context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5)));
|
||||
$content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))).'&iso_lang='.Tools::strtolower(Language::getIsoById(intval($cookie->id_lang))).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context);
|
||||
$content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))).'&iso_lang='.Tools::strtolower($this->context->language->iso_code).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context);
|
||||
$content = explode('|', $content);
|
||||
if ($content[0] == 'OK')
|
||||
{
|
||||
@@ -180,8 +179,6 @@ class PayPal extends PaymentModule
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
if (!$this->active)
|
||||
return ;
|
||||
/*
|
||||
@@ -196,8 +193,8 @@ class PayPal extends PaymentModule
|
||||
{
|
||||
if ($this->_isPayPalAPIAvailable())
|
||||
{
|
||||
$smarty->assign('integral', (Configuration::get('PAYPAL_PAYMENT_METHOD') == 0 ? 1 : 0));
|
||||
$smarty->assign('logo', _MODULE_DIR_.$this->name.'/paypal.gif');
|
||||
$this->context->smarty->assign('integral', (Configuration::get('PAYPAL_PAYMENT_METHOD') == 0 ? 1 : 0));
|
||||
$this->context->smarty->assign('logo', _MODULE_DIR_.$this->name.'/paypal.gif');
|
||||
return $this->display(__FILE__, 'payment/payment.tpl');
|
||||
}
|
||||
else
|
||||
@@ -209,14 +206,12 @@ class PayPal extends PaymentModule
|
||||
|
||||
public function hookShoppingCartExtra($params)
|
||||
{
|
||||
global $cookie, $smarty;
|
||||
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
if (Configuration::get('PAYPAL_EXPRESS_CHECKOUT') AND !$cookie->isLogged(true) AND $this->_isPayPalAPIAvailable())
|
||||
if (Configuration::get('PAYPAL_EXPRESS_CHECKOUT') AND !$this->context->cookie->isLogged(true) AND $this->_isPayPalAPIAvailable())
|
||||
{
|
||||
$smarty->assign('logo', $this->getLogo(true));
|
||||
$this->context->smarty->assign('logo', $this->getLogo(true));
|
||||
return $this->display(__FILE__, 'express/shopping_cart.tpl');
|
||||
}
|
||||
}
|
||||
@@ -231,10 +226,8 @@ class PayPal extends PaymentModule
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
$smarty->assign('iso_code', Tools::strtolower(Language::getIsoById($cookie->id_lang ? (int)($cookie->id_lang) : 1)));
|
||||
$smarty->assign('logo', $this->getLogo(false, true));
|
||||
$this->context->smarty->assign('iso_code', Tools::strtolower($this->context->language));
|
||||
$this->context->smarty->assign('logo', $this->getLogo(false, true));
|
||||
return $this->display(__FILE__, 'column.tpl');
|
||||
}
|
||||
|
||||
@@ -251,13 +244,11 @@ class PayPal extends PaymentModule
|
||||
/* Only execute if you use PayPal API for payment */
|
||||
if (Configuration::get('PAYPAL_PAYMENT_METHOD') != _PAYPAL_INTEGRAL_EVOLUTION_ AND $this->_isPayPalAPIAvailable())
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if ($params['module'] != $this->name)
|
||||
return false;
|
||||
if (!$token = $cookie->paypal_token)
|
||||
if (!$token = $this->context->cookie->paypal_token)
|
||||
return false;
|
||||
if (!$payerID = $cookie->paypal_payer_id)
|
||||
if (!$payerID = $this->context->cookie->paypal_payer_id)
|
||||
return false;
|
||||
Tools::redirect('modules/paypal/express/submit.php?confirm=1&token='.$token.'&payerID='.$payerID);
|
||||
}
|
||||
@@ -375,8 +366,6 @@ class PayPal extends PaymentModule
|
||||
|
||||
public function makePayPalAPIValidation($cookie, $cart, $id_currency, $payerID, $type)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (!$this->active)
|
||||
return ;
|
||||
if (!$this->_isPayPalAPIAvailable())
|
||||
@@ -558,11 +547,9 @@ class PayPal extends PaymentModule
|
||||
|
||||
public function getLogo($ppExpress = false, $vertical = false)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if ($ppExpress)
|
||||
{
|
||||
$iso_code = Tools::strtoupper(Language::getIsoById($cookie->id_lang ? (int)$cookie->id_lang : 1));
|
||||
$iso_code = Tools::strtoupper($this->context->language);
|
||||
$logo = array(
|
||||
'FR' => 'FR',
|
||||
'DE' => 'DE',
|
||||
@@ -612,18 +599,13 @@ class PayPal extends PaymentModule
|
||||
|
||||
public function getCountryCode()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$cart = new Cart((int)$cookie->id_cart);
|
||||
$address = new Address((int)$cart->id_address_invoice);
|
||||
$country = new Country((int)$address->id_country);
|
||||
$address = new Address($this->context->cart->id_address_invoice);
|
||||
$country = new Country($address->id_country);
|
||||
return $country->iso_code;
|
||||
}
|
||||
|
||||
public function displayPayPalAPIError($message, $log = false)
|
||||
{
|
||||
global $cookie, $smarty;
|
||||
|
||||
$send = true;
|
||||
// Sanitize log
|
||||
foreach ($log AS $key => $string)
|
||||
@@ -644,11 +626,11 @@ class PayPal extends PaymentModule
|
||||
}
|
||||
|
||||
include(dirname(__FILE__).'/../../header.php');
|
||||
$smarty->assign('message', $message);
|
||||
$smarty->assign('logs', $log);
|
||||
$this->context->smarty->assign('message', $message);
|
||||
$this->context->smarty->assign('logs', $log);
|
||||
$data = array('{logs}' => implode('<br />', $log));
|
||||
if ($send)
|
||||
Mail::Send((int)($cookie->id_lang), 'error_reporting', Mail::l('Error reporting from your PayPal module'), $data, Configuration::get('PS_SHOP_EMAIL'), NULL, NULL, NULL, NULL, NULL, _PS_MODULE_DIR_.$this->name.'/mails/');
|
||||
Mail::Send($this->context->language->id, 'error_reporting', Mail::l('Error reporting from your PayPal module'), $data, Configuration::get('PS_SHOP_EMAIL'), NULL, NULL, NULL, NULL, NULL, _PS_MODULE_DIR_.$this->name.'/mails/');
|
||||
echo $this->display(__FILE__, 'error.tpl');
|
||||
include_once(dirname(__FILE__).'/../../footer.php');
|
||||
die;
|
||||
@@ -747,14 +729,12 @@ class PayPal extends PaymentModule
|
||||
|
||||
private function _getSolutionTabHtml()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$paymentMethod = (int)(Tools::getValue('payment_method', Configuration::get('PAYPAL_PAYMENT_METHOD')));
|
||||
$paypalExpress = (int)(Tools::isSubmit('paypal_express') ? 1 : Configuration::get('PAYPAL_EXPRESS_CHECKOUT'));
|
||||
$paypalDebug = (int)(Tools::isSubmit('paypal_debug') ? 1 : Configuration::get('PAYPAL_DEBUG_MODE'));
|
||||
|
||||
$link = 'http://altfarm.mediaplex.com/ad/ck/3484-23403-8030-88?ID=PROCPRESTA';
|
||||
$lang = new Language((int)$cookie->id_lang);
|
||||
$lang = $this->context->language;
|
||||
if (strtolower($lang->iso_code) == 'es')
|
||||
$link = 'http://altfarm.mediaplex.com/ad/ck/3484-34334-12439-1';
|
||||
else if (strtolower($lang->iso_code) == 'it')
|
||||
@@ -783,9 +763,7 @@ class PayPal extends PaymentModule
|
||||
|
||||
private function _getSettingsTabHtml()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$lang = new Language((int)$cookie->id_lang);
|
||||
$lang = $this->context->language;
|
||||
$sandboxMode = (int)(Tools::getValue('sandbox_mode', Configuration::get('PAYPAL_SANDBOX')));
|
||||
$paypalCapture = (int)(Tools::getValue('paypal_capture', Configuration::get('PAYPAL_CAPTURE')));
|
||||
|
||||
@@ -838,9 +816,7 @@ class PayPal extends PaymentModule
|
||||
|
||||
private function _getPersonalizationsTabHtml()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$lang = new Language((int)$cookie->id_lang);
|
||||
$lang = $this->context->language;
|
||||
$template_paypal = Tools::getValue('template_paypal', Configuration::get('PAYPAL_TEMPLATE'));
|
||||
|
||||
return '
|
||||
@@ -879,8 +855,6 @@ class PayPal extends PaymentModule
|
||||
|
||||
private function _postProcess()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (Tools::isSubmit('submitPayPal'))
|
||||
{
|
||||
$template_available = array('A', 'B', 'C');
|
||||
@@ -944,7 +918,7 @@ class PayPal extends PaymentModule
|
||||
if ($response['ACK'] == 'Success')
|
||||
{
|
||||
if ($response['PAYMENTSTATUS'] == 'Completed' OR $response['PAYMENTSTATUS'] == 'Reversed' OR ($response['PAYMENTSTATUS'] == 'Pending' AND $response['PENDINGREASON'] == 'authorization'))
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&id_order='.(int)(Tools::getValue('id_order')).'&vieworder&paypal=validationOk&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&id_order='.(int)(Tools::getValue('id_order')).'&vieworder&paypal=validationOk&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
|
||||
else
|
||||
$this->_html .= '<p><b>'.$this->l('Status').':</b> '.$response['PAYMENTSTATUS'].' ('.$this->l('Reason:').' '.$response['PENDINGREASON'].')</p>';
|
||||
}
|
||||
@@ -962,9 +936,9 @@ class PayPal extends PaymentModule
|
||||
if ($response['ACK'] == 'Success')
|
||||
{
|
||||
if ($response['PAYMENTSTATUS'] == 'Completed')
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&id_order='.(int)(Tools::getValue('id_order')).'&vieworder&paypal=captureOk&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&id_order='.(int)(Tools::getValue('id_order')).'&vieworder&paypal=captureOk&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
|
||||
else
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&id_order='.(int)(Tools::getValue('id_order')).'&vieworder&paypal=captureError&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&id_order='.(int)(Tools::getValue('id_order')).'&vieworder&paypal=captureError&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
|
||||
}
|
||||
else
|
||||
$this->_html .= '<p style="color:red;">'.$this->l('Error from PayPal: ').$response['L_LONGMESSAGE0'].' (#'.$response['L_ERRORCODE0'].')</p>';
|
||||
@@ -980,9 +954,9 @@ class PayPal extends PaymentModule
|
||||
if ($response['ACK'] == 'Success')
|
||||
{
|
||||
if ($response['REFUNDTRANSACTIONID'] != '')
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&id_order='.(int)(Tools::getValue('id_order')).'&vieworder&paypal=refundOk&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&id_order='.(int)(Tools::getValue('id_order')).'&vieworder&paypal=refundOk&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
|
||||
else
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&id_order='.(int)(Tools::getValue('id_order')).'&vieworder&paypal=refundError&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)));
|
||||
Tools::redirectAdmin(AdminTab::$currentIndex.'&id_order='.(int)(Tools::getValue('id_order')).'&vieworder&paypal=refundError&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id));
|
||||
}
|
||||
else
|
||||
$this->_html .= '<p style="color:red;">'.$this->l('Error from PayPal: ').$response['L_LONGMESSAGE0'].' (#'.$response['L_ERRORCODE0'].')</p>';
|
||||
@@ -1041,8 +1015,6 @@ class PayPal extends PaymentModule
|
||||
|
||||
private function _doTotalRefund($id_order)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (!$this->_isPayPalAPIAvailable())
|
||||
return false;
|
||||
if (!$id_order)
|
||||
@@ -1089,8 +1061,6 @@ class PayPal extends PaymentModule
|
||||
|
||||
private function _doCapture($id_order)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
include_once(_PS_MODULE_DIR_.'paypal/api/paypallib.php');
|
||||
|
||||
if (!$this->_isPayPalAPIAvailable())
|
||||
@@ -1129,8 +1099,6 @@ class PayPal extends PaymentModule
|
||||
|
||||
private function _updatePaymentStatusOfOrder($id_order)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
include_once(_PS_MODULE_DIR_.'paypal/api/paypallib.php');
|
||||
|
||||
if (!$this->_isPayPalAPIAvailable())
|
||||
|
||||
@@ -166,10 +166,8 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
public function createDisposition($cart)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$currency = new Currency((int)($cart->id_currency));
|
||||
$language = $this->_getSupportedLanguageIsoById((int)($cookie->id_lang));
|
||||
$language = $this->_getSupportedLanguageIsoById($this->context->language->id);
|
||||
$mid = Configuration::get($this->prefix.'MERCHANT_ID_'.$currency->iso_code);
|
||||
$mtid = $cart->id.'-'.time();
|
||||
$amount = number_format((float)($cart->getOrderTotal(true, Cart::BOTH)), 2, '.','');
|
||||
@@ -353,14 +351,12 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
private function _displayInfos()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
return '<fieldset id="infos_cashticket">
|
||||
<legend><img src="'._MODULE_DIR_.$this->name.'/img/payment-small.png" alt="" />'.$this->displayName.'</legend>
|
||||
<center><img src="'._MODULE_DIR_.$this->name.'/img/payment.png" alt="" class="logo" /></center>
|
||||
'.$this->getL('introduction').'
|
||||
<br /><br />
|
||||
<a style="color: blue; text-decoration: underline" href="'.$this->_getRegisterLink((int)$cookie->id_lang).'">'.$this->getL('register').'</a>
|
||||
<a style="color: blue; text-decoration: underline" href="'.$this->_getRegisterLink($this->context->language->id).'">'.$this->getL('register').'</a>
|
||||
</fieldset>
|
||||
<div class="clear" /><br />';
|
||||
}
|
||||
@@ -534,8 +530,6 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
global $smarty;
|
||||
|
||||
// check currency
|
||||
$currency = new Currency((int)($params['cart']->id_currency));
|
||||
|
||||
@@ -555,7 +549,7 @@ abstract class PrepaidServices extends PaymentModule
|
||||
if ($amount > $this->max_amount)
|
||||
return false;
|
||||
|
||||
$smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
|
||||
$this->context->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png',
|
||||
'payment_name' => $this->displayName,
|
||||
'module_name' => $this->name));
|
||||
|
||||
@@ -565,19 +559,16 @@ abstract class PrepaidServices extends PaymentModule
|
||||
|
||||
public function hookPaymentReturn($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
if ($params['objOrder']->module != $this->name)
|
||||
return;
|
||||
|
||||
$smarty->assign('payment_name', $this->displayName);
|
||||
$this->context->smarty->assign('payment_name', $this->displayName);
|
||||
return $this->display(_MODULE_DIR_.'/'.$this->name.'/', $this->name.'-confirmation.tpl');
|
||||
}
|
||||
|
||||
|
||||
public function hookAdminOrder($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
$error = 0;
|
||||
$order = new Order((int)($params['id_order']));
|
||||
|
||||
@@ -598,7 +589,7 @@ abstract class PrepaidServices extends PaymentModule
|
||||
// if the disposition is not "active"
|
||||
if ($res[5] != PrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PrepaidServicesAPI::DISPOSITION_DEBITED)
|
||||
{
|
||||
$smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
|
||||
$this->context->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment));
|
||||
return $this->display($this->module_dir.'/'.$this->name, 'disposition-error.tpl');
|
||||
}
|
||||
|
||||
@@ -627,7 +618,7 @@ abstract class PrepaidServices extends PaymentModule
|
||||
if (Tools::getIsset('pp_error'))
|
||||
$error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error'));
|
||||
|
||||
$smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
|
||||
$this->context->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'],
|
||||
'payment_name' => $order->payment,
|
||||
'error' => $error_msg,
|
||||
'currency' => $currency->getSign('right'),
|
||||
|
||||
@@ -117,7 +117,6 @@ class PrestaFraud extends Module
|
||||
|
||||
private function _displayConfiguration()
|
||||
{
|
||||
global $cookie;
|
||||
$this->_html .= '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(\'#submitCreateAccount\').unbind(\'click\').click(function() {
|
||||
@@ -153,7 +152,7 @@ class PrestaFraud extends Module
|
||||
<input id="terms_and_conditions" type="checkbox" value="1" />'.$this->l('I agree with the terms of PrestaShop Security service and I adhere to them unconditionally.').'</label>
|
||||
</div>
|
||||
<div id="terms" class="margin-form">';
|
||||
$terms = file_get_contents($this->_trustUrl.'terms.php?lang='.Language::getIsoById((int)$cookie->id_lang));
|
||||
$terms = file_get_contents($this->_trustUrl.'terms.php?lang='.$this->context->language->iso_code);
|
||||
$this->_html .= $terms;
|
||||
$this->_html .= '</div>
|
||||
<div class="margin-form">
|
||||
@@ -181,7 +180,7 @@ class PrestaFraud extends Module
|
||||
$this->_html .= '</select>
|
||||
</div>';
|
||||
|
||||
$carriers = Carrier::getCarriers((int)$cookie->id_lang, true);
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true);
|
||||
$trust_carriers_type = $this->_getPrestaTrustCarriersType();
|
||||
$configured_carriers = $this->_getConfiguredCarriers();
|
||||
|
||||
@@ -483,14 +482,13 @@ class PrestaFraud extends Module
|
||||
|
||||
public function hookAdminOrder($params)
|
||||
{
|
||||
global $cookie;
|
||||
$id_order = Db::getInstance()->getValue('SELECT id_order FROM '._DB_PREFIX_.'prestafraud_orders WHERE id_order = '.(int)$params['id_order']);
|
||||
$this->_html .= '<br /><fieldset><legend>'.$this->l('PrestaShop Security').'</legend>';
|
||||
if (!$id_order)
|
||||
$this->_html .= $this->l('This order has not been sent to PrestaShop Security.');
|
||||
else
|
||||
{
|
||||
$scoring = $this->_getScoring((int)$id_order, $cookie->id_lang);
|
||||
$scoring = $this->_getScoring((int)$id_order, $this->context->language->id);
|
||||
$this->_html .= '<p><b>'.$this->l('Scoring:').'</b> '.($scoring['scoring'] < 0 ? $this->l('Unknown') : (float)$scoring['scoring']).'</p>
|
||||
<p><b>'.$this->l('Comment:').'</b> '.htmlentities($scoring['comment']).'</p>
|
||||
<p><center><a target="_BLANK" href="'.$this->_trustUrl.'fraud_report.php?shop_id='.Configuration::get('PS_TRUST_SHOP_ID').'&shop_key='.Configuration::get('PS_TRUST_SHOP_KEY').'&order_id='.$id_order.'">'.$this->l('Report this order as a fraud to PrestaShop').'</a></center></p>';
|
||||
@@ -498,9 +496,7 @@ class PrestaFraud extends Module
|
||||
$this->_html .= '</fieldset>';
|
||||
return $this->_html;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function _getScoring($id_order, $id_lang)
|
||||
{
|
||||
if (!$scoring = Db::getInstance()->getRow('SELECT * FROM '._DB_PREFIX_.'prestafraud_orders WHERE scoring IS NOT NULL AND id_order = '.(int)$id_order))
|
||||
|
||||
@@ -217,15 +217,13 @@ class ProductComment extends ObjectModel
|
||||
*/
|
||||
public static function getByValidate($validate = '0', $deleted = false)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
return (Db::getInstance()->ExecuteS('
|
||||
SELECT pc.`id_product_comment`, pc.`id_product`, IF(c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product_comment` pc
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = pc.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product`)
|
||||
WHERE pc.`validate` = '.(int)($validate).'
|
||||
AND pl.`id_lang` = '.(int)($cookie->id_lang).'
|
||||
AND pl.`id_lang` = '.(int)Context::getContext()->language->id.'
|
||||
ORDER BY pc.`date_add` DESC'));
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,6 @@ class ProductComments extends Module
|
||||
$name = Tools::getValue('criterion');
|
||||
if (Tools::isSubmit('submitAddCriterion'))
|
||||
{
|
||||
global $cookie;
|
||||
require_once(dirname(__FILE__).'/ProductCommentCriterion.php');
|
||||
$languages = Language::getLanguages();
|
||||
$id_criterion = (int)Tools::getValue('id_product_comment_criterion');
|
||||
@@ -330,8 +329,6 @@ class ProductComments extends Module
|
||||
|
||||
private function _displayFormConfigurationCriterion()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$langs = Language::getLanguages(false);
|
||||
$id_lang_default = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
@@ -375,7 +372,7 @@ class ProductComments extends Module
|
||||
</div>
|
||||
</form>';
|
||||
require_once(dirname(__FILE__).'/ProductCommentCriterion.php');
|
||||
$criterions = ProductCommentCriterion::getCriterions((int)$cookie->id_lang);
|
||||
$criterions = ProductCommentCriterion::getCriterions(Context::getContext()->language->id);
|
||||
if (sizeof($criterions))
|
||||
{
|
||||
$this->_html.= '<br />
|
||||
@@ -406,11 +403,9 @@ class ProductComments extends Module
|
||||
|
||||
private function _displayFormApplicationCriterion()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
include_once(dirname(__FILE__).'/ProductCommentCriterion.php');
|
||||
|
||||
$criterions = ProductCommentCriterion::getCriterions((int)$cookie->id_lang, false, true);
|
||||
$criterions = ProductCommentCriterion::getCriterions(Context::getContext()->language->id, false, true);
|
||||
$id_criterion = (int)Tools::getValue('updateCriterion');
|
||||
|
||||
if ($id_criterion)
|
||||
@@ -418,13 +413,13 @@ class ProductComments extends Module
|
||||
$criterion = new ProductCommentCriterion((int)$id_criterion);
|
||||
if ($criterion->id_product_comment_criterion_type == 2)
|
||||
{
|
||||
$categories = Category::getSimpleCategories((int)$cookie->id_lang);
|
||||
$categories = Category::getSimpleCategories(Context::getContext()->language->id);
|
||||
$criterion_categories = $criterion->getCategories();
|
||||
}
|
||||
elseif ($criterion->id_product_comment_criterion_type == 3)
|
||||
{
|
||||
$criterion_products = $criterion->getProducts();
|
||||
$products = Product::getSimpleProducts((int)$cookie->id_lang);
|
||||
$products = Product::getSimpleProducts(Context::getContext()->language->id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,15 +483,13 @@ class ProductComments extends Module
|
||||
|
||||
public function hookProductTab($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
require_once(dirname(__FILE__).'/ProductComment.php');
|
||||
require_once(dirname(__FILE__).'/ProductCommentCriterion.php');
|
||||
|
||||
$smarty->assign(array(
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
|
||||
'comments' => ProductComment::getByProduct((int)($_GET['id_product'])),
|
||||
'criterions' => ProductCommentCriterion::getByProduct((int)($_GET['id_product']), (int)($cookie->id_lang)),
|
||||
'criterions' => ProductCommentCriterion::getByProduct((int)($_GET['id_product']), Context::getContext()->language->id),
|
||||
'nbComments' => (int)(ProductComment::getCommentNumber((int)($_GET['id_product'])))));
|
||||
|
||||
return ($this->display(__FILE__, '/tab.tpl'));
|
||||
@@ -504,16 +497,14 @@ class ProductComments extends Module
|
||||
|
||||
private function _frontOfficePostProcess()
|
||||
{
|
||||
global $smarty, $cookie, $errors;
|
||||
|
||||
require_once(dirname(__FILE__).'/ProductComment.php');
|
||||
require_once(dirname(__FILE__).'/ProductCommentCriterion.php');
|
||||
|
||||
$allow_guests = (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS');
|
||||
if (Tools::isSubmit('submitMessage') AND (empty($cookie->id_customer) === false OR ($cookie->id_guest AND $allow_guests)))
|
||||
if (Tools::isSubmit('submitMessage') AND Context::getContext()->customer->id AND (!Context::getContext()->customer->is_guest OR $allow_guests))
|
||||
{
|
||||
$id_guest = (!$id_customer = (int)$cookie->id_customer) ? (int)$cookie->id_guest : false;
|
||||
$customerComment = ProductComment::getByCustomer((int)(Tools::getValue('id_product')), (int)$cookie->id_customer, true, (int)$id_guest);
|
||||
$id_guest = (!$id_customer = (int)Context::getContext()->cookie->id_customer) ? (int)Context::getContext()->cookie->id_guest : false;
|
||||
$customerComment = ProductComment::getByCustomer((int)(Tools::getValue('id_product')), Context::getContext()->cookie->id_customer, true, (int)$id_guest);
|
||||
|
||||
if (!$customerComment OR ($customerComment AND (strtotime($customerComment['date_add']) + Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME')) < time()))
|
||||
{
|
||||
@@ -525,7 +516,7 @@ class ProductComments extends Module
|
||||
$comment = new ProductComment();
|
||||
$comment->content = strip_tags(Tools::getValue('content'));
|
||||
$comment->id_product = (int)$_GET['id_product'];
|
||||
$comment->id_customer = (int)$cookie->id_customer;
|
||||
$comment->id_customer = (int)Context::getContext()->cookie->id_customer;
|
||||
$comment->id_guest = (int)$id_guest;
|
||||
$comment->customer_name = pSQL($customer_name);
|
||||
$comment->title = pSQL(Tools::getValue('title'));
|
||||
@@ -550,7 +541,7 @@ class ProductComments extends Module
|
||||
if (!$comment->save())
|
||||
$errors[] = $this->l('An error occurred while saving your comment.');
|
||||
else
|
||||
$smarty->assign('confirmation', $this->l('Comment posted.').((int)(Configuration::get('PRODUCT_COMMENTS_MODERATE')) ? ' '.$this->l('Awaiting moderator validation.') : ''));
|
||||
Context::getContext()->smarty->assign('confirmation', $this->l('Comment posted.').((int)(Configuration::get('PRODUCT_COMMENTS_MODERATE')) ? ' '.$this->l('Awaiting moderator validation.') : ''));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -563,22 +554,20 @@ class ProductComments extends Module
|
||||
|
||||
public function hookProductTabContent($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
$id_guest = (!$id_customer = (int)$cookie->id_customer) ? (int)$cookie->id_guest : false;
|
||||
$customerComment = ProductComment::getByCustomer((int)(Tools::getValue('id_product')), (int)$cookie->id_customer, true, (int)$id_guest);
|
||||
$id_guest = (!$id_customer = (int)Context::getContext()->cookie->id_customer) ? (int)Context::getContext()->cookie->id_guest : false;
|
||||
$customerComment = ProductComment::getByCustomer((int)(Tools::getValue('id_product')), (int)Context::getContext()->cookie->id_customer, true, (int)$id_guest);
|
||||
|
||||
$averages = ProductComment::getAveragesByProduct((int)Tools::getValue('id_product'), (int)$cookie->id_lang);
|
||||
$averages = ProductComment::getAveragesByProduct((int)Tools::getValue('id_product'), Context::getContext()->language->id);
|
||||
$averageTotal = 0;
|
||||
foreach ($averages AS $average)
|
||||
$averageTotal += (float)($average);
|
||||
$averageTotal = count($averages) ? ($averageTotal / count($averages)) : 0;
|
||||
|
||||
$smarty->assign(array(
|
||||
'logged' => (int)$cookie->id_customer,
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'logged' => (int)Context::getContext()->cookie->id_customer,
|
||||
'action_url' => '',
|
||||
'comments' => ProductComment::getByProduct((int)Tools::getValue('id_product')),
|
||||
'criterions' => ProductCommentCriterion::getByProduct((int)Tools::getValue('id_product'), (int)$cookie->id_lang),
|
||||
'criterions' => ProductCommentCriterion::getByProduct((int)Tools::getValue('id_product'), Context::getContext()->language->id),
|
||||
'averages' => $averages,
|
||||
'product_comment_path' => $this->_path,
|
||||
'averageTotal' => $averageTotal,
|
||||
@@ -599,8 +588,6 @@ class ProductComments extends Module
|
||||
|
||||
public function hookExtraProductComparison($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
$list_grades = array();
|
||||
$list_product_grades = array();
|
||||
$list_product_average = array();
|
||||
@@ -608,8 +595,8 @@ class ProductComments extends Module
|
||||
|
||||
foreach ($params['list_ids_product'] AS $id_product)
|
||||
{
|
||||
$grades = ProductComment::getAveragesByProduct((int)$id_product, (int)$cookie->id_lang);
|
||||
$criterions = ProductCommentCriterion::getByProduct((int)$id_product, (int)$cookie->id_lang);
|
||||
$grades = ProductComment::getAveragesByProduct($id_product, Context::getContext()->language->id);
|
||||
$criterions = ProductCommentCriterion::getByProduct($id_product, Context::getContext()->language->id);
|
||||
$grade_total = 0;
|
||||
if (sizeof($grades) > 0)
|
||||
{
|
||||
@@ -630,7 +617,7 @@ class ProductComments extends Module
|
||||
if (sizeof($list_grades) < 1)
|
||||
return false;
|
||||
|
||||
$smarty->assign(array('grades' => $list_grades, 'product_grades' => $list_product_grades, 'list_ids_product' => $params['list_ids_product'],
|
||||
Context::getContext()->smarty->assign(array('grades' => $list_grades, 'product_grades' => $list_product_grades, 'list_ids_product' => $params['list_ids_product'],
|
||||
'list_product_average' => $list_product_average, 'product_comments' => $list_product_comment));
|
||||
|
||||
return $this->display(__FILE__,'/products-comparison.tpl');
|
||||
|
||||
@@ -101,8 +101,6 @@ class productsCategory extends Module
|
||||
|
||||
public function hookProductFooter($params)
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
$idProduct = (int)(Tools::getValue('id_product'));
|
||||
$product = new Product((int)($idProduct));
|
||||
|
||||
@@ -120,7 +118,7 @@ class productsCategory extends Module
|
||||
return;
|
||||
|
||||
// Get infos
|
||||
$categoryProducts = $category->getProducts((int)($cookie->id_lang), 1, 100); /* 100 products max. */
|
||||
$categoryProducts = $category->getProducts($this->context->language->id, 1, 100); /* 100 products max. */
|
||||
$sizeOfCategoryProducts = (int)sizeof($categoryProducts);
|
||||
$middlePosition = 0;
|
||||
|
||||
@@ -166,7 +164,7 @@ class productsCategory extends Module
|
||||
}
|
||||
|
||||
// Display tpl
|
||||
$smarty->assign(array(
|
||||
$this->context->smarty->assign(array(
|
||||
'categoryProducts' => $categoryProducts,
|
||||
'middlePosition' => (int)$middlePosition,
|
||||
'ProdDisplayPrice' => Configuration::get('PRODUCTSCATEGORY_DISPLAY_PRICE')));
|
||||
|
||||
@@ -134,10 +134,9 @@ class StatsCatalog extends Module
|
||||
|
||||
public function hookAdminStatsModules($params)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$categories = Category::getCategories($context->language->id, true, false);
|
||||
$productToken = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id);
|
||||
$categories = Category::getCategories($this->context->language->id, true, false);
|
||||
$productToken = Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id);
|
||||
$irow = 0;
|
||||
|
||||
if ($id_category = (int)(Tools::getValue('id_category')))
|
||||
@@ -153,7 +152,7 @@ class StatsCatalog extends Module
|
||||
$totalPictures = $result1['images'];
|
||||
$averagePictures = $total ? $totalPictures / $total : 0;
|
||||
|
||||
$neverBought = $this->getProductsNB($context->language->id);
|
||||
$neverBought = $this->getProductsNB($this->context->language->id);
|
||||
$totalNB = $neverBought['total'];
|
||||
$productsNB = $neverBought['result'];
|
||||
|
||||
@@ -187,7 +186,7 @@ class StatsCatalog extends Module
|
||||
<div class="clear space"></div>
|
||||
<table>
|
||||
'.$this->returnLine($this->l('Products available:'), (int)($total)).'
|
||||
'.$this->returnLine($this->l('Average price (base price):'), Tools::displayPrice($averagePrice, $context->currency)).'
|
||||
'.$this->returnLine($this->l('Average price (base price):'), Tools::displayPrice($averagePrice, $this->context->currency)).'
|
||||
'.$this->returnLine($this->l('Product pages viewed:'), (int)($totalPageViewed)).'
|
||||
'.$this->returnLine($this->l('Products bought:'), (int)($totalBought)).'
|
||||
'.$this->returnLine($this->l('Average number of page visits:'), number_format((float)($averageViewed), 2, '.', '')).'
|
||||
@@ -217,7 +216,7 @@ class StatsCatalog extends Module
|
||||
<td style="width: 400px;">'.$product['name'].'</td>
|
||||
<td style="text-align: right">
|
||||
<a href="index.php?tab=AdminCatalog&id_product='.$product['id_product'].'&addproduct&token='.$productToken.'" target="_blank"><img src="../modules/'.$this->name.'/page_edit.png" /></a>
|
||||
<a href="'.$context->link->getProductLink($product['id_product'], $product['link_rewrite']).'" target="_blank"><img src="../modules/'.$this->name.'/application_home.png" /></a>
|
||||
<a href="'.$this->context->link->getProductLink($product['id_product'], $product['link_rewrite']).'" target="_blank"><img src="../modules/'.$this->name.'/application_home.png" /></a>
|
||||
</td>
|
||||
</tr>';
|
||||
$html .= '
|
||||
|
||||
Reference in New Issue
Block a user