[*] Front: move front controllers in controllers/front/ directory
// Refactoring of front controllers part 1 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8721 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
Vendored
+82
-82
@@ -252,9 +252,9 @@
|
|||||||
'DbMySQLiCore' => 'classes/db/DbMySQLi.php',
|
'DbMySQLiCore' => 'classes/db/DbMySQLi.php',
|
||||||
'DbMySQLi' => 'override/classes/db/DbMySQLi.php',
|
'DbMySQLi' => 'override/classes/db/DbMySQLi.php',
|
||||||
'DbPDOCore' => 'classes/db/DbPDO.php',
|
'DbPDOCore' => 'classes/db/DbPDO.php',
|
||||||
'DbPDO' => '',
|
'DbPDO' => 'override/classes/db/DbPDO.php',
|
||||||
'DbQueryCore' => 'classes/db/DbQuery.php',
|
'DbQueryCore' => 'classes/db/DbQuery.php',
|
||||||
'DbQuery' => '',
|
'DbQuery' => 'override/classes/db/DbQuery.php',
|
||||||
'MySQLCore' => 'classes/db/MySQL.php',
|
'MySQLCore' => 'classes/db/MySQL.php',
|
||||||
'MySQL' => 'override/classes/db/MySQL.php',
|
'MySQL' => 'override/classes/db/MySQL.php',
|
||||||
'GroupShopCore' => 'classes/shop/GroupShop.php',
|
'GroupShopCore' => 'classes/shop/GroupShop.php',
|
||||||
@@ -279,84 +279,84 @@
|
|||||||
'TaxRulesTaxManagerCore' => 'classes/tax/TaxRulesTaxManager.php',
|
'TaxRulesTaxManagerCore' => 'classes/tax/TaxRulesTaxManager.php',
|
||||||
'TaxRulesTaxManager' => 'override/classes/tax/TaxRulesTaxManager.php',
|
'TaxRulesTaxManager' => 'override/classes/tax/TaxRulesTaxManager.php',
|
||||||
'FB' => 'override/classes/fb.php',
|
'FB' => 'override/classes/fb.php',
|
||||||
'AddressControllerCore' => 'controllers/AddressController.php',
|
'AddressControllerCore' => 'controllers/front/AddressController.php',
|
||||||
'AddressController' => 'override/controllers/AddressController.php',
|
'AddressController' => 'override/controllers/front/AddressController.php',
|
||||||
'AddressesControllerCore' => 'controllers/AddressesController.php',
|
'AddressesControllerCore' => 'controllers/front/AddressesController.php',
|
||||||
'AddressesController' => 'override/controllers/AddressesController.php',
|
'AddressesController' => 'override/controllers/front/AddressesController.php',
|
||||||
'AttachmentControllerCore' => 'controllers/AttachmentController.php',
|
'AttachmentControllerCore' => 'controllers/front/AttachmentController.php',
|
||||||
'AttachmentController' => 'override/controllers/AttachmentController.php',
|
'AttachmentController' => 'override/controllers/front/AttachmentController.php',
|
||||||
'AuthControllerCore' => 'controllers/AuthController.php',
|
'AuthControllerCore' => 'controllers/front/AuthController.php',
|
||||||
'AuthController' => 'override/controllers/AuthController.php',
|
'AuthController' => 'override/controllers/front/AuthController.php',
|
||||||
'BestSalesControllerCore' => 'controllers/BestSalesController.php',
|
'BestSalesControllerCore' => 'controllers/front/BestSalesController.php',
|
||||||
'BestSalesController' => 'override/controllers/BestSalesController.php',
|
'BestSalesController' => 'override/controllers/front/BestSalesController.php',
|
||||||
'CartControllerCore' => 'controllers/CartController.php',
|
'CartControllerCore' => 'controllers/front/CartController.php',
|
||||||
'CartController' => 'override/controllers/CartController.php',
|
'CartController' => 'override/controllers/front/CartController.php',
|
||||||
'CategoryControllerCore' => 'controllers/CategoryController.php',
|
'CategoryControllerCore' => 'controllers/front/CategoryController.php',
|
||||||
'CategoryController' => 'override/controllers/CategoryController.php',
|
'CategoryController' => 'override/controllers/front/CategoryController.php',
|
||||||
'ChangeCurrencyControllerCore' => 'controllers/ChangeCurrencyController.php',
|
'ChangeCurrencyControllerCore' => 'controllers/front/ChangeCurrencyController.php',
|
||||||
'ChangeCurrencyController' => 'override/controllers/ChangeCurrencyController.php',
|
'ChangeCurrencyController' => 'override/controllers/front/ChangeCurrencyController.php',
|
||||||
'CmsControllerCore' => 'controllers/CmsController.php',
|
'CmsControllerCore' => 'controllers/front/CmsController.php',
|
||||||
'CmsController' => 'override/controllers/CmsController.php',
|
'CmsController' => 'override/controllers/front/CmsController.php',
|
||||||
'CompareControllerCore' => 'controllers/CompareController.php',
|
'CompareControllerCore' => 'controllers/front/CompareController.php',
|
||||||
'CompareController' => 'override/controllers/CompareController.php',
|
'CompareController' => 'override/controllers/front/CompareController.php',
|
||||||
'ContactControllerCore' => 'controllers/ContactController.php',
|
'ContactControllerCore' => 'controllers/front/ContactController.php',
|
||||||
'ContactController' => 'override/controllers/ContactController.php',
|
'ContactController' => 'override/controllers/front/ContactController.php',
|
||||||
'DiscountControllerCore' => 'controllers/DiscountController.php',
|
'DiscountControllerCore' => 'controllers/front/DiscountController.php',
|
||||||
'DiscountController' => 'override/controllers/DiscountController.php',
|
'DiscountController' => 'override/controllers/front/DiscountController.php',
|
||||||
'GetFileControllerCore' => 'controllers/GetFileController.php',
|
'GetFileControllerCore' => 'controllers/front/GetFileController.php',
|
||||||
'GetFileController' => 'override/controllers/GetFileController.php',
|
'GetFileController' => 'override/controllers/front/GetFileController.php',
|
||||||
'GuestTrackingControllerCore' => 'controllers/GuestTrackingController.php',
|
'GuestTrackingControllerCore' => 'controllers/front/GuestTrackingController.php',
|
||||||
'GuestTrackingController' => 'override/controllers/GuestTrackingController.php',
|
'GuestTrackingController' => 'override/controllers/front/GuestTrackingController.php',
|
||||||
'HistoryControllerCore' => 'controllers/HistoryController.php',
|
'HistoryControllerCore' => 'controllers/front/HistoryController.php',
|
||||||
'HistoryController' => 'override/controllers/HistoryController.php',
|
'HistoryController' => 'override/controllers/front/HistoryController.php',
|
||||||
'IdentityControllerCore' => 'controllers/IdentityController.php',
|
'IdentityControllerCore' => 'controllers/front/IdentityController.php',
|
||||||
'IdentityController' => 'override/controllers/IdentityController.php',
|
'IdentityController' => 'override/controllers/front/IdentityController.php',
|
||||||
'IndexControllerCore' => 'controllers/IndexController.php',
|
'IndexControllerCore' => 'controllers/front/IndexController.php',
|
||||||
'IndexController' => 'override/controllers/IndexController.php',
|
'IndexController' => 'override/controllers/front/IndexController.php',
|
||||||
'ManufacturerControllerCore' => 'controllers/ManufacturerController.php',
|
'ManufacturerControllerCore' => 'controllers/front/ManufacturerController.php',
|
||||||
'ManufacturerController' => 'override/controllers/ManufacturerController.php',
|
'ManufacturerController' => 'override/controllers/front/ManufacturerController.php',
|
||||||
'MyAccountControllerCore' => 'controllers/MyAccountController.php',
|
'MyAccountControllerCore' => 'controllers/front/MyAccountController.php',
|
||||||
'MyAccountController' => 'override/controllers/MyAccountController.php',
|
'MyAccountController' => 'override/controllers/front/MyAccountController.php',
|
||||||
'NewProductsControllerCore' => 'controllers/NewProductsController.php',
|
'NewProductsControllerCore' => 'controllers/front/NewProductsController.php',
|
||||||
'NewProductsController' => 'override/controllers/NewProductsController.php',
|
'NewProductsController' => 'override/controllers/front/NewProductsController.php',
|
||||||
'OrderConfirmationControllerCore' => 'controllers/OrderConfirmationController.php',
|
'OrderConfirmationControllerCore' => 'controllers/front/OrderConfirmationController.php',
|
||||||
'OrderConfirmationController' => 'override/controllers/OrderConfirmationController.php',
|
'OrderConfirmationController' => 'override/controllers/front/OrderConfirmationController.php',
|
||||||
'OrderControllerCore' => 'controllers/OrderController.php',
|
'OrderControllerCore' => 'controllers/front/OrderController.php',
|
||||||
'OrderController' => 'override/controllers/OrderController.php',
|
'OrderController' => 'override/controllers/front/OrderController.php',
|
||||||
'OrderDetailControllerCore' => 'controllers/OrderDetailController.php',
|
'OrderDetailControllerCore' => 'controllers/front/OrderDetailController.php',
|
||||||
'OrderDetailController' => 'override/controllers/OrderDetailController.php',
|
'OrderDetailController' => 'override/controllers/front/OrderDetailController.php',
|
||||||
'OrderFollowControllerCore' => 'controllers/OrderFollowController.php',
|
'OrderFollowControllerCore' => 'controllers/front/OrderFollowController.php',
|
||||||
'OrderFollowController' => 'override/controllers/OrderFollowController.php',
|
'OrderFollowController' => 'override/controllers/front/OrderFollowController.php',
|
||||||
'OrderOpcControllerCore' => 'controllers/OrderOpcController.php',
|
'OrderOpcControllerCore' => 'controllers/front/OrderOpcController.php',
|
||||||
'OrderOpcController' => 'override/controllers/OrderOpcController.php',
|
'OrderOpcController' => 'override/controllers/front/OrderOpcController.php',
|
||||||
'OrderReturnControllerCore' => 'controllers/OrderReturnController.php',
|
'OrderReturnControllerCore' => 'controllers/front/OrderReturnController.php',
|
||||||
'OrderReturnController' => 'override/controllers/OrderReturnController.php',
|
'OrderReturnController' => 'override/controllers/front/OrderReturnController.php',
|
||||||
'OrderSlipControllerCore' => 'controllers/OrderSlipController.php',
|
'OrderSlipControllerCore' => 'controllers/front/OrderSlipController.php',
|
||||||
'OrderSlipController' => 'override/controllers/OrderSlipController.php',
|
'OrderSlipController' => 'override/controllers/front/OrderSlipController.php',
|
||||||
'PageNotFoundControllerCore' => 'controllers/PageNotFoundController.php',
|
'PageNotFoundControllerCore' => 'controllers/front/PageNotFoundController.php',
|
||||||
'PageNotFoundController' => 'override/controllers/PageNotFoundController.php',
|
'PageNotFoundController' => 'override/controllers/front/PageNotFoundController.php',
|
||||||
'ParentOrderControllerCore' => 'controllers/ParentOrderController.php',
|
'ParentOrderControllerCore' => 'controllers/front/ParentOrderController.php',
|
||||||
'ParentOrderController' => 'override/controllers/ParentOrderController.php',
|
'ParentOrderController' => 'override/controllers/front/ParentOrderController.php',
|
||||||
'PasswordControllerCore' => 'controllers/PasswordController.php',
|
'PasswordControllerCore' => 'controllers/front/PasswordController.php',
|
||||||
'PasswordController' => 'override/controllers/PasswordController.php',
|
'PasswordController' => 'override/controllers/front/PasswordController.php',
|
||||||
'PdfInvoiceControllerCore' => 'controllers/PdfInvoiceController.php',
|
'PdfInvoiceControllerCore' => 'controllers/front/PdfInvoiceController.php',
|
||||||
'PdfInvoiceController' => 'override/controllers/PdfInvoiceController.php',
|
'PdfInvoiceController' => 'override/controllers/front/PdfInvoiceController.php',
|
||||||
'PdfOrderReturnControllerCore' => 'controllers/PdfOrderReturnController.php',
|
'PdfOrderReturnControllerCore' => 'controllers/front/PdfOrderReturnController.php',
|
||||||
'PdfOrderReturnController' => 'override/controllers/pdfOrderReturnController.php',
|
'PdfOrderReturnController' => 'override/controllers/front/pdfOrderReturnController.php',
|
||||||
'PdfOrderSlipControllerCore' => 'controllers/PdfOrderSlipController.php',
|
'PdfOrderSlipControllerCore' => 'controllers/front/PdfOrderSlipController.php',
|
||||||
'PdfOrderSlipController' => 'override/controllers/pdfOrderSlipController.php',
|
'PdfOrderSlipController' => 'override/controllers/front/pdfOrderSlipController.php',
|
||||||
'PricesDropControllerCore' => 'controllers/PricesDropController.php',
|
'PricesDropControllerCore' => 'controllers/front/PricesDropController.php',
|
||||||
'PricesDropController' => 'override/controllers/PricesDropController.php',
|
'PricesDropController' => 'override/controllers/front/PricesDropController.php',
|
||||||
'ProductControllerCore' => 'controllers/ProductController.php',
|
'ProductControllerCore' => 'controllers/front/ProductController.php',
|
||||||
'ProductController' => 'override/controllers/ProductController.php',
|
'ProductController' => 'override/controllers/front/ProductController.php',
|
||||||
'SearchControllerCore' => 'controllers/SearchController.php',
|
'SearchControllerCore' => 'controllers/front/SearchController.php',
|
||||||
'SearchController' => 'override/controllers/SearchController.php',
|
'SearchController' => 'override/controllers/front/SearchController.php',
|
||||||
'SitemapControllerCore' => 'controllers/SitemapController.php',
|
'SitemapControllerCore' => 'controllers/front/SitemapController.php',
|
||||||
'SitemapController' => 'override/controllers/SitemapController.php',
|
'SitemapController' => 'override/controllers/front/SitemapController.php',
|
||||||
'StatisticsControllerCore' => 'controllers/StatisticsController.php',
|
'StatisticsControllerCore' => 'controllers/front/StatisticsController.php',
|
||||||
'StatisticsController' => 'override/controllers/StatisticsController.php',
|
'StatisticsController' => 'override/controllers/front/StatisticsController.php',
|
||||||
'StoresControllerCore' => 'controllers/StoresController.php',
|
'StoresControllerCore' => 'controllers/front/StoresController.php',
|
||||||
'StoresController' => 'override/controllers/StoresController.php',
|
'StoresController' => 'override/controllers/front/StoresController.php',
|
||||||
'SupplierControllerCore' => 'controllers/SupplierController.php',
|
'SupplierControllerCore' => 'controllers/front/SupplierController.php',
|
||||||
'SupplierController' => 'override/controllers/SupplierController.php',
|
'SupplierController' => 'override/controllers/front/SupplierController.php',
|
||||||
);
|
);
|
||||||
@@ -42,6 +42,37 @@ abstract class ControllerCore
|
|||||||
*/
|
*/
|
||||||
public $js_files = array();
|
public $js_files = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool check if header will be displayed
|
||||||
|
*/
|
||||||
|
protected $displayHeader = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string template name for page content
|
||||||
|
*/
|
||||||
|
protected $template;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string check if footer will be displayed
|
||||||
|
*/
|
||||||
|
protected $displayFooter = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the page
|
||||||
|
*/
|
||||||
|
abstract public function init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do the page treatment : post process, ajax process, etc.
|
||||||
|
* Enter description here ...
|
||||||
|
*/
|
||||||
|
abstract public function action();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display page view
|
||||||
|
*/
|
||||||
|
abstract public function display();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set default media list for controller
|
* Set default media list for controller
|
||||||
*/
|
*/
|
||||||
@@ -64,6 +95,31 @@ abstract class ControllerCore
|
|||||||
$this->context = Context::getContext();
|
$this->context = Context::getContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start controller process
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$this->init();
|
||||||
|
$this->action();
|
||||||
|
$this->display();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function displayHeader($display = true)
|
||||||
|
{
|
||||||
|
$this->displayHeader = $display;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function displayFooter($display = true)
|
||||||
|
{
|
||||||
|
$this->displayFooter = $display;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTemplate($template)
|
||||||
|
{
|
||||||
|
$this->template = $template;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new stylesheet in page header.
|
* Add a new stylesheet in page header.
|
||||||
*
|
*
|
||||||
|
|||||||
+17
-7
@@ -188,7 +188,7 @@ class DispatcherCore
|
|||||||
}
|
}
|
||||||
// Get and instantiate controller
|
// Get and instantiate controller
|
||||||
$this->getController();
|
$this->getController();
|
||||||
$controllers = Dispatcher::getControllers();
|
$controllers = Dispatcher::getControllers(_PS_CONTROLLER_DIR_);
|
||||||
if (!$this->controller)
|
if (!$this->controller)
|
||||||
$this->controller = 'index';
|
$this->controller = 'index';
|
||||||
if (!isset($controllers[$this->controller]))
|
if (!isset($controllers[$this->controller]))
|
||||||
@@ -423,18 +423,28 @@ class DispatcherCore
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getControllers()
|
public static function getControllers($dir)
|
||||||
{
|
{
|
||||||
$controller_files = scandir(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'controllers');
|
static $controllers;
|
||||||
$controllers = array();
|
|
||||||
|
$controller_files = scandir($dir);
|
||||||
foreach ($controller_files as $controller_filename)
|
foreach ($controller_files as $controller_filename)
|
||||||
if (substr($controller_filename, -14, 14) == 'Controller.php')
|
{
|
||||||
|
if (!in_array($controller_filename, array('.','..','.svn')) AND is_dir($dir.$controller_filename))
|
||||||
|
$controllers = self::getControllers($dir.$controller_filename.DIRECTORY_SEPARATOR);
|
||||||
|
else if (substr($controller_filename, -14, 14) == 'Controller.php')
|
||||||
|
{
|
||||||
|
$subdir = str_replace(_PS_CONTROLLER_DIR_,'',$dir);
|
||||||
$controllers[strtolower(substr($controller_filename, 0, -14))] = basename($controller_filename, '.php');
|
$controllers[strtolower(substr($controller_filename, 0, -14))] = basename($controller_filename, '.php');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add default controller
|
// add default controller
|
||||||
$controllers['index'] = 'IndexController';
|
$controllers['index'] = 'IndexController';
|
||||||
$controllers['authentication'] = $controllers['auth'];
|
if (isset($controllers['auth']))
|
||||||
$controllers['productscomparison'] = $controllers['compare'];
|
$controllers['authentication'] = $controllers['auth'];
|
||||||
|
if (isset($controllers['compare']))
|
||||||
|
$controllers['productscomparison'] = $controllers['compare'];
|
||||||
|
|
||||||
return $controllers;
|
return $controllers;
|
||||||
}
|
}
|
||||||
|
|||||||
+92
-93
@@ -29,11 +29,10 @@ class FrontControllerCore extends ControllerCore
|
|||||||
{
|
{
|
||||||
public $errors = array();
|
public $errors = array();
|
||||||
|
|
||||||
/* Deprecated shortcuts as of 1.5 - Use $context->var instead */
|
/**
|
||||||
protected static $smarty;
|
* @deprecated Deprecated shortcuts as of 1.5 - Use $context->var instead
|
||||||
protected static $cookie;
|
*/
|
||||||
protected static $link;
|
protected static $smarty, $cookie, $link, $cart;
|
||||||
protected static $cart;
|
|
||||||
|
|
||||||
public $iso;
|
public $iso;
|
||||||
|
|
||||||
@@ -49,15 +48,11 @@ class FrontControllerCore extends ControllerCore
|
|||||||
|
|
||||||
protected $restrictedCountry = false;
|
protected $restrictedCountry = false;
|
||||||
protected $maintenance = false;
|
protected $maintenance = false;
|
||||||
protected $id_current_shop;
|
|
||||||
protected $id_current_group_shop;
|
|
||||||
|
|
||||||
public static $initialized = false;
|
public static $initialized = false;
|
||||||
|
|
||||||
protected static $currentCustomerGroups;
|
protected static $currentCustomerGroups;
|
||||||
|
|
||||||
public $css_files;
|
|
||||||
public $js_files;
|
|
||||||
public $nb_items_per_page;
|
public $nb_items_per_page;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -68,16 +63,6 @@ class FrontControllerCore extends ControllerCore
|
|||||||
$useSSL = $this->ssl;
|
$useSSL = $this->ssl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$this->init();
|
|
||||||
$this->preProcess();
|
|
||||||
$this->displayHeader();
|
|
||||||
$this->process();
|
|
||||||
$this->displayContent();
|
|
||||||
$this->displayFooter();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -91,12 +76,6 @@ class FrontControllerCore extends ControllerCore
|
|||||||
return;
|
return;
|
||||||
self::$initialized = true;
|
self::$initialized = true;
|
||||||
|
|
||||||
$this->id_current_shop = Context::getContext()->shop->getID();
|
|
||||||
$this->id_current_group_shop = Context::getContext()->shop->getGroupID();
|
|
||||||
|
|
||||||
$this->css_files = array();
|
|
||||||
$this->js_files = array();
|
|
||||||
|
|
||||||
// For compatibility with globals, DEPRECATED as of version 1.5
|
// For compatibility with globals, DEPRECATED as of version 1.5
|
||||||
$css_files = $this->css_files;
|
$css_files = $this->css_files;
|
||||||
$js_files = $this->js_files;
|
$js_files = $this->js_files;
|
||||||
@@ -201,8 +180,8 @@ class FrontControllerCore extends ControllerCore
|
|||||||
$cart->id_lang = (int)($this->context->cookie->id_lang);
|
$cart->id_lang = (int)($this->context->cookie->id_lang);
|
||||||
$cart->id_currency = (int)($this->context->cookie->id_currency);
|
$cart->id_currency = (int)($this->context->cookie->id_currency);
|
||||||
$cart->id_guest = (int)($this->context->cookie->id_guest);
|
$cart->id_guest = (int)($this->context->cookie->id_guest);
|
||||||
$cart->id_group_shop = (int)$this->id_current_group_shop;
|
$cart->id_group_shop = (int)$this->context->shop->getGroupID();
|
||||||
$cart->id_shop = $this->id_current_shop;
|
$cart->id_shop = $this->context->shop->getID(true);
|
||||||
if ($this->context->cookie->id_customer)
|
if ($this->context->cookie->id_customer)
|
||||||
{
|
{
|
||||||
$cart->id_customer = (int)($this->context->cookie->id_customer);
|
$cart->id_customer = (int)($this->context->cookie->id_customer);
|
||||||
@@ -247,7 +226,9 @@ class FrontControllerCore extends ControllerCore
|
|||||||
if (!defined('_PS_BASE_URL_SSL_'))
|
if (!defined('_PS_BASE_URL_SSL_'))
|
||||||
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
|
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
|
||||||
|
|
||||||
$this->canonicalRedirection();
|
// Automatically redirect to the canonical URL if needed
|
||||||
|
if (isset($this->php_self) && !empty($this->php_self) && !Tools::getValue('ajax'))
|
||||||
|
$this->canonicalRedirection($this->context->link->getPageLink($this->php_self, $this->ssl, $this->context->language->id));
|
||||||
|
|
||||||
Product::initPricesComputation();
|
Product::initPricesComputation();
|
||||||
|
|
||||||
@@ -259,6 +240,7 @@ class FrontControllerCore extends ControllerCore
|
|||||||
if (Validate::isLoadedObject($country))
|
if (Validate::isLoadedObject($country))
|
||||||
$display_tax_label = $country->display_tax_label;
|
$display_tax_label = $country->display_tax_label;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'link' => $link,
|
'link' => $link,
|
||||||
'cart' => $cart,
|
'cart' => $cart,
|
||||||
@@ -351,6 +333,64 @@ class FrontControllerCore extends ControllerCore
|
|||||||
$this->context->cart = $cart;
|
$this->context->cart = $cart;
|
||||||
$this->context->currency = $currency;
|
$this->context->currency = $currency;
|
||||||
$this->context->controller = $this;
|
$this->context->controller = $this;
|
||||||
|
|
||||||
|
$this->displayHeader();
|
||||||
|
$this->displayFooter();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function action()
|
||||||
|
{
|
||||||
|
// For retrocompatibility
|
||||||
|
if (method_exists($this, 'preProcess'))
|
||||||
|
{
|
||||||
|
Tools::displayAsDeprecated('Method preProcess() is deprecated in controllers, use method postProcess() instead');
|
||||||
|
$this->preProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Tools::getValue('ajax') == 'true')
|
||||||
|
{
|
||||||
|
$this->displayHeader(false);
|
||||||
|
$this->displayFooter(false);
|
||||||
|
$this->ajaxProcess();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->postProcess();
|
||||||
|
|
||||||
|
// Prepare generation of page display
|
||||||
|
$this->processHeader();
|
||||||
|
$this->process();
|
||||||
|
$this->processFooter();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ajaxProcess()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function postProcess()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function process()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function display()
|
||||||
|
{
|
||||||
|
if ($this->displayHeader)
|
||||||
|
$this->context->smarty->display(_PS_THEME_DIR_.'header.tpl');
|
||||||
|
|
||||||
|
if ($this->template)
|
||||||
|
$this->context->smarty->display($this->template);
|
||||||
|
|
||||||
|
if ($this->displayFooter)
|
||||||
|
$this->context->smarty->display(_PS_THEME_DIR_.'footer.tpl');
|
||||||
|
|
||||||
|
// live edit
|
||||||
|
if (Tools::isSubmit('live_edit') AND $ad = Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_)))
|
||||||
|
{
|
||||||
|
$this->context->smarty->assign(array('ad' => $ad, 'live_edit' => true));
|
||||||
|
$this->context->smarty->display(_PS_ALL_THEMES_DIR_.'live_edit.tpl');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display a maintenance page if shop is closed */
|
/* Display a maintenance page if shop is closed */
|
||||||
@@ -372,31 +412,28 @@ class FrontControllerCore extends ControllerCore
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function canonicalRedirection()
|
protected function canonicalRedirection($canonicalURL)
|
||||||
{
|
{
|
||||||
// Automatically redirect to the canonical URL if needed
|
if (!Configuration::get('PS_CANONICAL_REDIRECT'))
|
||||||
if (isset($this->php_self) AND !empty($this->php_self))
|
return;
|
||||||
|
|
||||||
|
$matchUrl = (($this->ssl && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||||
|
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', $matchUrl))
|
||||||
{
|
{
|
||||||
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
|
$params = array();
|
||||||
|
$excludedKey = array('isolang', 'id_lang', 'controller');
|
||||||
|
foreach ($_GET as $key => $value)
|
||||||
|
if (!in_array($key, $excludedKey))
|
||||||
|
$params[] = $key.'='.$value;
|
||||||
|
|
||||||
$canonicalURL = $this->context->link->getPageLink($this->php_self, $this->ssl, $this->context->language->id);
|
$strParams = '';
|
||||||
if (!Tools::getValue('ajax') && !preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', (($this->ssl AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
if ($params)
|
||||||
{
|
$strParams = ((strpos($canonicalURL, '?') === false) ? '?' : '&').implode('&', $params);
|
||||||
header('HTTP/1.0 301 Moved');
|
|
||||||
$params = array();
|
|
||||||
$excludedKey = array('isolang', 'id_lang', 'controller');
|
|
||||||
foreach ($_GET as $key => $value)
|
|
||||||
if (!in_array($key, $excludedKey))
|
|
||||||
$params[] = $key.'='.$value;
|
|
||||||
if ($params)
|
|
||||||
$params = ((strpos($canonicalURL, '?') === false) ? '?' : '&').implode('&', $params);
|
|
||||||
else
|
|
||||||
$params = '';
|
|
||||||
|
|
||||||
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $_SERVER['REQUEST_URI'] != __PS_BASE_URI__)
|
header('HTTP/1.0 301 Moved');
|
||||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$canonicalURL.$params.'">'.$canonicalURL.$params.'</a>');
|
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $_SERVER['REQUEST_URI'] != __PS_BASE_URI__)
|
||||||
Tools::redirectLink($canonicalURL.$params);
|
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$canonicalURL.$strParams.'">'.$canonicalURL.$strParams.'</a>');
|
||||||
}
|
Tools::redirectLink($canonicalURL.$strParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,10 +496,6 @@ class FrontControllerCore extends ControllerCore
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preProcess()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'global.css', 'all');
|
$this->addCSS(_THEME_CSS_DIR_.'global.css', 'all');
|
||||||
@@ -480,27 +513,14 @@ class FrontControllerCore extends ControllerCore
|
|||||||
$this->addCSS(_THEME_CSS_DIR_.'rtl.css');
|
$this->addCSS(_THEME_CSS_DIR_.'rtl.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function processHeader()
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
Tools::safePostVars();
|
|
||||||
$this->context->smarty->assign('errors', $this->errors);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function displayHeader()
|
|
||||||
{
|
|
||||||
if (!self::$initialized)
|
|
||||||
$this->init();
|
|
||||||
// if this function is called from a module, do a fast init
|
|
||||||
else if (!$this->context)
|
|
||||||
$this->context = Context::getContext();
|
|
||||||
|
|
||||||
// P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies)
|
// P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies)
|
||||||
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
|
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
|
||||||
|
|
||||||
|
Tools::safePostVars();
|
||||||
|
$this->context->smarty->assign('errors', $this->errors);
|
||||||
|
|
||||||
/* Hooks are volontary out the initialize array (need those variables already assigned) */
|
/* Hooks are volontary out the initialize array (need those variables already assigned) */
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'time' => time(),
|
'time' => time(),
|
||||||
@@ -531,39 +551,18 @@ class FrontControllerCore extends ControllerCore
|
|||||||
|
|
||||||
$this->context->smarty->assign('css_files', $this->css_files);
|
$this->context->smarty->assign('css_files', $this->css_files);
|
||||||
$this->context->smarty->assign('js_files', array_unique($this->js_files));
|
$this->context->smarty->assign('js_files', array_unique($this->js_files));
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'header.tpl');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayFooter()
|
public function processFooter()
|
||||||
{
|
{
|
||||||
if (!self::$initialized)
|
|
||||||
$this->init();
|
|
||||||
// if this function is called from a module, do a fast init
|
|
||||||
else if (!$this->context)
|
|
||||||
$this->context = Context::getContext();
|
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn', array('cart' => $this->context->cart)),
|
'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn', array('cart' => $this->context->cart)),
|
||||||
'HOOK_FOOTER' => Module::hookExec('footer'),
|
'HOOK_FOOTER' => Module::hookExec('footer'),
|
||||||
'content_only' => (int)(Tools::getValue('content_only'))));
|
));
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'footer.tpl');
|
|
||||||
//live edit
|
|
||||||
if (Tools::isSubmit('live_edit') AND $ad = Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_)))
|
|
||||||
{
|
|
||||||
$this->context->smarty->assign(array('ad' => $ad, 'live_edit' => true));
|
|
||||||
$this->context->smarty->display(_PS_ALL_THEMES_DIR_.'live_edit.tpl');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Tools::displayError();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function productSort()
|
public function productSort()
|
||||||
{
|
{
|
||||||
if (!self::$initialized)
|
|
||||||
$this->init();
|
|
||||||
elseif (!$this->context)
|
|
||||||
$this->context = Context::getContext();
|
|
||||||
|
|
||||||
// $this->orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));
|
// $this->orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));
|
||||||
// $this->orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));
|
// $this->orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway'));
|
||||||
// 'orderbydefault' => Tools::getProductsOrder('by'),
|
// 'orderbydefault' => Tools::getProductsOrder('by'),
|
||||||
|
|||||||
@@ -38,9 +38,10 @@ class AddressControllerCore extends FrontController
|
|||||||
|
|
||||||
protected $_address;
|
protected $_address;
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
parent::init();
|
||||||
|
|
||||||
if ($back = Tools::getValue('back'))
|
if ($back = Tools::getValue('back'))
|
||||||
$this->context->smarty->assign('back', Tools::safeOutput($back));
|
$this->context->smarty->assign('back', Tools::safeOutput($back));
|
||||||
if ($mod = Tools::getValue('mod'))
|
if ($mod = Tools::getValue('mod'))
|
||||||
@@ -267,6 +268,8 @@ class AddressControllerCore extends FrontController
|
|||||||
'token' => Tools::getToken(false),
|
'token' => Tools::getToken(false),
|
||||||
'select_address' => (int)(Tools::getValue('select_address'))
|
'select_address' => (int)(Tools::getValue('select_address'))
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'address.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _processAddressFormat()
|
protected function _processAddressFormat()
|
||||||
@@ -284,14 +287,6 @@ class AddressControllerCore extends FrontController
|
|||||||
parent::displayHeader();
|
parent::displayHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
|
|
||||||
$this->_processAddressFormat();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'address.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function displayFooter()
|
public function displayFooter()
|
||||||
{
|
{
|
||||||
if (Tools::getValue('ajax') != 'true')
|
if (Tools::getValue('ajax') != 'true')
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -31,42 +31,41 @@ class AddressesControllerCore extends FrontController
|
|||||||
public $php_self = 'addresses';
|
public $php_self = 'addresses';
|
||||||
public $authRedirection = 'addresses';
|
public $authRedirection = 'addresses';
|
||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
||||||
$this->addJS(_THEME_JS_DIR_.'tools.js');
|
$this->addJS(_THEME_JS_DIR_.'tools.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
$multipleAddressesFormated = array();
|
$multipleAddressesFormated = array();
|
||||||
$ordered_fields = array();
|
$ordered_fields = array();
|
||||||
$customer = $this->context->customer;
|
$customer = $this->context->customer;
|
||||||
|
|
||||||
if (!Validate::isLoadedObject($customer))
|
if (!Validate::isLoadedObject($customer))
|
||||||
die(Tools::displayError('Customer not found'));
|
die(Tools::displayError('Customer not found'));
|
||||||
|
|
||||||
// Retro Compatibility Theme < 1.4.1
|
// Retro Compatibility Theme < 1.4.1
|
||||||
$this->context->smarty->assign('addresses', $customer->getAddresses($this->context->language->id));
|
$this->context->smarty->assign('addresses', $customer->getAddresses($this->context->language->id));
|
||||||
|
|
||||||
$customerAddressesDetailed = $customer->getAddresses($this->context->language->id);
|
$customerAddressesDetailed = $customer->getAddresses($this->context->language->id);
|
||||||
|
|
||||||
$total = 0;
|
$total = 0;
|
||||||
foreach($customerAddressesDetailed as $addressDetailed)
|
foreach($customerAddressesDetailed as $addressDetailed)
|
||||||
{
|
{
|
||||||
$address = new Address($addressDetailed['id_address']);
|
$address = new Address($addressDetailed['id_address']);
|
||||||
|
|
||||||
$multipleAddressesFormated[$total] = AddressFormat::getFormattedLayoutData($address);
|
$multipleAddressesFormated[$total] = AddressFormat::getFormattedLayoutData($address);
|
||||||
unset($address);
|
unset($address);
|
||||||
++$total;
|
++$total;
|
||||||
|
|
||||||
// Retro theme < 1.4.2
|
// Retro theme < 1.4.2
|
||||||
$ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country'], false, true);
|
$ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country'], false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retro theme 1.4.2
|
// Retro theme 1.4.2
|
||||||
if (($key = array_search('Country:name', $ordered_fields)))
|
if (($key = array_search('Country:name', $ordered_fields)))
|
||||||
$ordered_fields[$key] = 'country';
|
$ordered_fields[$key] = 'country';
|
||||||
@@ -84,16 +83,12 @@ class AddressesControllerCore extends FrontController
|
|||||||
,'phone_mobile' => 'address_phone_mobile'
|
,'phone_mobile' => 'address_phone_mobile'
|
||||||
,'alias' => 'address_title'
|
,'alias' => 'address_title'
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'multipleAddresses' => $multipleAddressesFormated,
|
'multipleAddresses' => $multipleAddressesFormated,
|
||||||
'ordered_fields' => $ordered_fields));
|
'ordered_fields' => $ordered_fields));
|
||||||
}
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'addresses.tpl');
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'addresses.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,8 +29,6 @@ class AttachmentControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
$a = new Attachment(Tools::getValue('id_attachment'), $this->context->language->id);
|
$a = new Attachment(Tools::getValue('id_attachment'), $this->context->language->id);
|
||||||
if (!$a->id)
|
if (!$a->id)
|
||||||
Tools::redirect('index.php');
|
Tools::redirect('index.php');
|
||||||
@@ -30,9 +30,9 @@ class AuthControllerCore extends FrontController
|
|||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
public $php_self = 'authentication';
|
public $php_self = 'authentication';
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
parent::init();
|
||||||
|
|
||||||
if ($this->context->customer->isLogged() AND !Tools::isSubmit('ajax'))
|
if ($this->context->customer->isLogged() AND !Tools::isSubmit('ajax'))
|
||||||
Tools::redirect('index.php?controller=my-account');
|
Tools::redirect('index.php?controller=my-account');
|
||||||
@@ -381,14 +381,9 @@ class AuthControllerCore extends FrontController
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
$this->processAddressFormat();
|
$this->processAddressFormat();
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'authentication.tpl');
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'authentication.tpl');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function processAddressFormat()
|
protected function processAddressFormat()
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -28,19 +28,21 @@
|
|||||||
class BestSalesControllerCore extends FrontController
|
class BestSalesControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'best-sales';
|
public $php_self = 'best-sales';
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
$this->productSort();
|
$this->productSort();
|
||||||
$nbProducts = (int)ProductSale::getNbSales();
|
$nbProducts = (int)ProductSale::getNbSales();
|
||||||
$this->pagination($nbProducts);
|
$this->pagination($nbProducts);
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'products' => ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay),
|
'products' => ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay),
|
||||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||||
'nbProducts' => $nbProducts,
|
'nbProducts' => $nbProducts,
|
||||||
'homeSize' => Image::getSize('home')
|
'homeSize' => Image::getSize('home')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'best-sales.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
@@ -48,11 +50,5 @@ class BestSalesControllerCore extends FrontController
|
|||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'best-sales.tpl');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -28,60 +28,47 @@
|
|||||||
class CartControllerCore extends FrontController
|
class CartControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'cart';
|
public $php_self = 'cart';
|
||||||
|
|
||||||
// This is not a public page, so the canonical redirection is disabled
|
// This is not a public page, so the canonical redirection is disabled
|
||||||
public function canonicalRedirection(){}
|
public function canonicalRedirection(){}
|
||||||
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$this->init();
|
|
||||||
$this->preProcess();
|
|
||||||
|
|
||||||
if (Tools::getValue('ajax') == 'true')
|
public function ajaxProcess()
|
||||||
|
{
|
||||||
|
if (Tools::getIsset('summary'))
|
||||||
{
|
{
|
||||||
if (Tools::getIsset('summary'))
|
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1)
|
||||||
{
|
{
|
||||||
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1)
|
if (Validate::isLoadedObject($this->context->customer))
|
||||||
{
|
$groups = $this->context->customer->getGroups();
|
||||||
if (Validate::isLoadedObject($this->context->customer))
|
else
|
||||||
$groups = $this->context->customer->getGroups();
|
$groups = array(1);
|
||||||
else
|
if ($this->context->cart->id_address_delivery)
|
||||||
$groups = array(1);
|
$deliveryAddress = new Address($this->context->cart->id_address_delivery);
|
||||||
if ($this->context->cart->id_address_delivery)
|
$result = array('carriers' => Carrier::getCarriersForOrder(Country::getIdZone((isset($deliveryAddress) AND (int)$deliveryAddress->id) ? (int)$deliveryAddress->id_country : (int)Configuration::get('PS_COUNTRY_DEFAULT')), $groups));
|
||||||
$deliveryAddress = new Address($this->context->cart->id_address_delivery);
|
|
||||||
$result = array('carriers' => Carrier::getCarriersForOrder(Country::getIdZone((isset($deliveryAddress) AND (int)$deliveryAddress->id) ? (int)$deliveryAddress->id_country : (int)Configuration::get('PS_COUNTRY_DEFAULT')), $groups));
|
|
||||||
}
|
|
||||||
$result['summary'] = $this->context->cart->getSummaryDetails();
|
|
||||||
$result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true);
|
|
||||||
$result['HOOK_SHOPPING_CART'] = Module::hookExec('shoppingCart', $result['summary']);
|
|
||||||
$result['HOOK_SHOPPING_CART_EXTRA'] = Module::hookExec('shoppingCartExtra', $result['summary']);
|
|
||||||
// Display reduced price (or not) without quantity discount
|
|
||||||
if (Tools::getIsset('getproductprice'))
|
|
||||||
foreach ($result['summary']['products'] as $key => $product)
|
|
||||||
$result['summary']['products'][$key]['price_without_quantity_discount'] = Product::getPriceStatic($product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute']);
|
|
||||||
die(Tools::jsonEncode($result));
|
|
||||||
}
|
}
|
||||||
else
|
$result['summary'] = $this->context->cart->getSummaryDetails();
|
||||||
$this->includeCartModule();
|
$result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true);
|
||||||
|
$result['HOOK_SHOPPING_CART'] = Module::hookExec('shoppingCart', $result['summary']);
|
||||||
|
$result['HOOK_SHOPPING_CART_EXTRA'] = Module::hookExec('shoppingCartExtra', $result['summary']);
|
||||||
|
// Display reduced price (or not) without quantity discount
|
||||||
|
if (Tools::getIsset('getproductprice'))
|
||||||
|
foreach ($result['summary']['products'] as $key => $product)
|
||||||
|
$result['summary']['products'][$key]['price_without_quantity_discount'] = Product::getPriceStatic($product['id_product'], !Product::getTaxCalculationMethod(), $product['id_product_attribute']);
|
||||||
|
die(Tools::jsonEncode($result));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
$this->includeCartModule();
|
||||||
$this->setMedia();
|
|
||||||
$this->displayHeader();
|
|
||||||
$this->process();
|
|
||||||
$this->displayContent();
|
|
||||||
$this->displayFooter();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includeCartModule()
|
public function includeCartModule()
|
||||||
{
|
{
|
||||||
require_once(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php');
|
require_once(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
parent::init();
|
||||||
|
|
||||||
$orderTotal = $this->context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS);
|
$orderTotal = $this->context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS);
|
||||||
$this->cartDiscounts = $this->context->cart->getDiscounts();
|
$this->cartDiscounts = $this->context->cart->getDiscounts();
|
||||||
foreach ($this->cartDiscounts AS $k => $this->cartDiscount)
|
foreach ($this->cartDiscounts AS $k => $this->cartDiscount)
|
||||||
@@ -165,7 +152,7 @@ class CartControllerCore extends FrontController
|
|||||||
die('{"hasError" : true, "errors" : ["'.Tools::displayError('Cannot add this product because current voucher does not allow additional discounts.').'"]}');
|
die('{"hasError" : true, "errors" : ["'.Tools::displayError('Cannot add this product because current voucher does not allow additional discounts.').'"]}');
|
||||||
else
|
else
|
||||||
$this->errors[] = Tools::displayError('Cannot add this product because current voucher does not allow additional discounts.');
|
$this->errors[] = Tools::displayError('Cannot add this product because current voucher does not allow additional discounts.');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!sizeof($this->errors))
|
if (!sizeof($this->errors))
|
||||||
@@ -254,11 +241,7 @@ class CartControllerCore extends FrontController
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function displayContent()
|
$this->setTemplate(_PS_THEME_DIR_.'errors.tpl');
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'errors.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,30 +48,17 @@ class CategoryControllerCore extends FrontController
|
|||||||
parent::displayHeader();
|
parent::displayHeader();
|
||||||
$this->productSort();
|
$this->productSort();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canonicalRedirection()
|
public function canonicalRedirection()
|
||||||
{
|
{
|
||||||
if (Configuration::get('PS_CANONICAL_REDIRECT') && !Tools::getValue('noredirect'))
|
if (!Tools::getValue('noredirect') && Validate::isLoadedObject($this->category))
|
||||||
{
|
parent::canonicalRedirection($this->context->link->getCategoryLink($this->category));
|
||||||
// Automatically redirect to the canonical URL if the current in is the right one
|
|
||||||
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
|
|
||||||
if (Validate::isLoadedObject($this->category))
|
|
||||||
{
|
|
||||||
$currentURL = $this->context->link->getCategoryLink($this->category);
|
|
||||||
$currentURL = preg_replace('/[?&].*$/', '', $currentURL);
|
|
||||||
if (!preg_match('/^'.Tools::pRegexp($currentURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 301 Moved');
|
|
||||||
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ )
|
|
||||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$currentURL.'">'.$currentURL.'</a>');
|
|
||||||
Tools::redirectLink($currentURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
if ($id_category = (int)Tools::getValue('id_category'))
|
if ($id_category = (int)Tools::getValue('id_category'))
|
||||||
$this->category = new Category($id_category, $this->context->language->id);
|
$this->category = new Category($id_category, $this->context->language->id);
|
||||||
if (!Validate::isLoadedObject($this->category))
|
if (!Validate::isLoadedObject($this->category))
|
||||||
@@ -81,8 +68,6 @@ class CategoryControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->canonicalRedirection();
|
$this->canonicalRedirection();
|
||||||
|
|
||||||
parent::preProcess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
@@ -105,7 +90,7 @@ class CategoryControllerCore extends FrontController
|
|||||||
/* Scenes (could be externalised to another controler if you need them */
|
/* Scenes (could be externalised to another controler if you need them */
|
||||||
$scenes = Scene::getScenes($this->category->id, $this->context->language->id, true, false);
|
$scenes = Scene::getScenes($this->category->id, $this->context->language->id, true, false);
|
||||||
$this->context->smarty->assign('scenes', $scenes);
|
$this->context->smarty->assign('scenes', $scenes);
|
||||||
|
|
||||||
/* Scenes images formats */
|
/* Scenes images formats */
|
||||||
if (sizeof($scenes))
|
if (sizeof($scenes))
|
||||||
{
|
{
|
||||||
@@ -125,8 +110,8 @@ class CategoryControllerCore extends FrontController
|
|||||||
|
|
||||||
$this->category->description = Tools::nl2br($this->category->description);
|
$this->category->description = Tools::nl2br($this->category->description);
|
||||||
$subCategories = $this->category->getSubCategories($this->context->language->id);
|
$subCategories = $this->category->getSubCategories($this->context->language->id);
|
||||||
$this->context->smarty->assign('category', $this->category);
|
$this->context->smarty->assign('category', $this->category);
|
||||||
|
|
||||||
if (isset($subCategories) AND !empty($subCategories) AND $subCategories)
|
if (isset($subCategories) AND !empty($subCategories) AND $subCategories)
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign('subcategories', $subCategories);
|
$this->context->smarty->assign('subcategories', $subCategories);
|
||||||
@@ -150,9 +135,9 @@ class CategoryControllerCore extends FrontController
|
|||||||
'thumbSceneSize' => Image::getSize('thumb_scene'),
|
'thumbSceneSize' => Image::getSize('thumb_scene'),
|
||||||
'homeSize' => Image::getSize('home')
|
'homeSize' => Image::getSize('home')
|
||||||
));
|
));
|
||||||
|
|
||||||
if (isset($this->context->customer->id))
|
if (isset($this->context->customer->id))
|
||||||
$this->context->smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts($this->context->customer->id));
|
$this->context->smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts($this->context->customer->id));
|
||||||
elseif (isset($this->context->customer->id_guest))
|
elseif (isset($this->context->customer->id_guest))
|
||||||
$this->context->smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts($this->context->customer->id_guest));
|
$this->context->smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts($this->context->customer->id_guest));
|
||||||
}
|
}
|
||||||
@@ -163,6 +148,8 @@ class CategoryControllerCore extends FrontController
|
|||||||
'comparator_max_item' => (int)(Configuration::get('PS_COMPARATOR_MAX_ITEM')),
|
'comparator_max_item' => (int)(Configuration::get('PS_COMPARATOR_MAX_ITEM')),
|
||||||
'suppliers' => Supplier::getSuppliers()
|
'suppliers' => Supplier::getSuppliers()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'category.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function productListAssign()
|
public function productListAssign()
|
||||||
@@ -180,11 +167,5 @@ class CategoryControllerCore extends FrontController
|
|||||||
$this->pagination((int)$this->nbProducts);
|
$this->pagination((int)$this->nbProducts);
|
||||||
self::$smarty->assign('nb_products', (int)$this->nbProducts);
|
self::$smarty->assign('nb_products', (int)$this->nbProducts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'category.tpl');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+1
-9
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -29,8 +29,6 @@ class ChangeCurrencyControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
$currency = new Currency((int)Tools::getValue('id_currency'));
|
$currency = new Currency((int)Tools::getValue('id_currency'));
|
||||||
if (Validate::isLoadedObject($currency) AND !$currency->deleted)
|
if (Validate::isLoadedObject($currency) AND !$currency->deleted)
|
||||||
{
|
{
|
||||||
@@ -39,10 +37,4 @@ class ChangeCurrencyControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
die('0');
|
die('0');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$this->init();
|
|
||||||
$this->process();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -31,43 +31,25 @@ class CmsControllerCore extends FrontController
|
|||||||
public $assignCase;
|
public $assignCase;
|
||||||
public $cms;
|
public $cms;
|
||||||
public $cms_category;
|
public $cms_category;
|
||||||
|
|
||||||
public function canonicalRedirection()
|
public function canonicalRedirection()
|
||||||
{
|
{
|
||||||
// Automatically redirect to the canonical URL if the current in is the right one
|
if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms)))
|
||||||
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
|
parent::canonicalRedirection($canonicalURL);
|
||||||
|
else if (Validate::isLoadedObject($this->cms_category) && ($canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category)))
|
||||||
if (Configuration::get('PS_CANONICAL_REDIRECT'))
|
parent::canonicalRedirection($canonicalURL);
|
||||||
{
|
|
||||||
if (Validate::isLoadedObject($this->cms) AND $canonicalURL = $this->context->link->getCMSLink($this->cms))
|
|
||||||
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 301 Moved');
|
|
||||||
if (_PS_MODE_DEV_)
|
|
||||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$canonicalURL.'">'.$canonicalURL.'</a>');
|
|
||||||
Tools::redirectLink($canonicalURL);
|
|
||||||
}
|
|
||||||
if (Validate::isLoadedObject($this->cms_category) AND $canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category))
|
|
||||||
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 301 Moved');
|
|
||||||
if (_PS_MODE_DEV_ )
|
|
||||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$canonicalURL.'">'.$canonicalURL.'</a>');
|
|
||||||
Tools::redirectLink($canonicalURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
if ($id_cms = (int)Tools::getValue('id_cms'))
|
if ($id_cms = (int)Tools::getValue('id_cms'))
|
||||||
$this->cms = new CMS($id_cms, $this->context->language->id);
|
$this->cms = new CMS($id_cms, $this->context->language->id);
|
||||||
elseif ($id_cms_category = (int)Tools::getValue('id_cms_category'))
|
elseif ($id_cms_category = (int)Tools::getValue('id_cms_category'))
|
||||||
$this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id);
|
$this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id);
|
||||||
$this->canonicalRedirection();
|
$this->canonicalRedirection();
|
||||||
|
|
||||||
parent::preProcess();
|
|
||||||
|
|
||||||
/* assignCase (1 = CMS page, 2 = CMS category) */
|
/* assignCase (1 = CMS page, 2 = CMS category) */
|
||||||
if (Validate::isLoadedObject($this->cms) AND ($this->cms->isAssociatedToShop() AND $this->cms->active OR (Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS'.$this->cms->id) AND file_exists(dirname(__FILE__).'/../'.Tools::getValue('ad').'/ajax.php'))))
|
if (Validate::isLoadedObject($this->cms) AND ($this->cms->isAssociatedToShop() AND $this->cms->active OR (Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS'.$this->cms->id) AND file_exists(dirname(__FILE__).'/../'.Tools::getValue('ad').'/ajax.php'))))
|
||||||
$this->assignCase = 1;
|
$this->assignCase = 1;
|
||||||
@@ -76,17 +58,17 @@ class CmsControllerCore extends FrontController
|
|||||||
else
|
else
|
||||||
Tools::redirect('index.php?controller=404');
|
Tools::redirect('index.php?controller=404');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
|
|
||||||
if ($this->assignCase == 1)
|
if ($this->assignCase == 1)
|
||||||
$this->addJS(_THEME_JS_DIR_.'cms.js');
|
$this->addJS(_THEME_JS_DIR_.'cms.js');
|
||||||
|
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'cms.css');
|
$this->addCSS(_THEME_CSS_DIR_.'cms.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
parent::process();
|
||||||
@@ -111,11 +93,7 @@ class CmsControllerCore extends FrontController
|
|||||||
'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '',
|
'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'cms.tpl');
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'cms.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,23 +28,23 @@
|
|||||||
class CompareControllerCore extends FrontController
|
class CompareControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'products-comparison';
|
public $php_self = 'products-comparison';
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'/comparator.css');
|
$this->addCSS(_THEME_CSS_DIR_.'/comparator.css');
|
||||||
|
|
||||||
if (Configuration::get('PS_COMPARATOR_MAX_ITEM') > 0)
|
if (Configuration::get('PS_COMPARATOR_MAX_ITEM') > 0)
|
||||||
$this->addJS(_THEME_JS_DIR_.'products-comparison.js');
|
$this->addJS(_THEME_JS_DIR_.'products-comparison.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
parent::init();
|
||||||
|
|
||||||
//Add or remove product with Ajax
|
//Add or remove product with Ajax
|
||||||
if (Tools::getValue('ajax') AND Tools::getValue('id_product') AND Tools::getValue('action'))
|
if (Tools::getValue('ajax') AND Tools::getValue('id_product') AND Tools::getValue('action'))
|
||||||
{
|
{
|
||||||
if (Tools::getValue('action') == 'add')
|
if (Tools::getValue('action') == 'add')
|
||||||
{
|
{
|
||||||
if (isset($this->context->customer->id))
|
if (isset($this->context->customer->id))
|
||||||
@@ -53,7 +53,7 @@ class CompareControllerCore extends FrontController
|
|||||||
CompareProduct::addCustomerCompareProduct((int)$this->context->customer->id, (int)Tools::getValue('id_product'));
|
CompareProduct::addCustomerCompareProduct((int)$this->context->customer->id, (int)Tools::getValue('id_product'));
|
||||||
else
|
else
|
||||||
die('0');
|
die('0');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((isset($this->context->customer->id_guest) AND CompareProduct::getGuestNumberProducts($this->context->customer->id_guest) < Configuration::get('PS_COMPARATOR_MAX_ITEM')))
|
if ((isset($this->context->customer->id_guest) AND CompareProduct::getGuestNumberProducts($this->context->customer->id_guest) < Configuration::get('PS_COMPARATOR_MAX_ITEM')))
|
||||||
@@ -65,7 +65,7 @@ class CompareControllerCore extends FrontController
|
|||||||
elseif (Tools::getValue('action') == 'remove')
|
elseif (Tools::getValue('action') == 'remove')
|
||||||
{
|
{
|
||||||
if (isset($this->context->customer->id))
|
if (isset($this->context->customer->id))
|
||||||
CompareProduct::removeCustomerCompareProduct((int)$this->context->customer->id, (int)Tools::getValue('id_product'));
|
CompareProduct::removeCustomerCompareProduct((int)$this->context->customer->id, (int)Tools::getValue('id_product'));
|
||||||
elseif (isset($this->context->customer->id_guest))
|
elseif (isset($this->context->customer->id_guest))
|
||||||
CompareProduct::removeGuestCompareProduct((int)$this->context->customer->id_guest, (int)Tools::getValue('id_product'));
|
CompareProduct::removeGuestCompareProduct((int)$this->context->customer->id_guest, (int)Tools::getValue('id_product'));
|
||||||
else
|
else
|
||||||
@@ -73,18 +73,16 @@ class CompareControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
die('0');
|
die('0');
|
||||||
|
|
||||||
die('1');
|
die('1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
//Clean compare product table
|
//Clean compare product table
|
||||||
CompareProduct::cleanCompareProducts('week');
|
CompareProduct::cleanCompareProducts('week');
|
||||||
|
|
||||||
$hasProduct = false;
|
$hasProduct = false;
|
||||||
|
|
||||||
if (!Configuration::get('PS_COMPARATOR_MAX_ITEM'))
|
if (!Configuration::get('PS_COMPARATOR_MAX_ITEM'))
|
||||||
@@ -161,12 +159,8 @@ class CompareControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->context->smarty->assign('hasProduct', $hasProduct);
|
$this->context->smarty->assign('hasProduct', $hasProduct);
|
||||||
}
|
|
||||||
|
|
||||||
public function displayContent()
|
$this->setTemplate(_PS_THEME_DIR_.'products-comparison.tpl');
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'products-comparison.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,16 +27,12 @@
|
|||||||
|
|
||||||
class ContactControllerCore extends FrontController
|
class ContactControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public function __construct()
|
public $php_self = 'contact';
|
||||||
{
|
public $ssl = true;
|
||||||
$this->php_self = 'contact';
|
|
||||||
$this->ssl = true;
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
parent::init();
|
||||||
|
|
||||||
if ($this->context->customer->isLogged())
|
if ($this->context->customer->isLogged())
|
||||||
{
|
{
|
||||||
@@ -105,7 +101,7 @@ class ContactControllerCore extends FrontController
|
|||||||
$id_customer_thread = (int)Tools::getValue('id_customer_thread')
|
$id_customer_thread = (int)Tools::getValue('id_customer_thread')
|
||||||
AND (int)Db::getInstance()->getValue('
|
AND (int)Db::getInstance()->getValue('
|
||||||
SELECT cm.id_customer_thread FROM '._DB_PREFIX_.'customer_thread cm
|
SELECT cm.id_customer_thread FROM '._DB_PREFIX_.'customer_thread cm
|
||||||
WHERE cm.id_customer_thread = '.(int)$id_customer_thread.' AND cm.id_shop = '.(int)$this->id_current_shop.' AND token = \''.pSQL(Tools::getValue('token')).'\'')
|
WHERE cm.id_customer_thread = '.(int)$id_customer_thread.' AND cm.id_shop = '.(int)$this->context->shop->getID(true).' AND token = \''.pSQL(Tools::getValue('token')).'\'')
|
||||||
) OR (
|
) OR (
|
||||||
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($from, (int)Tools::getValue('id_order'))
|
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($from, (int)Tools::getValue('id_order'))
|
||||||
)))
|
)))
|
||||||
@@ -113,7 +109,7 @@ class ContactControllerCore extends FrontController
|
|||||||
$fields = Db::getInstance()->ExecuteS('
|
$fields = Db::getInstance()->ExecuteS('
|
||||||
SELECT cm.id_customer_thread, cm.id_contact, cm.id_customer, cm.id_order, cm.id_product, cm.email
|
SELECT cm.id_customer_thread, cm.id_contact, cm.id_customer, cm.id_order, cm.id_product, cm.email
|
||||||
FROM '._DB_PREFIX_.'customer_thread cm
|
FROM '._DB_PREFIX_.'customer_thread cm
|
||||||
WHERE email = \''.pSQL($from).'\' AND cm.id_shop = '.(int)$this->id_current_shop.' AND ('.
|
WHERE email = \''.pSQL($from).'\' AND cm.id_shop = '.(int)$this->context->shop->getID(true).' AND ('.
|
||||||
($customer->id ? 'id_customer = '.(int)($customer->id).' OR ' : '').'
|
($customer->id ? 'id_customer = '.(int)($customer->id).' OR ' : '').'
|
||||||
id_order = '.(int)(Tools::getValue('id_order')).')');
|
id_order = '.(int)(Tools::getValue('id_order')).')');
|
||||||
$score = 0;
|
$score = 0;
|
||||||
@@ -140,7 +136,7 @@ class ContactControllerCore extends FrontController
|
|||||||
$old_message = Db::getInstance()->getValue('
|
$old_message = Db::getInstance()->getValue('
|
||||||
SELECT cm.message FROM '._DB_PREFIX_.'customer_message cm
|
SELECT cm.message FROM '._DB_PREFIX_.'customer_message cm
|
||||||
LEFT JOIN '._DB_PREFIX_.'customer_thread cc on (cm.id_customer_thread = cc.id_customer_thread)
|
LEFT JOIN '._DB_PREFIX_.'customer_thread cc on (cm.id_customer_thread = cc.id_customer_thread)
|
||||||
WHERE cc.id_customer_thread = '.(int)($id_customer_thread).' AND cc.id_shop = '.(int)$this->id_current_shop.'
|
WHERE cc.id_customer_thread = '.(int)($id_customer_thread).' AND cc.id_shop = '.(int)$this->context->shop->getID(true).'
|
||||||
ORDER BY cm.date_add DESC');
|
ORDER BY cm.date_add DESC');
|
||||||
if ($old_message == htmlentities($message, ENT_COMPAT, 'UTF-8'))
|
if ($old_message == htmlentities($message, ENT_COMPAT, 'UTF-8'))
|
||||||
{
|
{
|
||||||
@@ -176,7 +172,7 @@ class ContactControllerCore extends FrontController
|
|||||||
$ct = new CustomerThread();
|
$ct = new CustomerThread();
|
||||||
if (isset($customer->id))
|
if (isset($customer->id))
|
||||||
$ct->id_customer = (int)($customer->id);
|
$ct->id_customer = (int)($customer->id);
|
||||||
$ct->id_shop = (int)$this->id_current_shop;
|
$ct->id_shop = (int)$this->context->shop->getID(true);
|
||||||
if ($id_order = (int)Tools::getValue('id_order'))
|
if ($id_order = (int)Tools::getValue('id_order'))
|
||||||
$ct->id_order = $id_order;
|
$ct->id_order = $id_order;
|
||||||
if ($id_product = (int)Tools::getValue('id_product'))
|
if ($id_product = (int)Tools::getValue('id_product'))
|
||||||
@@ -224,8 +220,6 @@ class ContactControllerCore extends FrontController
|
|||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
$email = Tools::safeOutput(Tools::getValue('from', ((isset($this->context->cookie) AND isset($this->context->cookie->email) AND Validate::isEmail($this->context->cookie->email)) ? $this->context->cookie->email : '')));
|
$email = Tools::safeOutput(Tools::getValue('from', ((isset($this->context->cookie) AND isset($this->context->cookie->email) AND Validate::isEmail($this->context->cookie->email)) ? $this->context->cookie->email : '')));
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'errors' => $this->errors,
|
'errors' => $this->errors,
|
||||||
@@ -238,19 +232,17 @@ class ContactControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
$customerThread = Db::getInstance()->getRow('
|
$customerThread = Db::getInstance()->getRow('
|
||||||
SELECT cm.* FROM '._DB_PREFIX_.'customer_thread cm
|
SELECT cm.* FROM '._DB_PREFIX_.'customer_thread cm
|
||||||
WHERE cm.id_customer_thread = '.(int)$id_customer_thread.' AND cm.id_shop = '.(int)$this->id_current_shop.' AND token = \''.pSQL($token).'\'');
|
WHERE cm.id_customer_thread = '.(int)$id_customer_thread.' AND cm.id_shop = '.(int)$this->context->shop->getID(true).' AND token = \''.pSQL($token).'\'');
|
||||||
$this->context->smarty->assign('customerThread', $customerThread);
|
$this->context->smarty->assign('customerThread', $customerThread);
|
||||||
}
|
}
|
||||||
$this->context->smarty->assign(array('contacts' => Contact::getContacts($this->context->language->id),
|
$this->context->smarty->assign(array('contacts' => Contact::getContacts($this->context->language->id),
|
||||||
'message' => html_entity_decode(Tools::getValue('message'))
|
'message' => html_entity_decode(Tools::getValue('message'))
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
|
||||||
public function displayContent()
|
// @todo I don't know who did this code, but it's not me
|
||||||
{
|
|
||||||
$_POST = array_merge($_POST, $_GET);
|
|
||||||
parent::displayContent();
|
$this->setTemplate(_PS_THEME_DIR_.'contact-form.tpl');
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'contact-form.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,9 @@ class DiscountControllerCore extends FrontController
|
|||||||
public $php_self = 'discount';
|
public $php_self = 'discount';
|
||||||
public $authRedirection = 'discount';
|
public $authRedirection = 'discount';
|
||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
$discounts = Discount::getCustomerDiscounts($this->context->language->id, $this->context->customer->id, true, false);
|
$discounts = Discount::getCustomerDiscounts($this->context->language->id, $this->context->customer->id, true, false);
|
||||||
$nbDiscounts = 0;
|
$nbDiscounts = 0;
|
||||||
foreach ($discounts AS $discount)
|
foreach ($discounts AS $discount)
|
||||||
@@ -43,12 +41,7 @@ class DiscountControllerCore extends FrontController
|
|||||||
$nbDiscounts++;
|
$nbDiscounts++;
|
||||||
|
|
||||||
$this->context->smarty->assign(array('nbDiscounts' => (int)($nbDiscounts), 'discount' => $discounts));
|
$this->context->smarty->assign(array('nbDiscounts' => (int)($nbDiscounts), 'discount' => $discounts));
|
||||||
}
|
$this->setTemplate(_PS_THEME_DIR_.'discount.tpl');
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'discount.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -27,15 +27,11 @@
|
|||||||
|
|
||||||
class GetFileControllerCore extends FrontController
|
class GetFileControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$this->init();
|
|
||||||
$this->preProcess();
|
|
||||||
$this->process();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
|
$this->displayHeader(false);
|
||||||
|
$this->displayFooter(false);
|
||||||
|
|
||||||
if (isset($this->context->employee) && $this->context->employee->isLoggedBack() AND Tools::getValue('file'))
|
if (isset($this->context->employee) && $this->context->employee->isLoggedBack() AND Tools::getValue('file'))
|
||||||
{
|
{
|
||||||
/* Admin can directly access to file */
|
/* Admin can directly access to file */
|
||||||
@@ -52,7 +48,7 @@ class GetFileControllerCore extends FrontController
|
|||||||
else
|
else
|
||||||
$filename = 'file';
|
$filename = 'file';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($file))
|
if (!file_exists($file))
|
||||||
Tools::redirect('index.php');
|
Tools::redirect('index.php');
|
||||||
}
|
}
|
||||||
@@ -60,7 +56,7 @@ class GetFileControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
if (!($key = Tools::getValue('key')))
|
if (!($key = Tools::getValue('key')))
|
||||||
$this->displayCustomError('Invalid key.');
|
$this->displayCustomError('Invalid key.');
|
||||||
|
|
||||||
Tools::setCookieLanguage();
|
Tools::setCookieLanguage();
|
||||||
if (!$this->context->customer->isLogged() AND !Tools::getValue('secure_key') AND !Tools::getValue('id_order'))
|
if (!$this->context->customer->isLogged() AND !Tools::getValue('secure_key') AND !Tools::getValue('id_order'))
|
||||||
Tools::redirect('index.php?controller=authentication&back=get-file.php&key='.$key);
|
Tools::redirect('index.php?controller=authentication&back=get-file.php&key='.$key);
|
||||||
@@ -72,45 +68,45 @@ class GetFileControllerCore extends FrontController
|
|||||||
if ($order->secure_key != Tools::getValue('secure_key'))
|
if ($order->secure_key != Tools::getValue('secure_key'))
|
||||||
$this->displayCustomError('Invalid key.');
|
$this->displayCustomError('Invalid key.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Key format: <sha1-filename>-<hashOrder> */
|
/* Key format: <sha1-filename>-<hashOrder> */
|
||||||
$tmp = explode('-', $key);
|
$tmp = explode('-', $key);
|
||||||
if (sizeof($tmp) != 2)
|
if (sizeof($tmp) != 2)
|
||||||
$this->displayCustomError('Invalid key.');
|
$this->displayCustomError('Invalid key.');
|
||||||
|
|
||||||
$filename = $tmp[0];
|
$filename = $tmp[0];
|
||||||
$hash = $tmp[1];
|
$hash = $tmp[1];
|
||||||
|
|
||||||
if (!($info = OrderDetail::getDownloadFromHash($hash)))
|
if (!($info = OrderDetail::getDownloadFromHash($hash)))
|
||||||
$this->displayCustomError('This product does not exist in our store.');
|
$this->displayCustomError('This product does not exist in our store.');
|
||||||
|
|
||||||
/* Product no more present in catalog */
|
/* Product no more present in catalog */
|
||||||
if (!isset($info['id_product_download']) OR empty($info['id_product_download']))
|
if (!isset($info['id_product_download']) OR empty($info['id_product_download']))
|
||||||
$this->displayCustomError('This product has been deleted.');
|
$this->displayCustomError('This product has been deleted.');
|
||||||
|
|
||||||
if (!file_exists(_PS_DOWNLOAD_DIR_.$filename))
|
if (!file_exists(_PS_DOWNLOAD_DIR_.$filename))
|
||||||
$this->displayCustomError('This file no longer exists.');
|
$this->displayCustomError('This file no longer exists.');
|
||||||
|
|
||||||
$now = time();
|
$now = time();
|
||||||
|
|
||||||
$product_deadline = strtotime($info['download_deadline']);
|
$product_deadline = strtotime($info['download_deadline']);
|
||||||
if ($now > $product_deadline AND $info['download_deadline'] != '0000-00-00 00:00:00')
|
if ($now > $product_deadline AND $info['download_deadline'] != '0000-00-00 00:00:00')
|
||||||
$this->displayCustomError('The product deadline is in the past.');
|
$this->displayCustomError('The product deadline is in the past.');
|
||||||
|
|
||||||
$customer_deadline = strtotime($info['date_expiration']);
|
$customer_deadline = strtotime($info['date_expiration']);
|
||||||
if ($now > $customer_deadline AND $info['date_expiration'] != '0000-00-00 00:00:00')
|
if ($now > $customer_deadline AND $info['date_expiration'] != '0000-00-00 00:00:00')
|
||||||
$this->displayCustomError('Expiration date exceeded');
|
$this->displayCustomError('Expiration date exceeded');
|
||||||
|
|
||||||
if ($info['download_nb'] >= $info['nb_downloadable'] AND $info['nb_downloadable'])
|
if ($info['download_nb'] >= $info['nb_downloadable'] AND $info['nb_downloadable'])
|
||||||
$this->displayCustomError('You have reached the maximum number of allowed downloads.');
|
$this->displayCustomError('You have reached the maximum number of allowed downloads.');
|
||||||
|
|
||||||
/* Access is authorized -> increment download value for the customer */
|
/* Access is authorized -> increment download value for the customer */
|
||||||
OrderDetail::incrementDownload($info['id_order_detail']);
|
OrderDetail::incrementDownload($info['id_order_detail']);
|
||||||
|
|
||||||
$file = _PS_DOWNLOAD_DIR_.$info['physically_filename'];
|
$file = _PS_DOWNLOAD_DIR_.$info['physically_filename'];
|
||||||
$filename = $info['display_filename'];
|
$filename = $info['display_filename'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Detect mime content type */
|
/* Detect mime content type */
|
||||||
$mimeType = false;
|
$mimeType = false;
|
||||||
if (function_exists('finfo_open'))
|
if (function_exists('finfo_open'))
|
||||||
@@ -122,20 +118,20 @@ class GetFileControllerCore extends FrontController
|
|||||||
elseif (function_exists('mime_content_type'))
|
elseif (function_exists('mime_content_type'))
|
||||||
$mimeType = @mime_content_type($file);
|
$mimeType = @mime_content_type($file);
|
||||||
elseif (function_exists('exec'))
|
elseif (function_exists('exec'))
|
||||||
{
|
{
|
||||||
$mimeType = trim(@exec('file -b --mime-type '.escapeshellarg($file)));
|
$mimeType = trim(@exec('file -b --mime-type '.escapeshellarg($file)));
|
||||||
if (!$mimeType)
|
if (!$mimeType)
|
||||||
$mimeType = trim(@exec('file --mime '.escapeshellarg($file)));
|
$mimeType = trim(@exec('file --mime '.escapeshellarg($file)));
|
||||||
if (!$mimeType)
|
if (!$mimeType)
|
||||||
$mimeType = trim(@exec('file -bi '.escapeshellarg($file)));
|
$mimeType = trim(@exec('file -bi '.escapeshellarg($file)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($mimeType))
|
if (empty($mimeType))
|
||||||
{
|
{
|
||||||
$bName = basename($filename);
|
$bName = basename($filename);
|
||||||
$bName = explode('.', $bName);
|
$bName = explode('.', $bName);
|
||||||
$bName = strtolower($bName[count($bName) - 1]);
|
$bName = strtolower($bName[count($bName) - 1]);
|
||||||
|
|
||||||
$mimeTypes = array(
|
$mimeTypes = array(
|
||||||
'ez' => 'application/andrew-inset',
|
'ez' => 'application/andrew-inset',
|
||||||
'hqx' => 'application/mac-binhex40',
|
'hqx' => 'application/mac-binhex40',
|
||||||
@@ -264,14 +260,14 @@ class GetFileControllerCore extends FrontController
|
|||||||
'avi' => 'video/x-msvideo',
|
'avi' => 'video/x-msvideo',
|
||||||
'movie' => 'video/x-sgi-movie',
|
'movie' => 'video/x-sgi-movie',
|
||||||
'ice' => 'x-conference-xcooltalk');
|
'ice' => 'x-conference-xcooltalk');
|
||||||
|
|
||||||
if (isset($mimeTypes[$bName]))
|
if (isset($mimeTypes[$bName]))
|
||||||
$mimeType = $mimeTypes[$bName];
|
$mimeType = $mimeTypes[$bName];
|
||||||
else
|
else
|
||||||
$mimeType = 'application/octet-stream';
|
$mimeType = 'application/octet-stream';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Set headers for download */
|
/* Set headers for download */
|
||||||
header('Content-Transfer-Encoding: binary');
|
header('Content-Transfer-Encoding: binary');
|
||||||
header('Content-Type: '.$mimeType);
|
header('Content-Type: '.$mimeType);
|
||||||
@@ -281,10 +277,10 @@ class GetFileControllerCore extends FrontController
|
|||||||
$fp = fopen($file, 'rb');
|
$fp = fopen($file, 'rb');
|
||||||
while (!feof($fp))
|
while (!feof($fp))
|
||||||
echo fgets($fp, 16384);
|
echo fgets($fp, 16384);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function displayCustomError($msg)
|
protected function displayCustomError($msg)
|
||||||
{
|
{
|
||||||
$translations = array(
|
$translations = array(
|
||||||
+17
-26
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -28,21 +28,17 @@
|
|||||||
class GuestTrackingControllerCore extends FrontController
|
class GuestTrackingControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'guest-tracking';
|
public $php_self = 'guest-tracking';
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
parent::init();
|
||||||
|
|
||||||
if ($this->context->customer->isLogged())
|
if ($this->context->customer->isLogged())
|
||||||
Tools::redirect('index.php?controller=history');
|
Tools::redirect('index.php?controller=history');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
global $link;
|
|
||||||
|
|
||||||
parent::process();
|
|
||||||
|
|
||||||
if ($id_order = Tools::getValue('id_order') AND $email = Tools::getValue('email'))
|
if ($id_order = Tools::getValue('id_order') AND $email = Tools::getValue('email'))
|
||||||
{
|
{
|
||||||
$order = new Order((int)$id_order);
|
$order = new Order((int)$id_order);
|
||||||
@@ -59,17 +55,17 @@ class GuestTrackingControllerCore extends FrontController
|
|||||||
$addressDelivery = new Address((int)($order->id_address_delivery));
|
$addressDelivery = new Address((int)($order->id_address_delivery));
|
||||||
$inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
|
$inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
|
||||||
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
|
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
|
||||||
|
|
||||||
$invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
|
$invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
|
||||||
$deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
|
$deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
|
||||||
|
|
||||||
if ($order->total_discounts > 0)
|
if ($order->total_discounts > 0)
|
||||||
$this->context->smarty->assign('total_old', (float)($order->total_paid - $order->total_discounts));
|
$this->context->smarty->assign('total_old', (float)($order->total_paid - $order->total_discounts));
|
||||||
$products = $order->getProducts();
|
$products = $order->getProducts();
|
||||||
$customizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart));
|
$customizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart));
|
||||||
Product::addCustomizationPrice($products, $customizedDatas);
|
Product::addCustomizationPrice($products, $customizedDatas);
|
||||||
|
|
||||||
$this->processAddressFormat($addressDelivery, $addressInvoice);
|
$this->processAddressFormat($addressDelivery, $addressInvoice);
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'shop_name' => Configuration::get('PS_SHOP_NAME'),
|
'shop_name' => Configuration::get('PS_SHOP_NAME'),
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
@@ -98,7 +94,7 @@ class GuestTrackingControllerCore extends FrontController
|
|||||||
$this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
|
$this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
|
||||||
$this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
|
$this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
|
||||||
Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
|
Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
|
||||||
|
|
||||||
if (Tools::isSubmit('submitTransformGuestToCustomer'))
|
if (Tools::isSubmit('submitTransformGuestToCustomer'))
|
||||||
{
|
{
|
||||||
$customer = new Customer((int)$order->id_customer);
|
$customer = new Customer((int)$order->id_customer);
|
||||||
@@ -116,27 +112,22 @@ class GuestTrackingControllerCore extends FrontController
|
|||||||
/* Handle brute force attacks */
|
/* Handle brute force attacks */
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'action' => $link->getPageLink('guest-tracking.php'),
|
'action' => $this->context->link->getPageLink('guest-tracking.php'),
|
||||||
'errors' => $this->errors
|
'errors' => $this->errors
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'guest-tracking.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
|
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'history.css');
|
$this->addCSS(_THEME_CSS_DIR_.'history.css');
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'guest-tracking.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
private function processAddressFormat(Address $delivery, Address $invoice)
|
private function processAddressFormat(Address $delivery, Address $invoice)
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -31,22 +31,20 @@ class HistoryControllerCore extends FrontController
|
|||||||
public $php_self = 'history';
|
public $php_self = 'history';
|
||||||
public $authRedirection = 'history';
|
public $authRedirection = 'history';
|
||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'history.css');
|
$this->addCSS(_THEME_CSS_DIR_.'history.css');
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
||||||
$this->addJS(array(
|
$this->addJS(array(
|
||||||
_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js',
|
_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js',
|
||||||
_THEME_JS_DIR_.'history.js',
|
_THEME_JS_DIR_.'history.js',
|
||||||
_THEME_JS_DIR_.'tools.js'));
|
_THEME_JS_DIR_.'tools.js'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
if ($orders = Order::getCustomerOrders($this->context->customer->id))
|
if ($orders = Order::getCustomerOrders($this->context->customer->id))
|
||||||
foreach ($orders AS &$order)
|
foreach ($orders AS &$order)
|
||||||
{
|
{
|
||||||
@@ -59,12 +57,8 @@ class HistoryControllerCore extends FrontController
|
|||||||
'invoiceAllowed' => (int)(Configuration::get('PS_INVOICE')),
|
'invoiceAllowed' => (int)(Configuration::get('PS_INVOICE')),
|
||||||
'slowValidation' => Tools::isSubmit('slowvalidation')
|
'slowValidation' => Tools::isSubmit('slowvalidation')
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'history.tpl');
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'history.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,10 +32,8 @@ class IdentityControllerCore extends FrontController
|
|||||||
public $authRedirection = 'identity';
|
public $authRedirection = 'identity';
|
||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
|
|
||||||
public function preProcess()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
|
||||||
|
|
||||||
$customer = $this->context->customer;
|
$customer = $this->context->customer;
|
||||||
|
|
||||||
if (sizeof($_POST))
|
if (sizeof($_POST))
|
||||||
@@ -107,6 +105,8 @@ class IdentityControllerCore extends FrontController
|
|||||||
));
|
));
|
||||||
|
|
||||||
$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
|
$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'identity.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
@@ -115,11 +115,4 @@ class IdentityControllerCore extends FrontController
|
|||||||
$this->addCSS(_THEME_CSS_DIR_.'identity.css');
|
$this->addCSS(_THEME_CSS_DIR_.'identity.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'identity.tpl');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -27,22 +27,11 @@
|
|||||||
|
|
||||||
class IndexControllerCore extends FrontController
|
class IndexControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public function __construct()
|
public $php_self = 'index';
|
||||||
{
|
|
||||||
$this->php_self = 'index';
|
|
||||||
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
$this->context->smarty->assign('HOOK_HOME', Module::hookExec('home'));
|
$this->context->smarty->assign('HOOK_HOME', Module::hookExec('home'));
|
||||||
}
|
$this->setTemplate(_PS_THEME_DIR_.'index.tpl');
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'index.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+15
-30
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -29,30 +29,23 @@ class ManufacturerControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
public $php_self = 'manufacturer';
|
public $php_self = 'manufacturer';
|
||||||
protected $manufacturer;
|
protected $manufacturer;
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canonicalRedirection()
|
public function canonicalRedirection()
|
||||||
{
|
{
|
||||||
if (Validate::isLoadedObject($this->manufacturer))
|
if (Validate::isLoadedObject($this->manufacturer))
|
||||||
{
|
parent::canonicalRedirection($this->context->link->getManufacturerLink($this->manufacturer));
|
||||||
$canonicalURL = $this->context->link->getManufacturerLink($this->manufacturer);
|
|
||||||
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 301 Moved');
|
|
||||||
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_)
|
|
||||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$canonicalURL.'">'.$canonicalURL.'</a>');
|
|
||||||
Tools::redirectLink($canonicalURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
if ($id_manufacturer = Tools::getValue('id_manufacturer'))
|
if ($id_manufacturer = Tools::getValue('id_manufacturer'))
|
||||||
{
|
{
|
||||||
$this->manufacturer = new Manufacturer((int)$id_manufacturer, $this->context->language->id);
|
$this->manufacturer = new Manufacturer((int)$id_manufacturer, $this->context->language->id);
|
||||||
@@ -65,10 +58,8 @@ class ManufacturerControllerCore extends FrontController
|
|||||||
else
|
else
|
||||||
$this->canonicalRedirection();
|
$this->canonicalRedirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::preProcess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
if (Validate::isLoadedObject($this->manufacturer) AND $this->manufacturer->active AND $this->manufacturer->isAssociatedToGroupShop())
|
if (Validate::isLoadedObject($this->manufacturer) AND $this->manufacturer->active AND $this->manufacturer->isAssociatedToGroupShop())
|
||||||
@@ -80,6 +71,8 @@ class ManufacturerControllerCore extends FrontController
|
|||||||
'products' => $this->manufacturer->getProducts($this->manufacturer->id, $this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay),
|
'products' => $this->manufacturer->getProducts($this->manufacturer->id, $this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay),
|
||||||
'path' => ($this->manufacturer->active ? Tools::safeOutput($this->manufacturer->name) : ''),
|
'path' => ($this->manufacturer->active ? Tools::safeOutput($this->manufacturer->name) : ''),
|
||||||
'manufacturer' => $this->manufacturer));
|
'manufacturer' => $this->manufacturer));
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'manufacturer.tpl');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -89,7 +82,7 @@ class ManufacturerControllerCore extends FrontController
|
|||||||
$data = Manufacturer::getManufacturers(true, $this->context->language->id, true, false, false, false, $id_current_group_shop);
|
$data = Manufacturer::getManufacturers(true, $this->context->language->id, true, false, false, false, $id_current_group_shop);
|
||||||
$nbProducts = count($data);
|
$nbProducts = count($data);
|
||||||
$this->pagination($nbProducts);
|
$this->pagination($nbProducts);
|
||||||
|
|
||||||
$manufacturers = Manufacturer::getManufacturers(true, $this->context->language->id, true, $this->p, $this->n, false, $id_current_group_shop);
|
$manufacturers = Manufacturer::getManufacturers(true, $this->context->language->id, true, $this->p, $this->n, false, $id_current_group_shop);
|
||||||
$imgDir = _PS_MANU_IMG_DIR_;
|
$imgDir = _PS_MANU_IMG_DIR_;
|
||||||
foreach ($data AS &$item)
|
foreach ($data AS &$item)
|
||||||
@@ -105,22 +98,14 @@ class ManufacturerControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->context->smarty->assign('nbManufacturers', 0);
|
$this->context->smarty->assign('nbManufacturers', 0);
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'manufacturer-list.tpl');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayHeader()
|
public function displayHeader()
|
||||||
{
|
{
|
||||||
parent::displayHeader();
|
parent::displayHeader();
|
||||||
$this->productSort();
|
$this->productSort();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
if ($this->manufacturer)
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'manufacturer.tpl');
|
|
||||||
else
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'manufacturer-list.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -31,28 +31,22 @@ class MyAccountControllerCore extends FrontController
|
|||||||
public $php_self = 'my-account';
|
public $php_self = 'my-account';
|
||||||
public $authRedirection = 'my-account';
|
public $authRedirection = 'my-account';
|
||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'my-account.css');
|
$this->addCSS(_THEME_CSS_DIR_.'my-account.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')),
|
'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')),
|
||||||
'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN'))
|
'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN'))
|
||||||
));
|
));
|
||||||
$this->context->smarty->assign('HOOK_CUSTOMER_ACCOUNT', Module::hookExec('customerAccount'));
|
$this->context->smarty->assign('HOOK_CUSTOMER_ACCOUNT', Module::hookExec('customerAccount'));
|
||||||
}
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'my-account.tpl');
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'my-account.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+7
-13
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -28,34 +28,28 @@
|
|||||||
class NewProductsControllerCore extends FrontController
|
class NewProductsControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'new-products';
|
public $php_self = 'new-products';
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
$this->productSort();
|
$this->productSort();
|
||||||
|
|
||||||
$nbProducts = (int)Product::getNewProducts($this->context->language->id, (isset($this->p) ? (int)($this->p) - 1 : NULL), (isset($this->n) ? (int)($this->n) : NULL), true);
|
$nbProducts = (int)Product::getNewProducts($this->context->language->id, (isset($this->p) ? (int)($this->p) - 1 : NULL), (isset($this->n) ? (int)($this->n) : NULL), true);
|
||||||
$this->pagination($nbProducts);
|
$this->pagination($nbProducts);
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'products' => Product::getNewProducts($this->context->language->id, (int)($this->p) - 1, (int)($this->n), false, $this->orderBy, $this->orderWay),
|
'products' => Product::getNewProducts($this->context->language->id, (int)($this->p) - 1, (int)($this->n), false, $this->orderBy, $this->orderWay),
|
||||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||||
'nbProducts' => (int)($nbProducts),
|
'nbProducts' => (int)($nbProducts),
|
||||||
'homeSize' => Image::getSize('home')
|
'homeSize' => Image::getSize('home')
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'new-products.tpl');
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'new-products.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+12
-17
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -28,24 +28,24 @@
|
|||||||
class OrderConfirmationControllerCore extends FrontController
|
class OrderConfirmationControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'order-confirmation';
|
public $php_self = 'order-confirmation';
|
||||||
|
|
||||||
public $id_cart;
|
public $id_cart;
|
||||||
public $id_module;
|
public $id_module;
|
||||||
public $id_order;
|
public $id_order;
|
||||||
public $secure_key;
|
public $secure_key;
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
parent::init();
|
||||||
|
|
||||||
$this->id_cart = (int)(Tools::getValue('id_cart', 0));
|
$this->id_cart = (int)(Tools::getValue('id_cart', 0));
|
||||||
|
|
||||||
/* check if the cart has been made by a Guest customer, for redirect link */
|
/* check if the cart has been made by a Guest customer, for redirect link */
|
||||||
if (Cart::isGuestCartByCartId($this->id_cart))
|
if (Cart::isGuestCartByCartId($this->id_cart))
|
||||||
$redirectLink = 'index.php?controller=guest-tracking';
|
$redirectLink = 'index.php?controller=guest-tracking';
|
||||||
else
|
else
|
||||||
$redirectLink = 'index.php?controller=history';
|
$redirectLink = 'index.php?controller=history';
|
||||||
|
|
||||||
$this->id_module = (int)(Tools::getValue('id_module', 0));
|
$this->id_module = (int)(Tools::getValue('id_module', 0));
|
||||||
$this->id_order = Order::getOrderByCartId((int)($this->id_cart));
|
$this->id_order = Order::getOrderByCartId((int)($this->id_cart));
|
||||||
$this->secure_key = Tools::getValue('key', false);
|
$this->secure_key = Tools::getValue('key', false);
|
||||||
@@ -59,16 +59,15 @@ class OrderConfirmationControllerCore extends FrontController
|
|||||||
if ($order->payment != $module->displayName)
|
if ($order->payment != $module->displayName)
|
||||||
Tools::redirect($redirectLink);
|
Tools::redirect($redirectLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'is_guest' => $this->context->customer->is_guest,
|
'is_guest' => $this->context->customer->is_guest,
|
||||||
'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation((int)($this->id_order)),
|
'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation((int)($this->id_order)),
|
||||||
'HOOK_PAYMENT_RETURN' => Hook::paymentReturn((int)($this->id_order), (int)($this->id_module))
|
'HOOK_PAYMENT_RETURN' => Hook::paymentReturn((int)($this->id_order), (int)($this->id_module))
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($this->context->customer->is_guest)
|
if ($this->context->customer->is_guest)
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
@@ -78,12 +77,8 @@ class OrderConfirmationControllerCore extends FrontController
|
|||||||
/* If guest we clear the cookie for security reason */
|
/* If guest we clear the cookie for security reason */
|
||||||
$this->context->customer->mylogout();
|
$this->context->customer->mylogout();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl');
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'order-confirmation.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,18 +31,13 @@ class OrderControllerCore extends ParentOrderController
|
|||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
global $isVirtualCart, $orderTotal;
|
||||||
|
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
$this->step = (int)(Tools::getValue('step'));
|
$this->step = (int)(Tools::getValue('step'));
|
||||||
if (!$this->nbProducts)
|
if (!$this->nbProducts)
|
||||||
$this->step = -1;
|
$this->step = -1;
|
||||||
}
|
|
||||||
|
|
||||||
public function preProcess()
|
|
||||||
{
|
|
||||||
global $isVirtualCart, $orderTotal;
|
|
||||||
|
|
||||||
parent::preProcess();
|
|
||||||
|
|
||||||
/* If some products have disappear */
|
/* If some products have disappear */
|
||||||
if (!$this->context->cart->checkQuantities())
|
if (!$this->context->cart->checkQuantities())
|
||||||
@@ -78,23 +73,28 @@ class OrderControllerCore extends ParentOrderController
|
|||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
/* 4 steps to the order */
|
/* 4 steps to the order */
|
||||||
switch ((int)$this->step)
|
switch ((int)$this->step)
|
||||||
{
|
{
|
||||||
case -1;
|
case -1;
|
||||||
$this->context->smarty->assign('empty', 1);
|
$this->context->smarty->assign('empty', 1);
|
||||||
break;
|
$this->setTemplate(_PS_THEME_DIR_.'shopping-cart.tpl');
|
||||||
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
$this->_assignAddress();
|
$this->_assignAddress();
|
||||||
break;
|
$this->processAddressFormat();
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'order-address.tpl');
|
||||||
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if(Tools::isSubmit('processAddress'))
|
if(Tools::isSubmit('processAddress'))
|
||||||
$this->processAddress();
|
$this->processAddress();
|
||||||
$this->autoStep();
|
$this->autoStep();
|
||||||
$this->_assignCarrier();
|
$this->_assignCarrier();
|
||||||
break;
|
$this->setTemplate(_PS_THEME_DIR_.'order-carrier.tpl');
|
||||||
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
//Test that the conditions (so active) were accepted by the customer
|
//Test that the conditions (so active) were accepted by the customer
|
||||||
$cgv = Tools::getValue('cgv');
|
$cgv = Tools::getValue('cgv');
|
||||||
@@ -119,11 +119,21 @@ class OrderControllerCore extends ParentOrderController
|
|||||||
$this->_assignPayment();
|
$this->_assignPayment();
|
||||||
// assign some informations to display cart
|
// assign some informations to display cart
|
||||||
$this->_assignSummaryInformations();
|
$this->_assignSummaryInformations();
|
||||||
break;
|
$this->setTemplate(_PS_THEME_DIR_.'order-payment.tpl');
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$this->_assignSummaryInformations();
|
$this->_assignSummaryInformations();
|
||||||
break;
|
$this->setTemplate(_PS_THEME_DIR_.'shopping-cart.tpl');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->context->smarty->assign(array(
|
||||||
|
'currencySign' => $this->context->currency->sign,
|
||||||
|
'currencyRate' => $this->context->currency->conversion_rate,
|
||||||
|
'currencyFormat' => $this->context->currency->format,
|
||||||
|
'currencyBlank' => $this->context->currency->blank,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function processAddressFormat()
|
private function processAddressFormat()
|
||||||
@@ -139,38 +149,6 @@ class OrderControllerCore extends ParentOrderController
|
|||||||
'dlv_adr_fields' => $deliveryAddressFields));
|
'dlv_adr_fields' => $deliveryAddressFields));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
|
||||||
'currencySign' => $this->context->currency->sign,
|
|
||||||
'currencyRate' => $this->context->currency->conversion_rate,
|
|
||||||
'currencyFormat' => $this->context->currency->format,
|
|
||||||
'currencyBlank' => $this->context->currency->blank,
|
|
||||||
));
|
|
||||||
|
|
||||||
switch ((int)$this->step)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'shopping-cart.tpl');
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
$this->processAddressFormat();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'order-address.tpl');
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'order-carrier.tpl');
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'order-payment.tpl');
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'shopping-cart.tpl');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function displayFooter()
|
public function displayFooter()
|
||||||
{
|
{
|
||||||
if (!Tools::getValue('ajax'))
|
if (!Tools::getValue('ajax'))
|
||||||
+7
-11
@@ -30,7 +30,7 @@ class OrderDetailControllerCore extends FrontController
|
|||||||
public $auth = true;
|
public $auth = true;
|
||||||
public $authRedirection = 'history';
|
public $authRedirection = 'history';
|
||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -39,9 +39,9 @@ class OrderDetailControllerCore extends FrontController
|
|||||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
parent::init();
|
||||||
|
|
||||||
if (Tools::isSubmit('submitMessage'))
|
if (Tools::isSubmit('submitMessage'))
|
||||||
{
|
{
|
||||||
@@ -61,7 +61,7 @@ class OrderDetailControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
//check if a thread already exist
|
//check if a thread already exist
|
||||||
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($this->context->customer->email, $order->id);
|
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($this->context->customer->email, $order->id);
|
||||||
|
|
||||||
$cm = new CustomerMessage();
|
$cm = new CustomerMessage();
|
||||||
if (!$id_customer_thread)
|
if (!$id_customer_thread)
|
||||||
{
|
{
|
||||||
@@ -104,7 +104,7 @@ class OrderDetailControllerCore extends FrontController
|
|||||||
'{id_order}' => (int)($order->id),
|
'{id_order}' => (int)($order->id),
|
||||||
'{message}' => $msgText),
|
'{message}' => $msgText),
|
||||||
$to, $toName, $customer->email, $customer->firstname.' '.$customer->lastname);
|
$to, $toName, $customer->email, $customer->firstname.' '.$customer->lastname);
|
||||||
|
|
||||||
if (Tools::getValue('ajax') != 'true')
|
if (Tools::getValue('ajax') != 'true')
|
||||||
Tools::redirect('index.php?controller=order-detail&id_order='.(int)$idOrder);
|
Tools::redirect('index.php?controller=order-detail&id_order='.(int)$idOrder);
|
||||||
}
|
}
|
||||||
@@ -180,6 +180,8 @@ class OrderDetailControllerCore extends FrontController
|
|||||||
$this->errors[] = Tools::displayError('Cannot find this order');
|
$this->errors[] = Tools::displayError('Cannot find this order');
|
||||||
unset($order);
|
unset($order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'order-detail.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
@@ -198,12 +200,6 @@ class OrderDetailControllerCore extends FrontController
|
|||||||
parent::displayHeader();
|
parent::displayHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'order-detail.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function displayFooter()
|
public function displayFooter()
|
||||||
{
|
{
|
||||||
if (Tools::getValue('ajax') != 'true')
|
if (Tools::getValue('ajax') != 'true')
|
||||||
+6
-13
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -31,11 +31,9 @@ class OrderFollowControllerCore extends FrontController
|
|||||||
public $php_self = 'order-follow';
|
public $php_self = 'order-follow';
|
||||||
public $authRedirection = 'order-follow';
|
public $authRedirection = 'order-follow';
|
||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
|
|
||||||
public function preProcess()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
|
||||||
|
|
||||||
if (Tools::isSubmit('submitReturnMerchandise'))
|
if (Tools::isSubmit('submitReturnMerchandise'))
|
||||||
{
|
{
|
||||||
$customizationQtyInput = Tools::getValue('customization_qty_input');
|
$customizationQtyInput = Tools::getValue('customization_qty_input');
|
||||||
@@ -82,8 +80,10 @@ class OrderFollowControllerCore extends FrontController
|
|||||||
$this->context->smarty->assign('errorNotReturnable',true);
|
$this->context->smarty->assign('errorNotReturnable',true);
|
||||||
|
|
||||||
$this->context->smarty->assign('ordersReturn', $ordersReturn);
|
$this->context->smarty->assign('ordersReturn', $ordersReturn);
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'order-follow.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
@@ -91,11 +91,4 @@ class OrderFollowControllerCore extends FrontController
|
|||||||
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
||||||
$this->addJS(array(_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js', _THEME_JS_DIR_.'history.js'));
|
$this->addJS(array(_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js', _THEME_JS_DIR_.'history.js'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'order-follow.tpl');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,9 +30,10 @@ class OrderOpcControllerCore extends ParentOrderController
|
|||||||
public $php_self = 'order-opc';
|
public $php_self = 'order-opc';
|
||||||
public $isLogged;
|
public $isLogged;
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
parent::init();
|
||||||
|
|
||||||
if ($this->nbProducts)
|
if ($this->nbProducts)
|
||||||
$this->context->smarty->assign('virtual_cart', false);
|
$this->context->smarty->assign('virtual_cart', false);
|
||||||
$this->isLogged = (bool)($this->context->customer->id AND Customer::customerIdExistsStatic((int)($this->context->cookie->id_customer)));
|
$this->isLogged = (bool)($this->context->customer->id AND Customer::customerIdExistsStatic((int)($this->context->cookie->id_customer)));
|
||||||
@@ -272,6 +273,9 @@ class OrderOpcControllerCore extends ParentOrderController
|
|||||||
Tools::safePostVars();
|
Tools::safePostVars();
|
||||||
|
|
||||||
$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
|
$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
|
||||||
|
|
||||||
|
$this->_processAddressFormat();
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'order-opc.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayHeader()
|
public function displayHeader()
|
||||||
@@ -280,14 +284,6 @@ class OrderOpcControllerCore extends ParentOrderController
|
|||||||
parent::displayHeader();
|
parent::displayHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
|
|
||||||
$this->_processAddressFormat();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'order-opc.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function displayFooter()
|
public function displayFooter()
|
||||||
{
|
{
|
||||||
if (Tools::getValue('ajax') != 'true')
|
if (Tools::getValue('ajax') != 'true')
|
||||||
+8
-14
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -31,19 +31,17 @@ class OrderReturnControllerCore extends FrontController
|
|||||||
public $php_self = 'order-return';
|
public $php_self = 'order-return';
|
||||||
public $authRedirection = 'order-follow';
|
public $authRedirection = 'order-follow';
|
||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
header("Cache-Control: no-cache, must-revalidate");
|
header("Cache-Control: no-cache, must-revalidate");
|
||||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preProcess()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::preProcess();
|
|
||||||
|
|
||||||
if (!isset($_GET['id_order_return']) OR !Validate::isUnsignedId($_GET['id_order_return']))
|
if (!isset($_GET['id_order_return']) OR !Validate::isUnsignedId($_GET['id_order_return']))
|
||||||
$this->errors[] = Tools::displayError('Order ID required');
|
$this->errors[] = Tools::displayError('Order ID required');
|
||||||
else
|
else
|
||||||
@@ -76,20 +74,16 @@ class OrderReturnControllerCore extends FrontController
|
|||||||
'errors' => $this->errors,
|
'errors' => $this->errors,
|
||||||
'nbdaysreturn' => (int)(Configuration::get('PS_ORDER_RETURN_NB_DAYS'))
|
'nbdaysreturn' => (int)(Configuration::get('PS_ORDER_RETURN_NB_DAYS'))
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'order-return.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayHeader()
|
public function displayHeader()
|
||||||
{
|
{
|
||||||
if (Tools::getValue('ajax') != 'true')
|
if (Tools::getValue('ajax') != 'true')
|
||||||
parent::displayHeader();
|
parent::displayHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'order-return.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function displayFooter()
|
public function displayFooter()
|
||||||
{
|
{
|
||||||
if (Tools::getValue('ajax') != 'true')
|
if (Tools::getValue('ajax') != 'true')
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -31,7 +31,7 @@ class OrderSlipControllerCore extends FrontController
|
|||||||
public $php_self = 'order-slip';
|
public $php_self = 'order-slip';
|
||||||
public $authRedirection = 'order-slip';
|
public $authRedirection = 'order-slip';
|
||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
@@ -39,17 +39,11 @@ class OrderSlipControllerCore extends FrontController
|
|||||||
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
||||||
$this->addJS(array(_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js',_THEME_JS_DIR_.'history.js'));
|
$this->addJS(array(_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js',_THEME_JS_DIR_.'history.js'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
$this->context->smarty->assign('ordersSlip', OrderSlip::getOrdersSlip((int)($this->context->cookie->id_customer)));
|
$this->context->smarty->assign('ordersSlip', OrderSlip::getOrdersSlip((int)($this->context->cookie->id_customer)));
|
||||||
}
|
$this->setTemplate(_PS_THEME_DIR_.'order-slip.tpl');
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'order-slip.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -28,10 +28,10 @@
|
|||||||
class PageNotFoundControllerCore extends FrontController
|
class PageNotFoundControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = '404';
|
public $php_self = '404';
|
||||||
|
|
||||||
public function displayContent()
|
public function process()
|
||||||
{
|
{
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'404.tpl');
|
$this->setTemplate(_PS_THEME_DIR_.'404.tpl');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+34
-38
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -32,28 +32,24 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
public $ssl = true;
|
public $ssl = true;
|
||||||
public $php_self = 'order';
|
public $php_self = 'order';
|
||||||
|
|
||||||
public $nbProducts;
|
public $nbProducts;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
/* Disable some cache related bugs on the cart/order */
|
/* Disable some cache related bugs on the cart/order */
|
||||||
header('Cache-Control: no-cache, must-revalidate');
|
header('Cache-Control: no-cache, must-revalidate');
|
||||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::init();
|
parent::init();
|
||||||
$this->nbProducts = $this->context->cart->nbProducts();
|
$this->nbProducts = $this->context->cart->nbProducts();
|
||||||
}
|
|
||||||
|
|
||||||
public function preProcess()
|
|
||||||
{
|
|
||||||
global $isVirtualCart;
|
global $isVirtualCart;
|
||||||
parent::preProcess();
|
|
||||||
|
|
||||||
// Redirect to the good order process
|
// Redirect to the good order process
|
||||||
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 0 AND Dispatcher::getInstance()->getController() != 'order')
|
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 0 AND Dispatcher::getInstance()->getController() != 'order')
|
||||||
@@ -64,10 +60,10 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
Tools::redirect('index.php?controller=order-opc&isPaymentStep=true');
|
Tools::redirect('index.php?controller=order-opc&isPaymentStep=true');
|
||||||
Tools::redirect('index.php?controller=order-opc');
|
Tools::redirect('index.php?controller=order-opc');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Configuration::get('PS_CATALOG_MODE'))
|
if (Configuration::get('PS_CATALOG_MODE'))
|
||||||
$this->errors[] = Tools::displayError('This store has not accepted your new order.');
|
$this->errors[] = Tools::displayError('This store has not accepted your new order.');
|
||||||
|
|
||||||
if (Tools::isSubmit('submitReorder') AND $id_order = (int)Tools::getValue('id_order'))
|
if (Tools::isSubmit('submitReorder') AND $id_order = (int)Tools::getValue('id_order'))
|
||||||
{
|
{
|
||||||
$oldCart = new Cart(Order::getCartIdStatic($id_order, $this->context->customer->id));
|
$oldCart = new Cart(Order::getCartIdStatic($id_order, $this->context->customer->id));
|
||||||
@@ -124,14 +120,14 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
if ($isVirtualCart = $this->context->cart->isVirtualCart())
|
if ($isVirtualCart = $this->context->cart->isVirtualCart())
|
||||||
$this->_setNoCarrier();
|
$this->_setNoCarrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->context->smarty->assign('back', Tools::safeOutput(Tools::getValue('back')));
|
$this->context->smarty->assign('back', Tools::safeOutput(Tools::getValue('back')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
|
|
||||||
// Adding CSS style sheet
|
// Adding CSS style sheet
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
||||||
$this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
|
$this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
|
||||||
@@ -146,9 +142,9 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
$this->addJS(_THEME_JS_DIR_.'cart-summary.js');
|
$this->addJS(_THEME_JS_DIR_.'cart-summary.js');
|
||||||
$this->addJS(_PS_JS_DIR_.'jquery/jquery-typewatch.pack.js');
|
$this->addJS(_PS_JS_DIR_.'jquery/jquery-typewatch.pack.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
@@ -163,7 +159,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _updateMessage($messageContent)
|
protected function _updateMessage($messageContent)
|
||||||
{
|
{
|
||||||
if ($messageContent)
|
if ($messageContent)
|
||||||
@@ -195,7 +191,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _processCarrier()
|
protected function _processCarrier()
|
||||||
{
|
{
|
||||||
$this->context->cart->recyclable = (int)(Tools::getValue('recyclable'));
|
$this->context->cart->recyclable = (int)(Tools::getValue('recyclable'));
|
||||||
@@ -207,7 +203,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
else
|
else
|
||||||
$this->context->cart->gift_message = strip_tags($_POST['gift_message']);
|
$this->context->cart->gift_message = strip_tags($_POST['gift_message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->context->customer->id) AND $this->context->customer->id)
|
if (isset($this->context->customer->id) AND $this->context->customer->id)
|
||||||
{
|
{
|
||||||
$address = new Address((int)($this->context->cart->id_address_delivery));
|
$address = new Address((int)($this->context->cart->id_address_delivery));
|
||||||
@@ -216,17 +212,17 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
$id_zone = Country::getIdZone((int)Configuration::get('PS_COUNTRY_DEFAULT'));
|
$id_zone = Country::getIdZone((int)Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||||
|
|
||||||
if (Validate::isInt(Tools::getValue('id_carrier')) AND sizeof(Carrier::checkCarrierZone((int)(Tools::getValue('id_carrier')), (int)($id_zone))))
|
if (Validate::isInt(Tools::getValue('id_carrier')) AND sizeof(Carrier::checkCarrierZone((int)(Tools::getValue('id_carrier')), (int)($id_zone))))
|
||||||
$this->context->cart->id_carrier = (int)(Tools::getValue('id_carrier'));
|
$this->context->cart->id_carrier = (int)(Tools::getValue('id_carrier'));
|
||||||
elseif (!$this->context->cart->isVirtualCart() AND (int)(Tools::getValue('id_carrier')) == 0)
|
elseif (!$this->context->cart->isVirtualCart() AND (int)(Tools::getValue('id_carrier')) == 0)
|
||||||
$this->errors[] = Tools::displayError('Invalid carrier or no carrier selected');
|
$this->errors[] = Tools::displayError('Invalid carrier or no carrier selected');
|
||||||
|
|
||||||
Module::hookExec('processCarrier', array('cart' => $this->context->cart));
|
Module::hookExec('processCarrier', array('cart' => $this->context->cart));
|
||||||
|
|
||||||
return $this->context->cart->update();
|
return $this->context->cart->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _assignSummaryInformations()
|
protected function _assignSummaryInformations()
|
||||||
{
|
{
|
||||||
if (file_exists(_PS_SHIP_IMG_DIR_.$this->context->cart->id_carrier.'.jpg'))
|
if (file_exists(_PS_SHIP_IMG_DIR_.$this->context->cart->id_carrier.'.jpg'))
|
||||||
@@ -241,14 +237,14 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
$productId = (int)(isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id']);
|
$productId = (int)(isset($productUpdate['id_product']) ? $productUpdate['id_product'] : $productUpdate['product_id']);
|
||||||
$productAttributeId = (int)(isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id']);
|
$productAttributeId = (int)(isset($productUpdate['id_product_attribute']) ? $productUpdate['id_product_attribute'] : $productUpdate['product_attribute_id']);
|
||||||
|
|
||||||
if (isset($customizedDatas[$productId][$productAttributeId]))
|
if (isset($customizedDatas[$productId][$productAttributeId]))
|
||||||
$productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
$productUpdate['tax_rate'] = Tax::getProductTaxRate($productId, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||||
}
|
}
|
||||||
|
|
||||||
Product::addCustomizationPrice($summary['products'], $customizedDatas);
|
Product::addCustomizationPrice($summary['products'], $customizedDatas);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($free_ship = Tools::convertPrice((float)(Configuration::get('PS_SHIPPING_FREE_PRICE')), new Currency($this->context->cart->id_currency)))
|
if ($free_ship = Tools::convertPrice((float)(Configuration::get('PS_SHIPPING_FREE_PRICE')), new Currency($this->context->cart->id_currency)))
|
||||||
{
|
{
|
||||||
$discounts = $this->context->cart->getDiscounts();
|
$discounts = $this->context->cart->getDiscounts();
|
||||||
@@ -290,7 +286,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
'HOOK_SHOPPING_CART_EXTRA' => Module::hookExec('shoppingCartExtra', $summary)
|
'HOOK_SHOPPING_CART_EXTRA' => Module::hookExec('shoppingCartExtra', $summary)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _assignAddress()
|
protected function _assignAddress()
|
||||||
{
|
{
|
||||||
//if guest checkout disabled and flag is_guest in cookies is actived
|
//if guest checkout disabled and flag is_guest in cookies is actived
|
||||||
@@ -306,18 +302,18 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
/* Getting customer addresses */
|
/* Getting customer addresses */
|
||||||
$customerAddresses = $customer->getAddresses($this->context->language->id);
|
$customerAddresses = $customer->getAddresses($this->context->language->id);
|
||||||
|
|
||||||
// Getting a list of formated address fields with associated values
|
// Getting a list of formated address fields with associated values
|
||||||
$formatedAddressFieldsValuesList = array();
|
$formatedAddressFieldsValuesList = array();
|
||||||
foreach($customerAddresses as $address)
|
foreach($customerAddresses as $address)
|
||||||
{
|
{
|
||||||
$tmpAddress = new Address($address['id_address']);
|
$tmpAddress = new Address($address['id_address']);
|
||||||
|
|
||||||
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
|
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
|
||||||
$formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues(
|
$formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues(
|
||||||
$tmpAddress,
|
$tmpAddress,
|
||||||
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields']);
|
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields']);
|
||||||
|
|
||||||
unset($tmpAddress);
|
unset($tmpAddress);
|
||||||
}
|
}
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
@@ -358,7 +354,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
if ($oldMessage = Message::getMessageByCartId((int)($this->context->cart->id)))
|
if ($oldMessage = Message::getMessageByCartId((int)($this->context->cart->id)))
|
||||||
$this->context->smarty->assign('oldMessage', $oldMessage['message']);
|
$this->context->smarty->assign('oldMessage', $oldMessage['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _assignCarrier()
|
protected function _assignCarrier()
|
||||||
{
|
{
|
||||||
$address = new Address($this->context->cart->id_address_delivery);
|
$address = new Address($this->context->cart->id_address_delivery);
|
||||||
@@ -375,14 +371,14 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers))
|
'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _assignWrappingAndTOS()
|
protected function _assignWrappingAndTOS()
|
||||||
{
|
{
|
||||||
// Wrapping fees
|
// Wrapping fees
|
||||||
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
|
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
|
||||||
$wrapping_fees_tax = new Tax(Configuration::get('PS_GIFT_WRAPPING_TAX'));
|
$wrapping_fees_tax = new Tax(Configuration::get('PS_GIFT_WRAPPING_TAX'));
|
||||||
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
|
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
|
||||||
|
|
||||||
// TOS
|
// TOS
|
||||||
$cms = new CMS(Configuration::get('PS_CONDITIONS_CMS_ID'), $this->context->language->id);
|
$cms = new CMS(Configuration::get('PS_CONDITIONS_CMS_ID'), $this->context->language->id);
|
||||||
$this->link_conditions = $this->context->link->getCMSLink($cms, $cms->link_rewrite, true);
|
$this->link_conditions = $this->context->link->getCMSLink($cms, $cms->link_rewrite, true);
|
||||||
@@ -390,7 +386,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
$this->link_conditions .= '?content_only=1';
|
$this->link_conditions .= '?content_only=1';
|
||||||
else
|
else
|
||||||
$this->link_conditions .= '&content_only=1';
|
$this->link_conditions .= '&content_only=1';
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'checkedTOS' => (int)($this->context->cookie->checkedTOS),
|
'checkedTOS' => (int)($this->context->cookie->checkedTOS),
|
||||||
'recyclablePackAllowed' => (int)(Configuration::get('PS_RECYCLABLE_PACK')),
|
'recyclablePackAllowed' => (int)(Configuration::get('PS_RECYCLABLE_PACK')),
|
||||||
@@ -403,7 +399,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
'total_wrapping_cost' => Tools::convertPrice($wrapping_fees_tax_inc, $this->context->currency),
|
'total_wrapping_cost' => Tools::convertPrice($wrapping_fees_tax_inc, $this->context->currency),
|
||||||
'total_wrapping_tax_exc_cost' => Tools::convertPrice($wrapping_fees, $this->context->currency)));
|
'total_wrapping_tax_exc_cost' => Tools::convertPrice($wrapping_fees, $this->context->currency)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _assignPayment()
|
protected function _assignPayment()
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
@@ -411,7 +407,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
'HOOK_PAYMENT' => Module::hookExecPayment()
|
'HOOK_PAYMENT' => Module::hookExecPayment()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set id_carrier to 0 (no shipping price)
|
* Set id_carrier to 0 (no shipping price)
|
||||||
*
|
*
|
||||||
@@ -421,7 +417,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
$this->context->cart->id_carrier = 0;
|
$this->context->cart->id_carrier = 0;
|
||||||
$this->context->cart->update();
|
$this->context->cart->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decides what the default carrier is and update the cart with it
|
* Decides what the default carrier is and update the cart with it
|
||||||
*
|
*
|
||||||
@@ -453,6 +449,6 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
return $this->context->cart->id_carrier;
|
return $this->context->cart->id_carrier;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -30,11 +30,9 @@ define('MIN_PASSWD_LENGTH', 8);
|
|||||||
class PasswordControllerCore extends FrontController
|
class PasswordControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'password';
|
public $php_self = 'password';
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
if (Tools::isSubmit('email'))
|
if (Tools::isSubmit('email'))
|
||||||
{
|
{
|
||||||
if (!($email = Tools::getValue('email')) OR !Validate::isEmail($email))
|
if (!($email = Tools::getValue('email')) OR !Validate::isEmail($email))
|
||||||
@@ -50,13 +48,13 @@ class PasswordControllerCore extends FrontController
|
|||||||
if ((strtotime($customer->last_passwd_gen.'+'.(int)($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')).' minutes') - time()) > 0)
|
if ((strtotime($customer->last_passwd_gen.'+'.(int)($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')).' minutes') - time()) > 0)
|
||||||
$this->errors[] = Tools::displayError('You can regenerate your password only every').' '.(int)($min_time).' '.Tools::displayError('minute(s)');
|
$this->errors[] = Tools::displayError('You can regenerate your password only every').' '.(int)($min_time).' '.Tools::displayError('minute(s)');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Mail::Send($this->context->language->id, 'password_query', Mail::l('Password query confirmation'),
|
if (Mail::Send($this->context->language->id, 'password_query', Mail::l('Password query confirmation'),
|
||||||
array('{email}' => $customer->email,
|
array('{email}' => $customer->email,
|
||||||
'{lastname}' => $customer->lastname,
|
'{lastname}' => $customer->lastname,
|
||||||
'{firstname}' => $customer->firstname,
|
'{firstname}' => $customer->firstname,
|
||||||
'{url}' => $this->context->link->getPageLink('password', true, NULL, 'token='.$customer->secure_key.'&id_customer='.(int)$customer->id)),
|
'{url}' => $this->context->link->getPageLink('password', true, NULL, 'token='.$customer->secure_key.'&id_customer='.(int)$customer->id)),
|
||||||
$customer->email,
|
$customer->email,
|
||||||
$customer->firstname.' '.$customer->lastname))
|
$customer->firstname.' '.$customer->lastname))
|
||||||
$this->context->smarty->assign(array('confirmation' => 2, 'email' => $customer->email));
|
$this->context->smarty->assign(array('confirmation' => 2, 'email' => $customer->email));
|
||||||
else
|
else
|
||||||
@@ -80,13 +78,13 @@ class PasswordControllerCore extends FrontController
|
|||||||
$customer->last_passwd_gen = date('Y-m-d H:i:s', time());
|
$customer->last_passwd_gen = date('Y-m-d H:i:s', time());
|
||||||
if ($customer->update())
|
if ($customer->update())
|
||||||
{
|
{
|
||||||
if (Mail::Send($this->context->language->id, 'password', Mail::l('Your password'),
|
if (Mail::Send($this->context->language->id, 'password', Mail::l('Your password'),
|
||||||
array('{email}' => $customer->email,
|
array('{email}' => $customer->email,
|
||||||
'{lastname}' => $customer->lastname,
|
'{lastname}' => $customer->lastname,
|
||||||
'{firstname}' => $customer->firstname,
|
'{firstname}' => $customer->firstname,
|
||||||
'{passwd}' => $password),
|
'{passwd}' => $password),
|
||||||
$customer->email,
|
$customer->email,
|
||||||
$customer->firstname.' '.$customer->lastname))
|
$customer->firstname.' '.$customer->lastname))
|
||||||
$this->context->smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
|
$this->context->smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
|
||||||
else
|
else
|
||||||
$this->errors[] = Tools::displayError('Error occurred when sending the e-mail.');
|
$this->errors[] = Tools::displayError('Error occurred when sending the e-mail.');
|
||||||
@@ -100,12 +98,8 @@ class PasswordControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
elseif (($token = Tools::getValue('token')) || ($id_customer = Tools::getValue('id_customer')))
|
elseif (($token = Tools::getValue('token')) || ($id_customer = Tools::getValue('id_customer')))
|
||||||
$this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
|
$this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
|
||||||
}
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'password.tpl');
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'password.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -27,16 +27,11 @@
|
|||||||
|
|
||||||
class PdfInvoiceControllerCore extends FrontController
|
class PdfInvoiceControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$this->init();
|
|
||||||
$this->preProcess();
|
|
||||||
$this->process();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
$this->displayHeader(false);
|
||||||
|
$this->displayFooter(false);
|
||||||
|
|
||||||
if (!$this->context->customer->isLogged() AND !Tools::getValue('secure_key'))
|
if (!$this->context->customer->isLogged() AND !Tools::getValue('secure_key'))
|
||||||
Tools::redirect('index.php?controller=authentication&back=pdf-invoice');
|
Tools::redirect('index.php?controller=authentication&back=pdf-invoice');
|
||||||
if (!(int)(Configuration::get('PS_INVOICE')))
|
if (!(int)(Configuration::get('PS_INVOICE')))
|
||||||
+3
-9
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -27,16 +27,10 @@
|
|||||||
|
|
||||||
class PdfOrderReturnControllerCore extends FrontController
|
class PdfOrderReturnControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$this->init();
|
|
||||||
$this->preProcess();
|
|
||||||
$this->process();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
$this->displayHeader(false);
|
||||||
|
$this->displayFooter(false);
|
||||||
|
|
||||||
if (!$this->context->customer->isLogged())
|
if (!$this->context->customer->isLogged())
|
||||||
Tools::redirect('index.php?controller=authentication&back=order-follow');
|
Tools::redirect('index.php?controller=authentication&back=order-follow');
|
||||||
+4
-10
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -27,20 +27,14 @@
|
|||||||
|
|
||||||
class PdfOrderSlipControllerCore extends FrontController
|
class PdfOrderSlipControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$this->init();
|
|
||||||
$this->preProcess();
|
|
||||||
$this->process();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
$this->displayHeader(false);
|
||||||
|
$this->displayFooter(false);
|
||||||
|
|
||||||
if (!$this->context->customer->isLogged())
|
if (!$this->context->customer->isLogged())
|
||||||
Tools::redirect('index.php?controller=authentication&back=order-follow');
|
Tools::redirect('index.php?controller=authentication&back=order-follow');
|
||||||
|
|
||||||
if (isset($_GET['id_order_slip']) AND Validate::isUnsignedId($_GET['id_order_slip']))
|
if (isset($_GET['id_order_slip']) AND Validate::isUnsignedId($_GET['id_order_slip']))
|
||||||
$orderSlip = new OrderSlip((int)($_GET['id_order_slip']));
|
$orderSlip = new OrderSlip((int)($_GET['id_order_slip']));
|
||||||
if (!isset($orderSlip) OR !Validate::isLoadedObject($orderSlip))
|
if (!isset($orderSlip) OR !Validate::isLoadedObject($orderSlip))
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -28,17 +28,15 @@
|
|||||||
class PricesDropControllerCore extends FrontController
|
class PricesDropControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'prices-drop';
|
public $php_self = 'prices-drop';
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
$this->productSort();
|
$this->productSort();
|
||||||
$nbProducts = Product::getPricesDrop($this->context->language->id, NULL, NULL, true);
|
$nbProducts = Product::getPricesDrop($this->context->language->id, NULL, NULL, true);
|
||||||
$this->pagination($nbProducts);
|
$this->pagination($nbProducts);
|
||||||
@@ -49,12 +47,8 @@ class PricesDropControllerCore extends FrontController
|
|||||||
'nbProducts' => $nbProducts,
|
'nbProducts' => $nbProducts,
|
||||||
'homeSize' => Image::getSize('home')
|
'homeSize' => Image::getSize('home')
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'prices-drop.tpl');
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'prices-drop.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,23 +52,14 @@ class ProductControllerCore extends FrontController
|
|||||||
|
|
||||||
public function canonicalRedirection()
|
public function canonicalRedirection()
|
||||||
{
|
{
|
||||||
// Automatically redirect to the canonical URL if the current in is the right one
|
|
||||||
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
|
|
||||||
if (Validate::isLoadedObject($this->product))
|
if (Validate::isLoadedObject($this->product))
|
||||||
{
|
parent::canonicalRedirection($this->context->link->getProductLink($this->product));
|
||||||
$canonicalURL = $this->context->link->getProductLink($this->product);
|
|
||||||
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 301 Moved');
|
|
||||||
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_)
|
|
||||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$canonicalURL.'">'.$canonicalURL.'</a>');
|
|
||||||
Tools::redirectLink($canonicalURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
if ($id_product = (int)Tools::getValue('id_product'))
|
if ($id_product = (int)Tools::getValue('id_product'))
|
||||||
$this->product = new Product($id_product, true, $this->context->language->id);
|
$this->product = new Product($id_product, true, $this->context->language->id);
|
||||||
|
|
||||||
@@ -79,8 +70,6 @@ class ProductControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->canonicalRedirection();
|
$this->canonicalRedirection();
|
||||||
|
|
||||||
parent::preProcess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
@@ -203,7 +192,7 @@ class ProductControllerCore extends FrontController
|
|||||||
$ecotaxTaxAmount = Tools::ps_round($ecotaxTaxAmount * (1 + $ecotax_rate / 100), 2);
|
$ecotaxTaxAmount = Tools::ps_round($ecotaxTaxAmount * (1 + $ecotax_rate / 100), 2);
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'quantity_discounts' => $this->formatQuantityDiscounts(SpecificPrice::getQuantityDiscounts((int)$this->product->id, $this->id_current_shop, (int)$this->context->cookie->id_currency, $id_country, $id_group), $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false), (float)$tax),
|
'quantity_discounts' => $this->formatQuantityDiscounts(SpecificPrice::getQuantityDiscounts((int)$this->product->id, $this->context->shop->getID(true), (int)$this->context->cookie->id_currency, $id_country, $id_group), $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false), (float)$tax),
|
||||||
'product' => $this->product,
|
'product' => $this->product,
|
||||||
'ecotax_tax_inc' => $ecotaxTaxAmount,
|
'ecotax_tax_inc' => $ecotaxTaxAmount,
|
||||||
'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2),
|
'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2),
|
||||||
@@ -290,7 +279,7 @@ class ProductControllerCore extends FrontController
|
|||||||
|
|
||||||
//french date format
|
//french date format
|
||||||
$availableDate = date('j-m-Y',strtotime($row['available_date']));
|
$availableDate = date('j-m-Y',strtotime($row['available_date']));
|
||||||
|
|
||||||
$combinations[$row['id_product_attribute']]['attributes_values'][$row['id_attribute_group']] = $row['attribute_name'];
|
$combinations[$row['id_product_attribute']]['attributes_values'][$row['id_attribute_group']] = $row['attribute_name'];
|
||||||
$combinations[$row['id_product_attribute']]['attributes'][] = (int)($row['id_attribute']);
|
$combinations[$row['id_product_attribute']]['attributes'][] = (int)($row['id_attribute']);
|
||||||
$combinations[$row['id_product_attribute']]['price'] = (float)($row['price']);
|
$combinations[$row['id_product_attribute']]['price'] = (float)($row['price']);
|
||||||
@@ -340,7 +329,7 @@ class ProductControllerCore extends FrontController
|
|||||||
// Pack management
|
// Pack management
|
||||||
$this->context->smarty->assign('packItems', $this->product->cache_is_pack ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array());
|
$this->context->smarty->assign('packItems', $this->product->cache_is_pack ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array());
|
||||||
$this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1));
|
$this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1));
|
||||||
|
|
||||||
$this->product->description = $this->transformDescriptionWithImg($this->product->description);
|
$this->product->description = $this->transformDescriptionWithImg($this->product->description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,14 +350,10 @@ class ProductControllerCore extends FrontController
|
|||||||
'currencyBlank' => $this->context->currency->blank,
|
'currencyBlank' => $this->context->currency->blank,
|
||||||
'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM')
|
'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'product.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'product.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function transformDescriptionWithImg($desc)
|
public function transformDescriptionWithImg($desc)
|
||||||
{
|
{
|
||||||
$reg = '/{img-([0-9]+)-(left|right)-([a-z]+)}/';
|
$reg = '/{img-([0-9]+)-(left|right)-([a-z]+)}/';
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -30,19 +30,17 @@ class SearchControllerCore extends FrontController
|
|||||||
public $php_self = 'search';
|
public $php_self = 'search';
|
||||||
public $instantSearch;
|
public $instantSearch;
|
||||||
public $ajaxSearch;
|
public $ajaxSearch;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->instantSearch = Tools::getValue('instantSearch');
|
$this->instantSearch = Tools::getValue('instantSearch');
|
||||||
$this->ajaxSearch = Tools::getValue('ajaxSearch');
|
$this->ajaxSearch = Tools::getValue('ajaxSearch');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preProcess()
|
|
||||||
{
|
|
||||||
parent::preProcess();
|
|
||||||
|
|
||||||
|
public function process()
|
||||||
|
{
|
||||||
$query = urldecode(Tools::getValue('q'));
|
$query = urldecode(Tools::getValue('q'));
|
||||||
if ($this->ajaxSearch)
|
if ($this->ajaxSearch)
|
||||||
{
|
{
|
||||||
@@ -51,7 +49,7 @@ class SearchControllerCore extends FrontController
|
|||||||
$product['product_link'] = $this->context->link->getProductLink($product['id_product'], $product['prewrite'], $product['crewrite']);
|
$product['product_link'] = $this->context->link->getProductLink($product['id_product'], $product['prewrite'], $product['crewrite']);
|
||||||
die(Tools::jsonEncode($searchResults));
|
die(Tools::jsonEncode($searchResults));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->instantSearch && !is_array($query))
|
if ($this->instantSearch && !is_array($query))
|
||||||
{
|
{
|
||||||
$this->productSort();
|
$this->productSort();
|
||||||
@@ -107,8 +105,10 @@ class SearchControllerCore extends FrontController
|
|||||||
'nbProducts' => 0));
|
'nbProducts' => 0));
|
||||||
}
|
}
|
||||||
$this->context->smarty->assign('add_prod_display', Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'));
|
$this->context->smarty->assign('add_prod_display', Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'));
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'search.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayHeader()
|
public function displayHeader()
|
||||||
{
|
{
|
||||||
if (!$this->instantSearch AND !$this->ajaxSearch)
|
if (!$this->instantSearch AND !$this->ajaxSearch)
|
||||||
@@ -116,23 +116,17 @@ class SearchControllerCore extends FrontController
|
|||||||
else
|
else
|
||||||
$this->context->smarty->assign('static_token', Tools::getToken(false));
|
$this->context->smarty->assign('static_token', Tools::getToken(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'search.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function displayFooter()
|
public function displayFooter()
|
||||||
{
|
{
|
||||||
if (!$this->instantSearch AND !$this->ajaxSearch)
|
if (!$this->instantSearch AND !$this->ajaxSearch)
|
||||||
parent::displayFooter();
|
parent::displayFooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
|
|
||||||
if (!$this->instantSearch AND !$this->ajaxSearch)
|
if (!$this->instantSearch AND !$this->ajaxSearch)
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -28,18 +28,16 @@
|
|||||||
class SitemapControllerCore extends FrontController
|
class SitemapControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'sitemap';
|
public $php_self = 'sitemap';
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'sitemap.css');
|
$this->addCSS(_THEME_CSS_DIR_.'sitemap.css');
|
||||||
$this->addJS(_THEME_JS_DIR_.'tools/treeManagement.js');
|
$this->addJS(_THEME_JS_DIR_.'tools/treeManagement.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
$this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0));
|
$this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0));
|
||||||
$this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1));
|
$this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1));
|
||||||
$this->context->smarty->assign('voucherAllowed', (int)Configuration::get('PS_VOUCHERS'));
|
$this->context->smarty->assign('voucherAllowed', (int)Configuration::get('PS_VOUCHERS'));
|
||||||
@@ -50,11 +48,7 @@ class SitemapControllerCore extends FrontController
|
|||||||
$this->context->smarty->assign('display_supplier_link', (((int)$blocksupplier->id) ? true : false));
|
$this->context->smarty->assign('display_supplier_link', (((int)$blocksupplier->id) ? true : false));
|
||||||
$this->context->smarty->assign('PS_DISPLAY_SUPPLIERS', Configuration::get('PS_DISPLAY_SUPPLIERS'));
|
$this->context->smarty->assign('PS_DISPLAY_SUPPLIERS', Configuration::get('PS_DISPLAY_SUPPLIERS'));
|
||||||
$this->context->smarty->assign('display_store', Configuration::get('PS_STORES_DISPLAY_SITEMAP'));
|
$this->context->smarty->assign('display_store', Configuration::get('PS_STORES_DISPLAY_SITEMAP'));
|
||||||
}
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'sitemap.tpl');
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'sitemap.tpl');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -29,16 +29,17 @@ class StatisticsControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
$this->displayHeader(false);
|
||||||
|
$this->displayFooter(false);
|
||||||
|
|
||||||
if (!isset($_POST['token']) OR !isset($_POST['type']))
|
if (!isset($_POST['token']) OR !isset($_POST['type']))
|
||||||
die;
|
die;
|
||||||
|
|
||||||
if ($_POST['type'] == 'navinfo')
|
if ($_POST['type'] == 'navinfo')
|
||||||
{
|
{
|
||||||
if (sha1($_POST['id_guest']._COOKIE_KEY_) != $_POST['token'])
|
if (sha1($_POST['id_guest']._COOKIE_KEY_) != $_POST['token'])
|
||||||
die;
|
die;
|
||||||
|
|
||||||
$guest = new Guest((int)$_POST['id_guest']);
|
$guest = new Guest((int)$_POST['id_guest']);
|
||||||
$guest->javascript = true;
|
$guest->javascript = true;
|
||||||
$guest->screen_resolution_x = (int)($_POST['screen_resolution_x']);
|
$guest->screen_resolution_x = (int)($_POST['screen_resolution_x']);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -28,58 +28,60 @@
|
|||||||
class StoresControllerCore extends FrontController
|
class StoresControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'stores';
|
public $php_self = 'stores';
|
||||||
|
|
||||||
public function preProcess()
|
public function init()
|
||||||
{
|
{
|
||||||
if(!extension_loaded('Dom'))
|
parent::init();
|
||||||
|
|
||||||
|
if (!extension_loaded('Dom'))
|
||||||
{
|
{
|
||||||
$this->errors[] = Tools::displayError('Dom extension is not loaded.');
|
$this->errors[] = Tools::displayError('Dom extension is not loaded.');
|
||||||
$smarty->assign('errors', $this->errors);
|
$smarty->assign('errors', $this->errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
$simplifiedStoreLocator = Configuration::get('PS_STORES_SIMPLIFIED');
|
$simplifiedStoreLocator = Configuration::get('PS_STORES_SIMPLIFIED');
|
||||||
$distanceUnit = Configuration::get('PS_DISTANCE_UNIT');
|
$distanceUnit = Configuration::get('PS_DISTANCE_UNIT');
|
||||||
if (!in_array($distanceUnit, array('km', 'mi')))
|
if (!in_array($distanceUnit, array('km', 'mi')))
|
||||||
$distanceUnit = 'km';
|
$distanceUnit = 'km';
|
||||||
|
|
||||||
if ($simplifiedStoreLocator)
|
if ($simplifiedStoreLocator)
|
||||||
{
|
{
|
||||||
$stores = Db::getInstance()->ExecuteS('
|
$stores = Db::getInstance()->ExecuteS('
|
||||||
SELECT s.*, cl.name country, st.iso_code state
|
SELECT s.*, cl.name country, st.iso_code state
|
||||||
FROM '._DB_PREFIX_.'store_shop ss
|
FROM '._DB_PREFIX_.'store s
|
||||||
LEFT JOIN '._DB_PREFIX_.'store s ON (ss.id_store = s.id_store)
|
'.$this->context->shop->sqlAsso('shop', 's').'
|
||||||
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
||||||
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
||||||
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id.' AND ss.id_shop = '.(int)$this->id_current_shop);
|
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id);
|
||||||
|
|
||||||
foreach ($stores AS &$store)
|
foreach ($stores AS &$store)
|
||||||
$store['has_picture'] = file_exists(_PS_STORE_IMG_DIR_.(int)($store['id_store']).'.jpg');
|
$store['has_picture'] = file_exists(_PS_STORE_IMG_DIR_.(int)($store['id_store']).'.jpg');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Tools::getValue('all') == 1)
|
if (Tools::getValue('all') == 1)
|
||||||
{
|
{
|
||||||
$stores = Db::getInstance()->ExecuteS('
|
$stores = Db::getInstance()->ExecuteS('
|
||||||
SELECT s.*, cl.name country, st.iso_code state
|
SELECT s.*, cl.name country, st.iso_code state
|
||||||
FROM '._DB_PREFIX_.'store_shop ss
|
FROM '._DB_PREFIX_.'store s
|
||||||
LEFT JOIN '._DB_PREFIX_.'store s ON (ss.id_store = s.id_store)
|
'.$this->context->shop->sqlAsso('shop', 's').'
|
||||||
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
||||||
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
||||||
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id.' AND ss.id_shop = '.(int)$this->id_current_shop);
|
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$distance = (int)(Tools::getValue('radius', 100));
|
$distance = (int)(Tools::getValue('radius', 100));
|
||||||
$multiplicator = ($distanceUnit == 'km' ? 6371 : 3959);
|
$multiplicator = ($distanceUnit == 'km' ? 6371 : 3959);
|
||||||
|
|
||||||
$stores = Db::getInstance()->ExecuteS('
|
$stores = Db::getInstance()->ExecuteS('
|
||||||
SELECT s.*, cl.name country, st.iso_code state,
|
SELECT s.*, cl.name country, st.iso_code state,
|
||||||
('.(int)($multiplicator).' * acos(cos(radians('.(float)(Tools::getValue('latitude')).')) * cos(radians(latitude)) * cos(radians(longitude) - radians('.(float)(Tools::getValue('longitude')).')) + sin(radians('.(float)(Tools::getValue('latitude')).')) * sin(radians(latitude)))) distance, cl.id_country id_country
|
('.(int)($multiplicator).' * acos(cos(radians('.(float)(Tools::getValue('latitude')).')) * cos(radians(latitude)) * cos(radians(longitude) - radians('.(float)(Tools::getValue('longitude')).')) + sin(radians('.(float)(Tools::getValue('latitude')).')) * sin(radians(latitude)))) distance, cl.id_country id_country
|
||||||
FROM '._DB_PREFIX_.'store_shop ss
|
FROM '._DB_PREFIX_.'store s
|
||||||
LEFT JOIN '._DB_PREFIX_.'store s ON (ss.id_store = s.id_store)
|
'.$this->context->shop->sqlAsso('shop', 's').'
|
||||||
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
||||||
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
||||||
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id.' AND ss.id_shop = '.(int)$this->id_current_shop.'
|
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||||
HAVING distance < '.(int)($distance).'
|
HAVING distance < '.(int)($distance).'
|
||||||
ORDER BY distance ASC
|
ORDER BY distance ASC
|
||||||
LIMIT 0,20');
|
LIMIT 0,20');
|
||||||
@@ -106,7 +108,7 @@ class StoresControllerCore extends FrontController
|
|||||||
$newnode = $parnode->appendChild($node);
|
$newnode = $parnode->appendChild($node);
|
||||||
$newnode->setAttribute('name', $store['name']);
|
$newnode->setAttribute('name', $store['name']);
|
||||||
$address = $this->_processStoreAddress($store);
|
$address = $this->_processStoreAddress($store);
|
||||||
|
|
||||||
$other = '';
|
$other = '';
|
||||||
if (!empty($store['hours']))
|
if (!empty($store['hours']))
|
||||||
{
|
{
|
||||||
@@ -121,10 +123,10 @@ class StoresControllerCore extends FrontController
|
|||||||
}
|
}
|
||||||
$this->context->smarty->assign('days_datas', $days_datas);
|
$this->context->smarty->assign('days_datas', $days_datas);
|
||||||
$this->context->smarty->assign('id_country', $store['id_country']);
|
$this->context->smarty->assign('id_country', $store['id_country']);
|
||||||
|
|
||||||
$other .= $this->context->smarty->fetch(_PS_THEME_DIR_.'store_infos.tpl');
|
$other .= $this->context->smarty->fetch(_PS_THEME_DIR_.'store_infos.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
$newnode->setAttribute('addressNoHtml', strip_tags(str_replace('<br />', ' ', $address)));
|
$newnode->setAttribute('addressNoHtml', strip_tags(str_replace('<br />', ' ', $address)));
|
||||||
$newnode->setAttribute('address', $address);
|
$newnode->setAttribute('address', $address);
|
||||||
$newnode->setAttribute('other', $other);
|
$newnode->setAttribute('other', $other);
|
||||||
@@ -133,18 +135,18 @@ class StoresControllerCore extends FrontController
|
|||||||
$newnode->setAttribute('has_store_picture', file_exists(_PS_STORE_IMG_DIR_.(int)($store['id_store']).'.jpg'));
|
$newnode->setAttribute('has_store_picture', file_exists(_PS_STORE_IMG_DIR_.(int)($store['id_store']).'.jpg'));
|
||||||
$newnode->setAttribute('lat', (float)($store['latitude']));
|
$newnode->setAttribute('lat', (float)($store['latitude']));
|
||||||
$newnode->setAttribute('lng', (float)($store['longitude']));
|
$newnode->setAttribute('lng', (float)($store['longitude']));
|
||||||
|
|
||||||
if (isset($store['distance']))
|
if (isset($store['distance']))
|
||||||
$newnode->setAttribute('distance', (int)($store['distance']));
|
$newnode->setAttribute('distance', (int)($store['distance']));
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Content-type: text/xml');
|
header('Content-type: text/xml');
|
||||||
die($dom->saveXML());
|
die($dom->saveXML());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->context->smarty->assign('hasStoreIcon', file_exists(dirname(__FILE__).'/../img/logo_stores.gif'));
|
$this->context->smarty->assign('hasStoreIcon', file_exists(dirname(__FILE__).'/../img/logo_stores.gif'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->context->smarty->assign(array('distance_unit' => $distanceUnit, 'simplifiedStoresDiplay' => $simplifiedStoreLocator, 'stores' => $stores, 'mediumSize' => Image::getSize('medium')));
|
$this->context->smarty->assign(array('distance_unit' => $distanceUnit, 'simplifiedStoresDiplay' => $simplifiedStoreLocator, 'stores' => $stores, 'mediumSize' => Image::getSize('medium')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,19 +162,19 @@ class StoresControllerCore extends FrontController
|
|||||||
|
|
||||||
$address_datas = AddressFormat::getOrderedAddressFields($store['id_country'], false, true);
|
$address_datas = AddressFormat::getOrderedAddressFields($store['id_country'], false, true);
|
||||||
$state = (isset($store['id_state'])) ? new State($store['id_state']) : NULL;
|
$state = (isset($store['id_state'])) ? new State($store['id_state']) : NULL;
|
||||||
|
|
||||||
foreach ($address_datas as $data_line)
|
foreach ($address_datas as $data_line)
|
||||||
{
|
{
|
||||||
$data_fields = explode(' ', $data_line);
|
$data_fields = explode(' ', $data_line);
|
||||||
$adr_out = array();
|
$adr_out = array();
|
||||||
|
|
||||||
$data_fields_mod = false;
|
$data_fields_mod = false;
|
||||||
foreach ($data_fields as $field_item)
|
foreach ($data_fields as $field_item)
|
||||||
{
|
{
|
||||||
$field_item = trim($field_item);
|
$field_item = trim($field_item);
|
||||||
if (!isset($ignore_field[$field_item]) && !empty($store[$field_item]) && $store[$field_item] != '')
|
if (!isset($ignore_field[$field_item]) && !empty($store[$field_item]) && $store[$field_item] != '')
|
||||||
{
|
{
|
||||||
$adr_out[] = ($field_item == "city" && $state && isset($state->iso_code) && strlen($state->iso_code)) ?
|
$adr_out[] = ($field_item == "city" && $state && isset($state->iso_code) && strlen($state->iso_code)) ?
|
||||||
$store[$field_item].', '.$state->iso_code : $store[$field_item];
|
$store[$field_item].', '.$state->iso_code : $store[$field_item];
|
||||||
$data_fields_mod = true;
|
$data_fields_mod = true;
|
||||||
}
|
}
|
||||||
@@ -188,13 +190,13 @@ class StoresControllerCore extends FrontController
|
|||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
parent::process();
|
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'defaultLat' => (float)Configuration::get('PS_STORES_CENTER_LAT'),
|
'defaultLat' => (float)Configuration::get('PS_STORES_CENTER_LAT'),
|
||||||
'defaultLong' => (float)Configuration::get('PS_STORES_CENTER_LONG'),
|
'defaultLong' => (float)Configuration::get('PS_STORES_CENTER_LONG'),
|
||||||
'searchUrl' => $this->context->link->getPageLink('stores')
|
'searchUrl' => $this->context->link->getPageLink('stores')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'stores.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
@@ -205,10 +207,4 @@ class StoresControllerCore extends FrontController
|
|||||||
$this->addJS(_THEME_JS_DIR_.'stores.js');
|
$this->addJS(_THEME_JS_DIR_.'stores.js');
|
||||||
$this->addJS('http://maps.google.com/maps/api/js?sensor=true');
|
$this->addJS('http://maps.google.com/maps/api/js?sensor=true');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'stores.tpl');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -28,35 +28,25 @@
|
|||||||
class SupplierControllerCore extends FrontController
|
class SupplierControllerCore extends FrontController
|
||||||
{
|
{
|
||||||
public $php_self = 'supplier';
|
public $php_self = 'supplier';
|
||||||
|
|
||||||
protected $supplier;
|
protected $supplier;
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
{
|
{
|
||||||
parent::setMedia();
|
parent::setMedia();
|
||||||
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canonicalRedirection()
|
public function canonicalRedirection()
|
||||||
{
|
{
|
||||||
if (Configuration::get('PS_CANONICAL_REDIRECT'))
|
|
||||||
{
|
|
||||||
if (Validate::isLoadedObject($this->supplier))
|
if (Validate::isLoadedObject($this->supplier))
|
||||||
{
|
parent::canonicalRedirection($this->context->link->getSupplierLink($this->supplier))
|
||||||
$canonicalURL = $this->context->link->getSupplierLink($this->supplier);
|
|
||||||
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
|
||||||
{
|
|
||||||
header('HTTP/1.0 301 Moved');
|
|
||||||
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_)
|
|
||||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$canonicalURL.'">'.$canonicalURL.'</a>');
|
|
||||||
Tools::redirectLink($canonicalURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public function init()
|
||||||
public function preProcess()
|
|
||||||
{
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
if ($id_supplier = (int)Tools::getValue('id_supplier'))
|
if ($id_supplier = (int)Tools::getValue('id_supplier'))
|
||||||
{
|
{
|
||||||
$this->supplier = new Supplier($id_supplier, $this->context->language->id);
|
$this->supplier = new Supplier($id_supplier, $this->context->language->id);
|
||||||
@@ -70,22 +60,20 @@ class SupplierControllerCore extends FrontController
|
|||||||
else
|
else
|
||||||
$this->canonicalRedirection();
|
$this->canonicalRedirection();
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::preProcess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
if (Validate::isLoadedObject($this->supplier) AND $this->supplier->active AND $this->supplier->isAssociatedToGroupShop())
|
if (Validate::isLoadedObject($this->supplier) AND $this->supplier->active AND $this->supplier->isAssociatedToGroupShop())
|
||||||
{
|
{
|
||||||
$nbProducts = $this->supplier->getProducts($this->supplier->id, NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
|
$nbProducts = $this->supplier->getProducts($this->supplier->id, NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
|
||||||
$this->pagination((int)$nbProducts);
|
$this->pagination((int)$nbProducts);
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'nb_products' => $nbProducts,
|
'nb_products' => $nbProducts,
|
||||||
'products' => $this->supplier->getProducts($this->supplier->id, $this->context->cookie->id_lang, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay),
|
'products' => $this->supplier->getProducts($this->supplier->id, $this->context->cookie->id_lang, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay),
|
||||||
'path' => ($this->supplier->active ? Tools::safeOutput($this->supplier->name) : ''),
|
'path' => ($this->supplier->active ? Tools::safeOutput($this->supplier->name) : ''),
|
||||||
'supplier' => $this->supplier,
|
'supplier' => $this->supplier,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
elseif (!Tools::getValue('id_supplier'))
|
elseif (!Tools::getValue('id_supplier'))
|
||||||
{
|
{
|
||||||
@@ -94,7 +82,7 @@ class SupplierControllerCore extends FrontController
|
|||||||
$result = Supplier::getSuppliers(true, $this->context->language->id, true);
|
$result = Supplier::getSuppliers(true, $this->context->language->id, true);
|
||||||
$nbProducts = count($result);
|
$nbProducts = count($result);
|
||||||
$this->pagination($nbProducts);
|
$this->pagination($nbProducts);
|
||||||
|
|
||||||
$suppliers = Supplier::getSuppliers(true, $this->context->language->id, true, $this->p, $this->n);
|
$suppliers = Supplier::getSuppliers(true, $this->context->language->id, true, $this->p, $this->n);
|
||||||
foreach ($suppliers AS &$row)
|
foreach ($suppliers AS &$row)
|
||||||
$row['image'] = (!file_exists(_PS_SUPP_IMG_DIR_.'/'.$row['id_supplier'].'-medium.jpg')) ? $this->context->language->iso_code.'-default' : $row['id_supplier'];;
|
$row['image'] = (!file_exists(_PS_SUPP_IMG_DIR_.'/'.$row['id_supplier'].'-medium.jpg')) ? $this->context->language->iso_code.'-default' : $row['id_supplier'];;
|
||||||
@@ -110,21 +98,16 @@ class SupplierControllerCore extends FrontController
|
|||||||
else
|
else
|
||||||
$this->context->smarty->assign('nbSuppliers', 0);
|
$this->context->smarty->assign('nbSuppliers', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->supplier)
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'supplier.tpl');
|
||||||
|
else
|
||||||
|
$this->setTemplate(_PS_THEME_DIR_.'supplier-list.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayHeader()
|
public function displayHeader()
|
||||||
{
|
{
|
||||||
parent::displayHeader();
|
parent::displayHeader();
|
||||||
$this->productSort();
|
$this->productSort();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayContent()
|
|
||||||
{
|
|
||||||
parent::displayContent();
|
|
||||||
if ($this->supplier)
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'supplier.tpl');
|
|
||||||
else
|
|
||||||
$this->context->smarty->display(_PS_THEME_DIR_.'supplier-list.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Open Software License (OSL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/osl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision$
|
||||||
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*/
|
||||||
|
|
||||||
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||||
|
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||||
|
|
||||||
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||||
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||||
|
header("Pragma: no-cache");
|
||||||
|
|
||||||
|
header("Location: ../");
|
||||||
|
exit;
|
||||||
@@ -55,7 +55,7 @@ class BlockManufacturer extends Module
|
|||||||
function hookLeftColumn($params)
|
function hookLeftColumn($params)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->smartyAssign(array(
|
||||||
'manufacturers' => Manufacturer::getManufacturers(),
|
'manufacturers' => Manufacturer::getManufacturers(),
|
||||||
'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
|
'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
|
||||||
'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'),
|
'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{*
|
{*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -26,24 +26,24 @@
|
|||||||
|
|
||||||
<!-- Block manufacturers module -->
|
<!-- Block manufacturers module -->
|
||||||
<div id="manufacturers_block_left" class="block blockmanufacturer">
|
<div id="manufacturers_block_left" class="block blockmanufacturer">
|
||||||
<h4>{if $display_link_manufacturer}<a href="{$link->getPageLink('manufacturer')}" title="{l s='Manufacturers' mod='blockmanufacturer'}">{/if}{l s='Manufacturers' mod='blockmanufacturer'}{if $display_link_manufacturer}</a>{/if}</h4>
|
<h4>{if $blockmanufacturer_display_link_manufacturer}<a href="{$link->getPageLink('manufacturer')}" title="{l s='Manufacturers' mod='blockmanufacturer'}">{/if}{l s='Manufacturers' mod='blockmanufacturer'}{if $blockmanufacturer_display_link_manufacturer}</a>{/if}</h4>
|
||||||
<div class="block_content">
|
<div class="block_content">
|
||||||
{if $manufacturers}
|
{if $blockmanufacturer_manufacturers}
|
||||||
{if $text_list}
|
{if $blockmanufacturer_text_list}
|
||||||
<ul class="bullet">
|
<ul class="bullet">
|
||||||
{foreach from=$manufacturers item=manufacturer name=manufacturer_list}
|
{foreach from=$blockmanufacturer_manufacturers item=manufacturer name=manufacturer_list}
|
||||||
{if $smarty.foreach.manufacturer_list.iteration <= $text_list_nb}
|
{if $smarty.foreach.manufacturer_list.iteration <= $blockmanufacturer_text_list_nb}
|
||||||
<li class="{if $smarty.foreach.manufacturer_list.last}last_item{elseif $smarty.foreach.manufacturer_list.first}first_item{else}item{/if}"><a href="{$link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)}" title="{l s='More about' mod='blockmanufacturer'} {$manufacturer.name}">{$manufacturer.name|escape:'htmlall':'UTF-8'}</a></li>
|
<li class="{if $smarty.foreach.manufacturer_list.last}last_item{elseif $smarty.foreach.manufacturer_list.first}first_item{else}item{/if}"><a href="{$link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)}" title="{l s='More about' mod='blockmanufacturer'} {$manufacturer.name}">{$manufacturer.name|escape:'htmlall':'UTF-8'}</a></li>
|
||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</ul>
|
</ul>
|
||||||
{/if}
|
{/if}
|
||||||
{if $form_list}
|
{if $blockmanufacturer_form_list}
|
||||||
<form action="{$smarty.server.SCRIPT_NAME}" method="get">
|
<form action="{$smarty.server.SCRIPT_NAME}" method="get">
|
||||||
<p>
|
<p>
|
||||||
<select id="manufacturer_list" onchange="autoUrl('manufacturer_list', '');">
|
<select id="manufacturer_list" onchange="autoUrl('manufacturer_list', '');">
|
||||||
<option value="0">{l s='All manufacturers' mod='blockmanufacturer'}</option>
|
<option value="0">{l s='All manufacturers' mod='blockmanufacturer'}</option>
|
||||||
{foreach from=$manufacturers item=manufacturer}
|
{foreach from=$blockmanufacturer_manufacturers item=manufacturer}
|
||||||
<option value="{$link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)}">{$manufacturer.name|escape:'htmlall':'UTF-8'}</option>
|
<option value="{$link->getmanufacturerLink($manufacturer.id_manufacturer, $manufacturer.link_rewrite)}">{$manufacturer.name|escape:'htmlall':'UTF-8'}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -60,10 +60,11 @@ class BlockMyAccount extends Module
|
|||||||
{
|
{
|
||||||
if (!$this->context->customer->isLogged())
|
if (!$this->context->customer->isLogged())
|
||||||
return false;
|
return false;
|
||||||
$this->context->smarty->assign(array(
|
|
||||||
'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')),
|
$this->smartyAssign(array(
|
||||||
'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN')),
|
'voucherAllowed' => (int)Configuration::get('PS_VOUCHERS'),
|
||||||
'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock')
|
'returnAllowed' => (int)Configuration::get('PS_ORDER_RETURN'),
|
||||||
|
'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock'),
|
||||||
));
|
));
|
||||||
return $this->display(__FILE__, $this->name.'.tpl');
|
return $this->display(__FILE__, $this->name.'.tpl');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{*
|
{*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -30,12 +30,12 @@
|
|||||||
<div class="block_content">
|
<div class="block_content">
|
||||||
<ul class="bullet">
|
<ul class="bullet">
|
||||||
<li><a href="{$link->getPageLink('history', true)}" title="">{l s='My orders' mod='blockmyaccount'}</a></li>
|
<li><a href="{$link->getPageLink('history', true)}" title="">{l s='My orders' mod='blockmyaccount'}</a></li>
|
||||||
{if $returnAllowed}<li><a href="{$link->getPageLink('order-follow', true)}" title="">{l s='My merchandise returns' mod='blockmyaccount'}</a></li>{/if}
|
{if $blockmyaccount_returnAllowed}<li><a href="{$link->getPageLink('order-follow', true)}" title="">{l s='My merchandise returns' mod='blockmyaccount'}</a></li>{/if}
|
||||||
<li><a href="{$link->getPageLink('order-slip', true)}" title="">{l s='My credit slips' mod='blockmyaccount'}</a></li>
|
<li><a href="{$link->getPageLink('order-slip', true)}" title="">{l s='My credit slips' mod='blockmyaccount'}</a></li>
|
||||||
<li><a href="{$link->getPageLink('addresses', true)}" title="">{l s='My addresses' mod='blockmyaccount'}</a></li>
|
<li><a href="{$link->getPageLink('addresses', true)}" title="">{l s='My addresses' mod='blockmyaccount'}</a></li>
|
||||||
<li><a href="{$link->getPageLink('identity', true)}" title="">{l s='My personal info' mod='blockmyaccount'}</a></li>
|
<li><a href="{$link->getPageLink('identity', true)}" title="">{l s='My personal info' mod='blockmyaccount'}</a></li>
|
||||||
{if $voucherAllowed}<li><a href="{$link->getPageLink('discount', true)}" title="">{l s='My vouchers' mod='blockmyaccount'}</a></li>{/if}
|
{if $blockmyaccount_voucherAllowed}<li><a href="{$link->getPageLink('discount', true)}" title="">{l s='My vouchers' mod='blockmyaccount'}</a></li>{/if}
|
||||||
{$HOOK_BLOCK_MY_ACCOUNT}
|
{$blockmyaccount_HOOK_BLOCK_MY_ACCOUNT}
|
||||||
</ul>
|
</ul>
|
||||||
<p class="logout"><a href="{$link->getPageLink('index', true, NULL, "mylogout")}" title="{l s='Sign out' mod='blockmyaccount'}">{l s='Sign out' mod='blockmyaccount'}</a></p>
|
<p class="logout"><a href="{$link->getPageLink('index', true, NULL, "mylogout")}" title="{l s='Sign out' mod='blockmyaccount'}">{l s='Sign out' mod='blockmyaccount'}</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -152,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_.'category_group` cg ON (cg.`id_category` = cp.`id_category`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer_group` cug ON (cug.`id_group` = cg.`id_group`)
|
LEFT JOIN `'._DB_PREFIX_.'customer_group` cug ON (cug.`id_group` = cg.`id_group`)
|
||||||
WHERE p.`id_product` = '.(int)($id_product).'
|
WHERE p.`id_product` = '.(int)($id_product).'
|
||||||
'.($this->context->customer->id ? 'AND cug.`id_customer` = '.(int)$this->context->customer->id :
|
'.($this->context->customer->id ? 'AND cug.`id_customer` = '.(int)$this->context->customer->id :
|
||||||
'AND cg.`id_group` = 1')
|
'AND cg.`id_group` = 1')
|
||||||
);
|
);
|
||||||
if ($result['total'])
|
if ($result['total'])
|
||||||
@@ -166,7 +166,7 @@ class BlockViewed extends Module
|
|||||||
if (!sizeof($productsViewedObj))
|
if (!sizeof($productsViewedObj))
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->smartyAssign(array(
|
||||||
'productsViewedObj' => $productsViewedObj,
|
'productsViewedObj' => $productsViewedObj,
|
||||||
'mediumSize' => Image::getSize('medium')));
|
'mediumSize' => Image::getSize('medium')));
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{*
|
{*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -29,9 +29,9 @@
|
|||||||
<h4>{l s='Viewed products' mod='blockviewed'}</h4>
|
<h4>{l s='Viewed products' mod='blockviewed'}</h4>
|
||||||
<div class="block_content">
|
<div class="block_content">
|
||||||
<ul class="products clearfix">
|
<ul class="products clearfix">
|
||||||
{foreach from=$productsViewedObj item=viewedProduct name=myLoop}
|
{foreach from=$blockviewed_productsViewedObj item=viewedProduct name=myLoop}
|
||||||
<li class="clearfix{if $smarty.foreach.myLoop.last} last_item{elseif $smarty.foreach.myLoop.first} first_item{else} item{/if}">
|
<li class="clearfix{if $smarty.foreach.myLoop.last} last_item{elseif $smarty.foreach.myLoop.first} first_item{else} item{/if}">
|
||||||
<a href="{$link->getProductLink($viewedProduct->id, $viewedProduct->link_rewrite, $viewedProduct->category_rewrite)}" title="{l s='More about' mod='blockviewed'} {$viewedProduct->name|escape:html:'UTF-8'}"><img src="{$link->getImageLink($viewedProduct->link_rewrite, $viewedProduct->cover, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$viewedProduct->legend|escape:html:'UTF-8'}" /></a>
|
<a href="{$link->getProductLink($viewedProduct->id, $viewedProduct->link_rewrite, $viewedProduct->category_rewrite)}" title="{l s='More about' mod='blockviewed'} {$viewedProduct->name|escape:html:'UTF-8'}"><img src="{$link->getImageLink($viewedProduct->link_rewrite, $viewedProduct->cover, 'medium')}" height="{$blockviewed_mediumSize.height}" width="{$blockviewed_mediumSize.width}" alt="{$viewedProduct->legend|escape:html:'UTF-8'}" /></a>
|
||||||
<h5><a href="{$link->getProductLink($viewedProduct->id, $viewedProduct->link_rewrite, $viewedProduct->category_rewrite)}" title="{l s='More about' mod='blockviewed'} {$viewedProduct->name|escape:html:'UTF-8'}">{$viewedProduct->name|truncate:14:'...'|escape:html:'UTF-8'}</a></h5>
|
<h5><a href="{$link->getProductLink($viewedProduct->id, $viewedProduct->link_rewrite, $viewedProduct->category_rewrite)}" title="{l s='More about' mod='blockviewed'} {$viewedProduct->name|escape:html:'UTF-8'}">{$viewedProduct->name|truncate:14:'...'|escape:html:'UTF-8'}</a></h5>
|
||||||
<p>{$viewedProduct->description_short|strip_tags:'UTF-8'|truncate:44}<a href="{$link->getProductLink($viewedProduct->id, $viewedProduct->link_rewrite, $viewedProduct->category_rewrite)}" title="{l s='More about' mod='blockviewed'} {$viewedProduct->name|escape:html:'UTF-8'}"><img src="{$img_dir}bullet.gif" alt=">>" width="10" height="7" /></a></p>
|
<p>{$viewedProduct->description_short|strip_tags:'UTF-8'|truncate:44}<a href="{$link->getProductLink($viewedProduct->id, $viewedProduct->link_rewrite, $viewedProduct->category_rewrite)}" title="{l s='More about' mod='blockviewed'} {$viewedProduct->name|escape:html:'UTF-8'}"><img src="{$img_dir}bullet.gif" alt=">>" width="10" height="7" /></a></p>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Open Software License (OSL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/osl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision$
|
||||||
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*/
|
||||||
|
|
||||||
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||||
|
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||||
|
|
||||||
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||||
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||||
|
header("Pragma: no-cache");
|
||||||
|
|
||||||
|
header("Location: ../");
|
||||||
|
exit;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{*
|
{*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{$HOOK_HEADER}
|
{$HOOK_HEADER}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body {if $page_name}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if}>
|
<body {if $page_name}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if}>
|
||||||
{if !$content_only}
|
{if !$content_only}
|
||||||
{if isset($restricted_country_mode) && $restricted_country_mode}
|
{if isset($restricted_country_mode) && $restricted_country_mode}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{*
|
{*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} /></a>
|
<a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} /></a>
|
||||||
<h3>{if isset($product.new) && $product.new == 1}<span class="new">{l s='New'}</span>{/if}<a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></h3>
|
<h3>{if isset($product.new) && $product.new == 1}<span class="new">{l s='New'}</span>{/if}<a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></h3>
|
||||||
<p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|truncate:360:'...'|strip_tags:'UTF-8'|escape:'htmlall':'UTF-8'}">{$product.description_short|truncate:360:'...'|strip_tags:'UTF-8'}</a></p>
|
<p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|truncate:360:'...'|strip_tags:'UTF-8'|escape:'htmlall':'UTF-8'}">{$product.description_short|truncate:360:'...'|strip_tags:'UTF-8'}</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="right_block">
|
<div class="right_block">
|
||||||
{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="on_sale">{l s='On sale!'}</span>
|
{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="on_sale">{l s='On sale!'}</span>
|
||||||
{elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount">{l s='Reduced price!'}</span>{/if}
|
{elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount">{l s='Reduced price!'}</span>{/if}
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
|
<a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
|
||||||
{if isset($comparator_max_item) && $comparator_max_item}
|
{if isset($comparator_max_item) && $comparator_max_item}
|
||||||
<p class="compare"><input type="checkbox" class="comparator" id="comparator_item_{$product.id_product}" value="comparator_item_{$product.id_product}" {if isset($compareProducts) && in_array($product.id_product, $compareProducts)}checked{/if}/> <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label></p>
|
<p class="compare"><input type="checkbox" class="comparator" id="comparator_item_{$product.id_product}" value="comparator_item_{$product.id_product}" {if isset($compareProducts) && in_array($product.id_product, $compareProducts)}checked{/if}/> <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label></p>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|||||||
Reference in New Issue
Block a user