// MERGE with 1.4 r7770
This commit is contained in:
@@ -24,24 +24,20 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if(Configuration::get('VATNUMBER_MANAGEMENT') AND file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php'))
|
||||
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
|
||||
|
||||
class AddressControllerCore extends FrontController
|
||||
{
|
||||
public $auth = true;
|
||||
public $guestAllowed = true;
|
||||
public $php_self = 'address.php';
|
||||
public $authRedirection = 'addresses.php';
|
||||
public $ssl = true;
|
||||
|
||||
protected $_address;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->auth = true;
|
||||
$this->guestAllowed = true;
|
||||
$this->php_self = 'address.php';
|
||||
$this->authRedirection = 'addresses.php';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function preProcess()
|
||||
{
|
||||
parent::preProcess();
|
||||
@@ -274,7 +270,7 @@ class AddressControllerCore extends FrontController
|
||||
|
||||
$id_country = is_null($this->_address)? 0 : (int)$this->_address->id_country;
|
||||
|
||||
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($id_country, $split_all = true);
|
||||
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($id_country, true, true);
|
||||
$this->context->smarty->assign('ordered_adr_fields', $dlv_adr_fields);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,15 +27,10 @@
|
||||
|
||||
class AddressesControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->auth = true;
|
||||
$this->php_self = 'addresses.php';
|
||||
$this->authRedirection = 'addresses.php';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $auth = true;
|
||||
public $php_self = 'addresses.php';
|
||||
public $authRedirection = 'addresses.php';
|
||||
public $ssl = true;
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
@@ -64,16 +59,12 @@ class AddressesControllerCore extends FrontController
|
||||
{
|
||||
$address = new Address($addressDetailed['id_address']);
|
||||
|
||||
$multipleAddressesFormated[$total]['ordered'] = AddressFormat::getOrderedAddressFields($addressDetailed['id_country']);
|
||||
$multipleAddressesFormated[$total]['formated'] = AddressFormat::getFormattedAddressFieldsValues(
|
||||
$address,
|
||||
$multipleAddressesFormated[$total]['ordered']);
|
||||
$multipleAddressesFormated[$total]['object'] = $addressDetailed;
|
||||
$multipleAddressesFormated[$total] = AddressFormat::getFormattedLayoutData($address);
|
||||
unset($address);
|
||||
++$total;
|
||||
|
||||
// Retro theme < 1.4.2
|
||||
$ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country']);
|
||||
$ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country'], false, true);
|
||||
}
|
||||
|
||||
// Retro theme 1.4.2
|
||||
|
||||
@@ -27,13 +27,8 @@
|
||||
|
||||
class AuthControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->ssl = true;
|
||||
$this->php_self = 'authentication.php';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $ssl = true;
|
||||
public $php_self = 'authentication.php';
|
||||
|
||||
public function preProcess()
|
||||
{
|
||||
@@ -388,7 +383,7 @@ class AuthControllerCore extends FrontController
|
||||
protected function processAddressFormat()
|
||||
{
|
||||
$addressItems = array();
|
||||
$addressFormat = AddressFormat::getOrderedAddressFields(Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
$addressFormat = AddressFormat::getOrderedAddressFields(Configuration::get('PS_COUNTRY_DEFAULT'), false, true);
|
||||
$requireFormFieldsList = AddressFormat::$requireFormFieldsList;
|
||||
|
||||
foreach ($addressFormat as $addressline)
|
||||
|
||||
@@ -27,12 +27,7 @@
|
||||
|
||||
class BestSalesControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->php_self = 'best-sales.php';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $php_self = 'best-sales.php';
|
||||
|
||||
public function process()
|
||||
{
|
||||
|
||||
@@ -66,20 +66,6 @@ class CmsControllerCore extends FrontController
|
||||
$this->assignCase = 2;
|
||||
else
|
||||
Tools::redirect('index.php?controller=404');
|
||||
|
||||
if((int)(Configuration::get('PS_REWRITING_SETTINGS')))
|
||||
{
|
||||
$rewrite_infos = (isset($id_cms) AND !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
|
||||
$default_rewrite = array();
|
||||
foreach ($rewrite_infos AS $infos)
|
||||
{
|
||||
$arr_link = (isset($id_cms) AND !isset($id_cms_category)) ?
|
||||
$this->context->link->getCMSLink($id_cms, $infos['link_rewrite'], $this->ssl, $infos['id_lang']) :
|
||||
$this->context->link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
|
||||
$default_rewrite[$infos['id_lang']] = $arr_link;
|
||||
}
|
||||
$this->context->smarty->assign('lang_rewrite_urls', $default_rewrite);
|
||||
}
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
|
||||
class CartControllerCore extends FrontController
|
||||
{
|
||||
public $php_self = 'cart.php';
|
||||
|
||||
// This is not a public page, so the canonical redirection is disabled
|
||||
public function canonicalRedirection(){}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->init();
|
||||
@@ -85,7 +90,7 @@ class CartControllerCore extends FrontController
|
||||
if (Configuration::get('PS_TOKEN_ENABLE') == 1 &&
|
||||
strcasecmp(Tools::getToken(false), strval(Tools::getValue('token'))) &&
|
||||
$this->context->customer->isLogged() === true)
|
||||
$this->errors[] = Tools::displayError('Invalid token');
|
||||
$this->errors[] = Tools::displayError('Invalid token');
|
||||
|
||||
// Update the cart ONLY if $this->cookies are available, in order to avoid ghost carts created by bots
|
||||
if (($add OR Tools::getIsset('update') OR $delete) AND isset($_COOKIE[$this->context->cookie->getName()]))
|
||||
|
||||
@@ -73,20 +73,8 @@ class CategoryControllerCore extends FrontController
|
||||
}
|
||||
|
||||
parent::preProcess();
|
||||
|
||||
if((int)(Configuration::get('PS_REWRITING_SETTINGS')))
|
||||
if ($id_category = (int)Tools::getValue('id_category'))
|
||||
{
|
||||
$rewrite_infos = Category::getUrlRewriteInformations((int)$id_category);
|
||||
|
||||
$default_rewrite = array();
|
||||
foreach ($rewrite_infos AS $infos)
|
||||
$default_rewrite[$infos['id_lang']] = $this->context->link->getCategoryLink((int)$id_category, $infos['link_rewrite'], $infos['id_lang']);
|
||||
|
||||
$this->context->smarty->assign('lang_rewrite_urls', $default_rewrite);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function process()
|
||||
{
|
||||
parent::process();
|
||||
@@ -151,6 +139,11 @@ class CategoryControllerCore extends FrontController
|
||||
'thumbSceneSize' => Image::getSize('thumb_scene'),
|
||||
'homeSize' => Image::getSize('home')
|
||||
));
|
||||
|
||||
if (isset(self::$cookie->id_customer))
|
||||
self::$smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts((int)self::$cookie->id_customer));
|
||||
elseif (isset(self::$cookie->id_guest))
|
||||
self::$smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts((int)self::$cookie->id_guest));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,27 +27,80 @@
|
||||
|
||||
class CompareControllerCore extends FrontController
|
||||
{
|
||||
public $php_self = 'products-comparison.php';
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
$this->addCSS(_THEME_CSS_DIR_.'/comparator.css');
|
||||
|
||||
if (Configuration::get('PS_COMPARATOR_MAX_ITEM') > 0)
|
||||
Tools::addJS(_THEME_JS_DIR_.'products-comparison.js');
|
||||
}
|
||||
|
||||
public function preProcess()
|
||||
{
|
||||
parent::preProcess();
|
||||
|
||||
//Add or remove product with Ajax
|
||||
if (Tools::getValue('ajax') AND Tools::getValue('id_product') AND Tools::getValue('action'))
|
||||
{
|
||||
if (Tools::getValue('action') == 'add')
|
||||
{
|
||||
if (isset(self::$cookie->id_customer))
|
||||
{
|
||||
if(CompareProduct::getCustomerNumberProducts(self::$cookie->id_customer) < Configuration::get('PS_COMPARATOR_MAX_ITEM'))
|
||||
CompareProduct::addCustomerCompareProduct((int)self::$cookie->id_customer, (int)Tools::getValue('id_product'));
|
||||
else
|
||||
die('0');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((isset(self::$cookie->id_guest) AND CompareProduct::getGuestNumberProducts(self::$cookie->id_guest) < Configuration::get('PS_COMPARATOR_MAX_ITEM')))
|
||||
CompareProduct::addGuestCompareProduct((int)self::$cookie->id_guest, (int)Tools::getValue('id_product'));
|
||||
else
|
||||
die('0');
|
||||
}
|
||||
}
|
||||
elseif (Tools::getValue('action') == 'remove')
|
||||
{
|
||||
if (isset(self::$cookie->id_customer))
|
||||
CompareProduct::removeCustomerCompareProduct((int)self::$cookie->id_customer, (int)Tools::getValue('id_product'));
|
||||
elseif (isset(self::$cookie->id_guest))
|
||||
CompareProduct::removeGuestCompareProduct((int)self::$cookie->id_guest, (int)Tools::getValue('id_product'));
|
||||
else
|
||||
die('0');
|
||||
}
|
||||
else
|
||||
die('0');
|
||||
|
||||
die('1');
|
||||
}
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
parent::process();
|
||||
|
||||
//Clean compare product table
|
||||
CompareProduct::cleanCompareProducts('week');
|
||||
|
||||
$hasProduct = false;
|
||||
$product_list = Tools::getValue('compare_product_list');
|
||||
$postProducts = isset($product_list) ? rtrim($product_list,'|') : '';
|
||||
|
||||
if (!Configuration::get('PS_COMPARATOR_MAX_ITEM'))
|
||||
return Tools::redirect('index.php?controller=404');
|
||||
|
||||
if ($postProducts)
|
||||
{
|
||||
if ($product_list = Tools::getValue('compare_product_list') AND $postProducts = (isset($product_list) ? rtrim($product_list,'|') : ''))
|
||||
$ids = array_unique(explode('|', $postProducts));
|
||||
elseif (isset(self::$cookie->id_customer))
|
||||
$ids = CompareProduct::getCustomerCompareProducts(self::$cookie->id_customer);
|
||||
elseif(isset(self::$cookie->id_guest))
|
||||
$ids = CompareProduct::getGuestCompareProducts(self::$cookie->id_guest);
|
||||
else
|
||||
$ids = null;
|
||||
|
||||
if ($ids)
|
||||
{
|
||||
if (sizeof($ids) > 0)
|
||||
{
|
||||
if (sizeof($ids) > Configuration::get('PS_COMPARATOR_MAX_ITEM'))
|
||||
|
||||
@@ -31,8 +31,6 @@ class ContactControllerCore extends FrontController
|
||||
{
|
||||
$this->php_self = 'contact';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function preProcess()
|
||||
|
||||
@@ -27,15 +27,10 @@
|
||||
|
||||
class DiscountControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->auth = true;
|
||||
$this->php_self = 'discount.php';
|
||||
$this->authRedirection = 'discount.php';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $auth = true;
|
||||
public $php_self = 'discount.php';
|
||||
public $authRedirection = 'discount.php';
|
||||
public $ssl = true;
|
||||
|
||||
public function process()
|
||||
{
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
class GuestTrackingControllerCore extends FrontController
|
||||
{
|
||||
public $php_self = 'guest-tracking.php';
|
||||
|
||||
public function preProcess()
|
||||
{
|
||||
parent::preProcess();
|
||||
@@ -136,9 +138,8 @@ class GuestTrackingControllerCore extends FrontController
|
||||
|
||||
private function processAddressFormat(Address $delivery, Address $invoice)
|
||||
{
|
||||
|
||||
$inv_adr_fields = AddressFormat::getOrderedAddressFields($invoice->id_country);
|
||||
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($delivery->id_country);
|
||||
$inv_adr_fields = AddressFormat::getOrderedAddressFields($invoice->id_country, false, true);
|
||||
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($delivery->id_country, false, true);
|
||||
|
||||
$this->context->smarty->assign('inv_adr_fields', $inv_adr_fields);
|
||||
$this->context->smarty->assign('dlv_adr_fields', $dlv_adr_fields);
|
||||
|
||||
@@ -27,15 +27,10 @@
|
||||
|
||||
class HistoryControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->auth = true;
|
||||
$this->php_self = 'history.php';
|
||||
$this->authRedirection = 'history.php';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $auth = true;
|
||||
public $php_self = 'history.php';
|
||||
public $authRedirection = 'history.php';
|
||||
public $ssl = true;
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
|
||||
@@ -27,15 +27,10 @@
|
||||
|
||||
class IdentityControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->auth = true;
|
||||
$this->php_self = 'identity.php';
|
||||
$this->authRedirection = 'identity.php';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $auth = true;
|
||||
public $php_self = 'identity.php';
|
||||
public $authRedirection = 'identity.php';
|
||||
public $ssl = true;
|
||||
|
||||
public function preProcess()
|
||||
{
|
||||
|
||||
@@ -27,15 +27,10 @@
|
||||
|
||||
class MyAccountControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->auth = true;
|
||||
$this->php_self = 'my-account.php';
|
||||
$this->authRedirection = 'my-account.php';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $auth = true;
|
||||
public $php_self = 'my-account.php';
|
||||
public $authRedirection = 'my-account.php';
|
||||
public $ssl = true;
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
|
||||
@@ -27,12 +27,7 @@
|
||||
|
||||
class NewProductsControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->php_self = 'new-products.php';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $php_self = 'new-products.php';
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
|
||||
@@ -27,18 +27,13 @@
|
||||
|
||||
class OrderConfirmationControllerCore extends FrontController
|
||||
{
|
||||
public $php_self = 'order-confirmation.php';
|
||||
|
||||
public $id_cart;
|
||||
public $id_module;
|
||||
public $id_order;
|
||||
public $secure_key;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->php_self = 'order-confirmation.php';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function preProcess()
|
||||
{
|
||||
parent::preProcess();
|
||||
|
||||
@@ -58,7 +58,7 @@ class OrderControllerCore extends ParentOrderController
|
||||
|
||||
$orderTotal = $this->context->cart->getOrderTotal();
|
||||
$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
|
||||
if ($this->context->cart->getOrderTotal(false) < $minimalPurchase && $this->step != -1)
|
||||
if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase && $this->step != -1)
|
||||
{
|
||||
$this->step = 0;
|
||||
$this->errors[] = Tools::displayError('A minimum purchase total of').' '.Tools::displayPrice($minimalPurchase, $currency).
|
||||
@@ -131,8 +131,8 @@ class OrderControllerCore extends ParentOrderController
|
||||
$addressDelivery = new Address((int)($this->context->cart->id_address_delivery));
|
||||
$addressInvoice = new Address((int)($this->context->cart->id_address_invoice));
|
||||
|
||||
$invoiceAddressFields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
|
||||
$deliveryAddressFields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
|
||||
$invoiceAddressFields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country, false, true);
|
||||
$deliveryAddressFields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country, false, true);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'inv_adr_fields' => $invoiceAddressFields,
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
|
||||
class OrderDetailControllerCore extends FrontController
|
||||
{
|
||||
public $auth = true;
|
||||
public $authRedirection = 'history.php';
|
||||
public $ssl = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->auth = true;
|
||||
$this->authRedirection = 'history.php';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
@@ -146,6 +146,7 @@ class OrderDetailControllerCore extends FrontController
|
||||
'messages' => Message::getMessagesByOrderId((int)($order->id)),
|
||||
'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_,
|
||||
'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_,
|
||||
'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'),
|
||||
'use_tax' => Configuration::get('PS_TAX'),
|
||||
'group_use_tax' => (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC),
|
||||
'customizedDatas' => $customizedDatas));
|
||||
|
||||
@@ -27,15 +27,10 @@
|
||||
|
||||
class OrderFollowControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->auth = true;
|
||||
$this->php_self = 'order-follow.php';
|
||||
$this->authRedirection = 'order-follow.php';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $auth = true;
|
||||
public $php_self = 'order-follow.php';
|
||||
public $authRedirection = 'order-follow.php';
|
||||
public $ssl = true;
|
||||
|
||||
public function preProcess()
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ ControllerFactory::includeController('ParentOrderController');
|
||||
|
||||
class OrderOpcControllerCore extends ParentOrderController
|
||||
{
|
||||
public $php_self = 'order-opc.php';
|
||||
public $isLogged;
|
||||
|
||||
public function preProcess()
|
||||
@@ -156,45 +157,45 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
case 'updateAddressesSelected':
|
||||
if ($this->context->cookie->isLogged(true))
|
||||
{
|
||||
$id_address_delivery = (int)(Tools::getValue('id_address_delivery'));
|
||||
$id_address_invoice = (int)(Tools::getValue('id_address_invoice'));
|
||||
$address_delivery = new Address((int)(Tools::getValue('id_address_delivery')));
|
||||
$address_invoice = ((int)(Tools::getValue('id_address_delivery')) == (int)(Tools::getValue('id_address_invoice')) ? $address_delivery : new Address((int)(Tools::getValue('id_address_invoice'))));
|
||||
$id_address_delivery = (int)(Tools::getValue('id_address_delivery'));
|
||||
$id_address_invoice = (int)(Tools::getValue('id_address_invoice'));
|
||||
$address_delivery = new Address((int)(Tools::getValue('id_address_delivery')));
|
||||
$address_invoice = ((int)(Tools::getValue('id_address_delivery')) == (int)(Tools::getValue('id_address_invoice')) ? $address_delivery : new Address((int)(Tools::getValue('id_address_invoice'))));
|
||||
if ($address_delivery->id_customer != $this->context->customer->id || $address_invoice->id_customer != $this->context->customer->id)
|
||||
$this->errors[] = Tools::displayError('This address is not yours.');
|
||||
elseif (!Address::isCountryActiveById((int)(Tools::getValue('id_address_delivery'))))
|
||||
$this->errors[] = Tools::displayError('This address is not in a valid area.');
|
||||
elseif (!Validate::isLoadedObject($address_delivery) OR !Validate::isLoadedObject($address_invoice) OR $address_invoice->deleted OR $address_delivery->deleted)
|
||||
$this->errors[] = Tools::displayError('This address is invalid.');
|
||||
else
|
||||
{
|
||||
$this->context->cart->id_address_delivery = (int)(Tools::getValue('id_address_delivery'));
|
||||
$this->context->cart->id_address_invoice = Tools::isSubmit('same') ? $this->context->cart->id_address_delivery : (int)(Tools::getValue('id_address_invoice'));
|
||||
if (!$this->context->cart->update())
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating your cart.');
|
||||
|
||||
if (!sizeof($this->errors))
|
||||
$this->errors[] = Tools::displayError('This address is not in a valid area.');
|
||||
elseif (!Validate::isLoadedObject($address_delivery) OR !Validate::isLoadedObject($address_invoice) OR $address_invoice->deleted OR $address_delivery->deleted)
|
||||
$this->errors[] = Tools::displayError('This address is invalid.');
|
||||
else
|
||||
{
|
||||
if ($this->context->customer->id)
|
||||
$groups = $this->context->customer->getGroups();
|
||||
else
|
||||
$groups = array(1);
|
||||
$result = $this->_getCarrierList();
|
||||
// Wrapping fees
|
||||
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
|
||||
$wrapping_fees_tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
|
||||
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
|
||||
$result = array_merge($result, array(
|
||||
'summary' => $this->context->cart->getSummaryDetails(),
|
||||
'HOOK_TOP_PAYMENT' => Module::hookExec('paymentTop'),
|
||||
'HOOK_PAYMENT' => $this->_getPaymentMethods(),
|
||||
'gift_price' => Tools::displayPrice(Tools::convertPrice(Product::getTaxCalculationMethod() == 1 ? $wrapping_fees : $wrapping_fees_tax_inc, new Currency((int)($this->context->cookie->id_currency))))
|
||||
));
|
||||
die(Tools::jsonEncode($result));
|
||||
$this->context->cart->id_address_delivery = (int)(Tools::getValue('id_address_delivery'));
|
||||
$this->context->cart->id_address_invoice = Tools::isSubmit('same') ? $this->context->cart->id_address_delivery : (int)(Tools::getValue('id_address_invoice'));
|
||||
if (!$this->context->cart->update())
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating your cart.');
|
||||
|
||||
if (!sizeof($this->errors))
|
||||
{
|
||||
if ($this->context->customer->id)
|
||||
$groups = $this->context->customer->getGroups();
|
||||
else
|
||||
$groups = array(1);
|
||||
$result = $this->_getCarrierList();
|
||||
// Wrapping fees
|
||||
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
|
||||
$wrapping_fees_tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
|
||||
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
|
||||
$result = array_merge($result, array(
|
||||
'summary' => $this->context->cart->getSummaryDetails(),
|
||||
'HOOK_TOP_PAYMENT' => Module::hookExec('paymentTop'),
|
||||
'HOOK_PAYMENT' => $this->_getPaymentMethods(),
|
||||
'gift_price' => Tools::displayPrice(Tools::convertPrice(Product::getTaxCalculationMethod() == 1 ? $wrapping_fees : $wrapping_fees_tax_inc, new Currency((int)($this->context->cookie->id_currency))))
|
||||
));
|
||||
die(Tools::jsonEncode($result));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sizeof($this->errors))
|
||||
die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}');
|
||||
if (sizeof($this->errors))
|
||||
die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}');
|
||||
}
|
||||
die(Tools::displayError());
|
||||
break;
|
||||
@@ -260,7 +261,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
// PAYMENT
|
||||
$this->_assignPayment();
|
||||
Tools::safePostVars();
|
||||
|
||||
|
||||
$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
|
||||
}
|
||||
|
||||
@@ -379,7 +380,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$currency = Currency::getCurrency((int)$this->context->cart->id_currency);
|
||||
|
||||
$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
|
||||
if ($this->context->cart->getOrderTotal(false) < $minimalPurchase)
|
||||
if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase)
|
||||
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.Tools::displayPrice($minimalPurchase, $currency).
|
||||
' '.Tools::displayError('is required in order to validate your order.').'</p>';
|
||||
|
||||
@@ -429,8 +430,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$address_delivery = new Address((int)$this->context->cart->id_address_delivery);
|
||||
$address_invoice = new Address((int)$this->context->cart->id_address_invoice);
|
||||
|
||||
$inv_adr_fields = AddressFormat::getOrderedAddressFields((int)$address_delivery->id_country);
|
||||
$dlv_adr_fields = AddressFormat::getOrderedAddressFields((int)$address_invoice->id_country);
|
||||
$inv_adr_fields = AddressFormat::getOrderedAddressFields((int)$address_delivery->id_country, false, true);
|
||||
$dlv_adr_fields = AddressFormat::getOrderedAddressFields((int)$address_invoice->id_country, false, true);
|
||||
|
||||
$inv_all_fields = array();
|
||||
$dlv_all_fields = array();
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
|
||||
class OrderReturnControllerCore extends FrontController
|
||||
{
|
||||
public $auth = true;
|
||||
public $php_self = 'order-return.php';
|
||||
public $authRedirection = 'order-follow.php';
|
||||
public $ssl = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->auth = true;
|
||||
$this->php_self = 'order-return.php';
|
||||
$this->authRedirection = 'order-follow.php';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
|
||||
@@ -27,15 +27,10 @@
|
||||
|
||||
class OrderSlipControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->auth = true;
|
||||
$this->php_self = 'order-slip.php';
|
||||
$this->authRedirection = 'order-slip.php';
|
||||
$this->ssl = true;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $auth = true;
|
||||
public $php_self = 'order-slip.php';
|
||||
public $authRedirection = 'order-slip.php';
|
||||
public $ssl = true;
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
class PageNotFoundControllerCore extends FrontController
|
||||
{
|
||||
public $php_self = '404.php';
|
||||
|
||||
public function displayContent()
|
||||
{
|
||||
$this->context->smarty->display(_PS_THEME_DIR_.'404.tpl');
|
||||
|
||||
@@ -30,11 +30,13 @@ class FreeOrder extends PaymentModule {}
|
||||
|
||||
class ParentOrderControllerCore extends FrontController
|
||||
{
|
||||
public $ssl = true;
|
||||
public $php_self = 'order.php';
|
||||
|
||||
public $nbProducts;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ssl = true;
|
||||
parent::__construct();
|
||||
|
||||
/* Disable some cache related bugs on the cart/order */
|
||||
@@ -156,7 +158,7 @@ class ParentOrderControllerCore extends FrontController
|
||||
{
|
||||
$order = new FreeOrder();
|
||||
$order->free_order_class = true;
|
||||
$order->validateOrder($this->context->cart->id, _PS_OS_PAYMENT_, 0, Tools::displayError('Free order', false));
|
||||
$order->validateOrder($this->context->cart->id, Configuration::get('PS_OS_PAYMENT'), 0, Tools::displayError('Free order', false), null, array(), null, false, $this->context->cart->secure_key);
|
||||
return (int)Order::getOrderByCartId($this->context->cart->id);
|
||||
}
|
||||
return false;
|
||||
@@ -360,7 +362,9 @@ class ParentOrderControllerCore extends FrontController
|
||||
$this->context->smarty->assign(array(
|
||||
'checked' => $this->_setDefaultCarrierSelection($carriers),
|
||||
'carriers' => $carriers,
|
||||
'default_carrier' => (int)(Configuration::get('PS_CARRIER_DEFAULT')),
|
||||
'default_carrier' => (int)(Configuration::get('PS_CARRIER_DEFAULT'))
|
||||
));
|
||||
self::$smarty->assign(array(
|
||||
'HOOK_EXTRACARRIER' => Module::hookExec('extraCarrier', array('address' => $address)),
|
||||
'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers))
|
||||
));
|
||||
|
||||
@@ -29,12 +29,7 @@ define('MIN_PASSWD_LENGTH', 8);
|
||||
|
||||
class PasswordControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->php_self = 'password.php';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $php_self = 'password.php';
|
||||
|
||||
public function process()
|
||||
{
|
||||
|
||||
@@ -27,12 +27,7 @@
|
||||
|
||||
class PricesDropControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->php_self = 'prices-drop.php';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $php_self = 'prices-drop.php';
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
|
||||
@@ -49,11 +49,28 @@ class ProductControllerCore extends FrontController
|
||||
$this->addJS(_PS_JS_DIR_.'jquery/jquery.jqzoom.js');
|
||||
}
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
$canonicalURL = self::$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()
|
||||
{
|
||||
if ($id_product = (int)Tools::getValue('id_product'))
|
||||
$this->product = new Product($id_product, true, $this->context->language->id, $this->id_current_shop);
|
||||
$this->product = new Product($id_product, true, $this->context->language->id);
|
||||
|
||||
if (!Validate::isLoadedObject($this->product))
|
||||
{
|
||||
@@ -61,51 +78,25 @@ class ProductControllerCore extends FrontController
|
||||
header('Status: 404 Not Found');
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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))
|
||||
{
|
||||
$canonicalURL = $this->context->link->getProductLink($this->product);
|
||||
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/i', 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->canonicalRedirection();
|
||||
|
||||
parent::preProcess();
|
||||
|
||||
if((int)(Configuration::get('PS_REWRITING_SETTINGS')))
|
||||
if ($id_product = (int)Tools::getValue('id_product'))
|
||||
{
|
||||
$rewrite_infos = Product::getUrlRewriteInformations((int)$id_product);
|
||||
|
||||
$default_rewrite = array();
|
||||
foreach ($rewrite_infos AS $infos)
|
||||
$default_rewrite[$infos['id_lang']] = $this->context->link->getProductLink((int)$id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int)$infos['id_lang']);
|
||||
|
||||
$this->context->smarty->assign('lang_rewrite_urls', $default_rewrite);
|
||||
}
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
parent::process();
|
||||
|
||||
if (!$id_product = (int)(Tools::getValue('id_product')) OR !Validate::isUnsignedId($id_product))
|
||||
if (!Validate::isLoadedObject($this->product))
|
||||
$this->errors[] = Tools::displayError('Product not found');
|
||||
else
|
||||
{
|
||||
if (!Validate::isLoadedObject($this->product) OR !$this->product->isAssociatedToShop()
|
||||
if (!$this->product->isAssociatedToShop()
|
||||
OR (!$this->product->active AND (Tools::getValue('adtoken') != Tools::encrypt('PreviewProduct'.$this->product->id))
|
||||
|| !file_exists(dirname(__FILE__).'/../'.Tools::getValue('ad').'/ajax.php')))
|
||||
{
|
||||
header('HTTP/1.1 404 page not found');
|
||||
$this->errors[] = Tools::displayError('Pproduct is no longer available.');
|
||||
$this->errors[] = Tools::displayError('Product is no longer available.');
|
||||
}
|
||||
elseif (!$this->product->checkAccess(isset($this->context->customer) ? $this->context->customer->id : 0))
|
||||
$this->errors[] = Tools::displayError('You do not have access to this product.');
|
||||
@@ -116,9 +107,6 @@ class ProductControllerCore extends FrontController
|
||||
if (!$this->product->active)
|
||||
$this->context->smarty->assign('adminActionDisplay', true);
|
||||
|
||||
/* rewrited url set */
|
||||
$rewrited_url = $this->context->link->getProductLink($this->product->id, $this->product->link_rewrite);
|
||||
|
||||
/* Product pictures management */
|
||||
require_once('images.inc.php');
|
||||
$this->context->smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
|
||||
@@ -152,16 +140,11 @@ class ProductControllerCore extends FrontController
|
||||
'pictures' => $pictures,
|
||||
'textFields' => $textFields));
|
||||
|
||||
$productPriceWithTax = Product::getPriceStatic($id_product, true, NULL, 6);
|
||||
if (Product::$_taxCalculationMethod == PS_TAX_INC)
|
||||
$productPriceWithTax = Tools::ps_round($productPriceWithTax, 2);
|
||||
|
||||
$productPriceWithoutEcoTax = (float)($productPriceWithTax - $this->product->ecotax);
|
||||
$configs = Configuration::getMultiple(array('PS_ORDER_OUT_OF_STOCK', 'PS_LAST_QTIES'));
|
||||
|
||||
/* Features / Values */
|
||||
$features = $this->product->getFrontFeatures($this->context->language->id);
|
||||
$attachments = $this->product->getAttachments($this->context->language->id);
|
||||
$attachments = ($this->product->cache_has_attachments) ? $this->product->getAttachments($this->context->language->id) : array();
|
||||
|
||||
/* Category */
|
||||
$category = false;
|
||||
@@ -169,13 +152,13 @@ class ProductControllerCore extends FrontController
|
||||
{
|
||||
if (isset($regs[2]) AND is_numeric($regs[2]))
|
||||
{
|
||||
if (Product::idIsOnCategoryId((int)($this->product->id), array('0' => array('id_category' => (int)($regs[2])))))
|
||||
$category = new Category((int)($regs[2]), (int)$this->context->cookie->id_lang);
|
||||
if (Product::idIsOnCategoryId((int)$this->product->id, array('0' => array('id_category' => (int)$regs[2]))))
|
||||
$category = new Category($regs[2], (int)$this->context->cookie->id_lang);
|
||||
}
|
||||
elseif (isset($regs[5]) AND is_numeric($regs[5]))
|
||||
{
|
||||
if (Product::idIsOnCategoryId((int)($this->product->id), array('0' => array('id_category' => (int)($regs[5])))))
|
||||
$category = new Category((int)($regs[5]), (int)$this->context->cookie->id_lang);
|
||||
if (Product::idIsOnCategoryId((int)($this->product->id), array('0' => array('id_category' => (int)$regs[5]))))
|
||||
$category = new Category($regs[5], (int)$this->context->cookie->id_lang);
|
||||
}
|
||||
}
|
||||
if (!$category)
|
||||
@@ -184,20 +167,20 @@ class ProductControllerCore extends FrontController
|
||||
if (isset($category) AND Validate::isLoadedObject($category))
|
||||
{
|
||||
$this->context->smarty->assign(array(
|
||||
'path' => Tools::getPath((int)$category->id, $this->product->name, true),
|
||||
'category' => $category,
|
||||
'subCategories' => $category->getSubCategories($this->context->language->id, true),
|
||||
'id_category_current' => (int)($category->id),
|
||||
'id_category_parent' => (int)($category->id_parent),
|
||||
'return_category_name' => Tools::safeOutput($category->name)));
|
||||
'path' => Tools::getPath((int)$category->id, $this->product->name, true),
|
||||
'category' => $category,
|
||||
'subCategories' => $category->getSubCategories($this->context->language->id, true),
|
||||
'id_category_current' => (int)($category->id),
|
||||
'id_category_parent' => (int)($category->id_parent),
|
||||
'return_category_name' => Tools::safeOutput($category->name),
|
||||
));
|
||||
}
|
||||
else
|
||||
$this->context->smarty->assign('path', Tools::getPath((int)$this->product->id_category_default, $this->product->name));
|
||||
|
||||
$this->context->smarty->assign('return_link', (isset($category->id) AND $category->id) ? Tools::safeOutput($this->context->link->getCategoryLink($category)) : 'javascript: history.back();');
|
||||
|
||||
$lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
if (Pack::isPack((int)($this->product->id), (int)($lang)) AND !Pack::isInStock((int)($this->product->id), (int)($lang)))
|
||||
if (Pack::isPack((int)$this->product->id) AND !Pack::isInStock((int)$this->product->id))
|
||||
$this->product->quantity = 0;
|
||||
|
||||
$id_customer = (isset($this->context->customer) ? (int)($this->context->customer->id) : 0);
|
||||
@@ -206,8 +189,13 @@ class ProductControllerCore extends FrontController
|
||||
$id_country = (int)($id_customer ? Customer::getCurrentCountry($id_customer) : Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
|
||||
// Tax
|
||||
$tax = (float)(Tax::getProductTaxRate((int)($this->product->id), $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||
$tax = (float)(Tax::getProductTaxRate((int)$this->product->id, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||
$this->context->smarty->assign('tax_rate', $tax);
|
||||
|
||||
$productPriceWithTax = Product::getPriceStatic($this->product->id, true, NULL, 6);
|
||||
if (Product::$_taxCalculationMethod == PS_TAX_INC)
|
||||
$productPriceWithTax = Tools::ps_round($productPriceWithTax, 2);
|
||||
$productPriceWithoutEcoTax = (float)($productPriceWithTax - $this->product->ecotax);
|
||||
|
||||
$ecotax_rate = (float) Tax::getProductEcotaxRate($this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$ecotaxTaxAmount = Tools::ps_round($this->product->ecotax, 2);
|
||||
@@ -215,19 +203,19 @@ class ProductControllerCore extends FrontController
|
||||
$ecotaxTaxAmount = Tools::ps_round($ecotaxTaxAmount * (1 + $ecotax_rate / 100), 2);
|
||||
|
||||
$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->id_current_shop, (int)$this->context->cookie->id_currency, $id_country, $id_group), $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false), (float)$tax),
|
||||
'product' => $this->product,
|
||||
'ecotax_tax_inc' => $ecotaxTaxAmount,
|
||||
'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2),
|
||||
'ecotaxTax_rate' => $ecotax_rate,
|
||||
'homeSize' => Image::getSize('home'),
|
||||
'product_manufacturer' => new Manufacturer((int)($this->product->id_manufacturer), Configuration::get('PS_LANG_DEFAULT')),
|
||||
'product_manufacturer' => new Manufacturer((int)$this->product->id_manufacturer, $context->language->id),
|
||||
'token' => Tools::getToken(false),
|
||||
'productPriceWithoutEcoTax' => (float)($productPriceWithoutEcoTax),
|
||||
'productPriceWithoutEcoTax' => (float)$productPriceWithoutEcoTax,
|
||||
'features' => $features,
|
||||
'attachments' => $attachments,
|
||||
'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int)($this->product->out_of_stock)),
|
||||
'last_qties' => (int)($configs['PS_LAST_QTIES']),
|
||||
'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int)$this->product->out_of_stock),
|
||||
'last_qties' => (int)Configuration::get('PS_LAST_QTIES'),
|
||||
'group_reduction' => $group_reduction,
|
||||
'col_img_dir' => _PS_COL_IMG_DIR_,
|
||||
));
|
||||
@@ -250,7 +238,7 @@ class ProductControllerCore extends FrontController
|
||||
$this->context->smarty->assign('mainImage', $images[0]);
|
||||
$cover = $image;
|
||||
$cover['id_image'] = (Configuration::get('PS_LEGACY_IMAGES') ? ($this->product->id.'-'.$image['id_image']) : $image['id_image']);
|
||||
$cover['id_image_only'] = (int)($image['id_image']);
|
||||
$cover['id_image_only'] = (int)$image['id_image'];
|
||||
}
|
||||
$productImages[(int)($image['id_image'])] = $image;
|
||||
}
|
||||
@@ -348,7 +336,7 @@ class ProductControllerCore extends FrontController
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'no_tax' => Tax::excludeTaxeOption() OR !Tax::getProductTaxRate((int)$this->product->id, $this->context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}),
|
||||
'customizationFields' => $this->product->getCustomizationFields($this->context->language->id)
|
||||
'customizationFields' => ($this->product->customizable) ? $this->product->getCustomizationFields($this->context->language->id) : false,
|
||||
));
|
||||
|
||||
// Pack management
|
||||
@@ -383,7 +371,7 @@ class ProductControllerCore extends FrontController
|
||||
|
||||
public function pictureUpload(Product $product, Cart $cart)
|
||||
{
|
||||
if (!$fieldIds = $product->getCustomizationFieldIds())
|
||||
if (!$fieldIds = $this->product->getCustomizationFieldIds())
|
||||
return false;
|
||||
$authorizedFileFields = array();
|
||||
foreach ($fieldIds AS $fieldId)
|
||||
@@ -459,11 +447,9 @@ class ProductControllerCore extends FrontController
|
||||
$cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $taxRate / 100));
|
||||
|
||||
if ($row['reduction_type'] == 'amount')
|
||||
{
|
||||
$cur_price = Product::$_taxCalculationMethod == PS_TAX_INC ? $cur_price - $row['reduction'] : $cur_price - ($row['reduction'] / (1 + $taxRate / 100));
|
||||
} else {
|
||||
else
|
||||
$cur_price = $cur_price * ( 1 - ($row['reduction']));
|
||||
}
|
||||
|
||||
$row['real_value'] = $price - $cur_price;
|
||||
}
|
||||
@@ -471,10 +457,13 @@ class ProductControllerCore extends FrontController
|
||||
{
|
||||
if ($row['reduction_type'] == 'amount')
|
||||
{
|
||||
$reduction_amount = $row['reduction'];
|
||||
if (!$row['id_currency'])
|
||||
$reduction_amount = Tools::convertPrice($reduction_amount, $this->context->currency->id);
|
||||
$row['real_value'] = Product::$_taxCalculationMethod == PS_TAX_INC ? $row['reduction'] : $row['reduction'] / (1 + $taxRate / 100);
|
||||
} else {
|
||||
$row['real_value'] = $row['reduction'] * 100;
|
||||
}
|
||||
else
|
||||
$row['real_value'] = $row['reduction'] * 100;
|
||||
}
|
||||
$row['nextQuantity'] = (isset($specificPrices[$key + 1]) ? (int)($specificPrices[$key + 1]['from_quantity']) : -1);
|
||||
}
|
||||
|
||||
@@ -27,13 +27,12 @@
|
||||
|
||||
class SearchControllerCore extends FrontController
|
||||
{
|
||||
public $php_self = 'search.php';
|
||||
public $instantSearch;
|
||||
public $ajaxSearch;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->php_self = 'search.php';
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->instantSearch = Tools::getValue('instantSearch');
|
||||
|
||||
@@ -27,12 +27,7 @@
|
||||
|
||||
class SitemapControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->php_self = 'sitemap.php';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $php_self = 'sitemap.php';
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
|
||||
@@ -27,12 +27,7 @@
|
||||
|
||||
class StoresControllerCore extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->php_self = 'stores.php';
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
public $php_self = 'stores.php';
|
||||
|
||||
public function preProcess()
|
||||
{
|
||||
@@ -157,7 +152,7 @@ class StoresControllerCore extends FrontController
|
||||
$out = '';
|
||||
$out_datas = array();
|
||||
|
||||
$address_datas = AddressFormat::getOrderedAddressFields($store['id_country']);
|
||||
$address_datas = AddressFormat::getOrderedAddressFields($store['id_country'], false, true);
|
||||
$state = (isset($store['id_state'])) ? new State($store['id_state']) : NULL;
|
||||
|
||||
foreach ($address_datas as $data_line)
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
class SupplierControllerCore extends FrontController
|
||||
{
|
||||
public $php_self = 'supplier.php';
|
||||
|
||||
protected $supplier;
|
||||
|
||||
public function setMedia()
|
||||
@@ -35,47 +37,71 @@ class SupplierControllerCore extends FrontController
|
||||
$this->addCSS(_THEME_CSS_DIR_.'product_list.css');
|
||||
}
|
||||
|
||||
public function canonicalRedirection()
|
||||
{
|
||||
if (Validate::isLoadedObject($this->supplier))
|
||||
{
|
||||
$canonicalURL = self::$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 preProcess()
|
||||
{
|
||||
if ($id_supplier = (int)Tools::getValue('id_supplier'))
|
||||
{
|
||||
$this->supplier = new Supplier($id_supplier, $this->context->language->id);
|
||||
|
||||
if (!Validate::isLoadedObject($this->supplier) OR !$this->supplier->active)
|
||||
{
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
header('Status: 404 Not Found');
|
||||
$this->errors[] = Tools::displayError('Supplier does not exist.');
|
||||
}
|
||||
else
|
||||
$this->canonicalRedirection();
|
||||
}
|
||||
|
||||
parent::preProcess();
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
if ($id_supplier = Tools::getValue('id_supplier'))
|
||||
if (Validate::isLoadedObject($this->supplier) AND $this->supplier->active AND $this->supplier->isAssociatedToGroupShop())
|
||||
{
|
||||
$this->supplier = new Supplier((int)$id_supplier, $this->context->cookie->id_lang);
|
||||
if (Validate::isLoadedObject($this->supplier) AND $this->supplier->active AND $this->supplier->isAssociatedToGroupShop())
|
||||
{
|
||||
$nbProducts = $this->supplier->getProducts($id_supplier, 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->context->smarty->assign(array(
|
||||
'nb_products' => $nbProducts,
|
||||
'products' => $this->supplier->getProducts($id_supplier, (int)$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) : ''),
|
||||
'supplier' => $this->supplier));
|
||||
}
|
||||
else
|
||||
{
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
header('Status: 404 Not Found');
|
||||
$this->errors[] = Tools::displayError('Supplier does not exist');
|
||||
}
|
||||
'supplier' => $this->supplier,
|
||||
));
|
||||
}
|
||||
else
|
||||
elseif (!Tools::getValue('id_supplier'))
|
||||
{
|
||||
if (Configuration::get('PS_DISPLAY_SUPPLIERS'))
|
||||
{
|
||||
$data = call_user_func(array('Supplier', 'getSuppliers'), true, $this->context->language->id, true);
|
||||
$nbProducts = count($data);
|
||||
$result = Supplier::getSuppliers(true, $this->context->language->id, true);
|
||||
$nbProducts = count($result);
|
||||
$this->pagination($nbProducts);
|
||||
|
||||
$data = call_user_func(array('Supplier', 'getSuppliers'), true, $this->context->language->id, true, $this->p, $this->n);
|
||||
$imgDir = _PS_SUPP_IMG_DIR_;
|
||||
foreach ($data AS &$item)
|
||||
$item['image'] = (!file_exists($imgDir.'/'.$item['id_supplier'].'-medium.jpg')) ?
|
||||
$this->context->language->iso_code.'-default' : $item['id_supplier'];
|
||||
$suppliers = Supplier::getSuppliers(true, $this->context->language->id, true, $this->p, $this->n);
|
||||
foreach ($suppliers AS &$row)
|
||||
$row['image'] = (!file_exists(_PS_SUPP_IMG_DIR_.'/'.$row['id_supplier'].'-medium.jpg')) ? $this->context->language->iso_code.'-default' : $item['id_supplier'];;
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'pages_nb' => ceil($nbProducts / (int)($this->n)),
|
||||
'nbSuppliers' => $nbProducts,
|
||||
'mediumSize' => Image::getSize('medium'),
|
||||
'suppliers' => $data,
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
'pages_nb' => ceil($nbProducts / (int)$this->n),
|
||||
'nbSuppliers' => $nbProducts,
|
||||
'mediumSize' => Image::getSize('medium'),
|
||||
'suppliers' => $suppliers,
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user