//MERGE branche release

This commit is contained in:
Vincent Augagneur
2013-08-26 10:59:36 +02:00
161 changed files with 2530 additions and 1173 deletions
+4 -4
View File
@@ -43,7 +43,7 @@ class AuthControllerCore extends FrontController
parent::init();
if (!Tools::getIsset('step') && $this->context->customer->isLogged() && !$this->ajax)
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
if (Tools::getValue('create_account'))
$this->create_account = true;
@@ -329,7 +329,7 @@ class AuthControllerCore extends FrontController
{
if ($back = Tools::getValue('back'))
Tools::redirect(html_entity_decode($back));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
}
}
}
@@ -469,7 +469,7 @@ class AuthControllerCore extends FrontController
Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
// else : redirection to the account
else
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
}
else
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
@@ -608,7 +608,7 @@ class AuthControllerCore extends FrontController
Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
// else : redirection to the account
else
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
}
}
}
+24 -3
View File
@@ -33,6 +33,7 @@ class CartControllerCore extends FrontController
protected $id_address_delivery;
protected $customization_id;
protected $qty;
public $ssl = false;
public $ssl = true;
@@ -190,10 +191,30 @@ class CartControllerCore extends FrontController
return;
}
$qty_to_check = $this->qty;
$cart_products = $this->context->cart->getProducts();
if (is_array($cart_products))
foreach ($cart_products as $cart_product)
{
if ((isset($this->id_product_attribute) && $cart_product['id_product_attribute'] == $this->id_product_attribute) ||
(isset($this->id_product) && $cart_product['id_product'] == $this->id_product))
{
$qty_to_check = $cart_product['cart_quantity'];
if (Tools::getValue('op', 'up') == 'down')
$qty_to_check -= $this->qty;
else
$qty_to_check += $this->qty;
break;
}
}
// Check product quantity availability
if ($this->id_product_attribute)
{
if (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $this->qty))
if (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $qty_to_check))
$this->errors[] = Tools::displayError('There isn\'t enough product in stock.');
}
else if ($product->hasAttributes())
@@ -203,10 +224,10 @@ class CartControllerCore extends FrontController
// @todo do something better than a redirect admin !!
if (!$this->id_product_attribute)
Tools::redirectAdmin($this->context->link->getProductLink($product));
else if (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $this->qty))
else if (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $qty_to_check))
$this->errors[] = Tools::displayError('There isn\'t enough product in stock.');
}
else if (!$product->checkQty($this->qty))
else if (!$product->checkQty($qty_to_check))
$this->errors[] = Tools::displayError('There isn\'t enough product in stock.');
// If no errors, process product addition
+2
View File
@@ -53,6 +53,8 @@ class CategoryControllerCore extends FrontController
public function canonicalRedirection($canonicalURL = '')
{
if (Tools::getValue('live_edit'))
return ;
if (!Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop())
{
$this->redirect_after = '404';
+2
View File
@@ -33,6 +33,8 @@ class CmsControllerCore extends FrontController
public function canonicalRedirection($canonicalURL = '')
{
if (Tools::getValue('live_edit'))
return ;
if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms)))
parent::canonicalRedirection($canonicalURL);
else if (Validate::isLoadedObject($this->cms_category) && ($canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category)))
@@ -40,6 +40,8 @@ class ManufacturerControllerCore extends FrontController
public function canonicalRedirection($canonicalURL = '')
{
if (Tools::getValue('live_edit'))
return ;
if (Validate::isLoadedObject($this->manufacturer))
parent::canonicalRedirection($this->context->link->getManufacturerLink($this->manufacturer));
}
+13 -2
View File
@@ -614,13 +614,21 @@ class OrderOpcControllerCore extends ParentOrderController
protected function _processAddressFormat()
{
$selectedCountry = (int)(Configuration::get('PS_COUNTRY_DEFAULT'));
$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, false, true);
$dlv_adr_fields = AddressFormat::getOrderedAddressFields((int)$address_invoice->id_country, false, true);
$requireFormFieldsList = AddressFormat::$requireFormFieldsList;
// Add missing require fields for a new user susbscription form
foreach ($requireFormFieldsList as $fieldName)
if (!in_array($fieldName, $dlv_adr_fields))
$dlv_adr_fields[] = trim($fieldName);
foreach ($requireFormFieldsList as $fieldName)
if (!in_array($fieldName, $inv_adr_fields))
$inv_adr_fields[] = trim($fieldName);
$inv_all_fields = array();
$dlv_all_fields = array();
@@ -631,6 +639,9 @@ class OrderOpcControllerCore extends ParentOrderController
foreach (explode(' ', $fields_line) as $field_item)
${$adr_type.'_all_fields'}[] = trim($field_item);
${$adr_type.'_adr_fields'} = array_unique(${$adr_type.'_adr_fields'});
${$adr_type.'_all_fields'} = array_unique(${$adr_type.'_all_fields'});
$this->context->smarty->assign($adr_type.'_adr_fields', ${$adr_type.'_adr_fields'});
$this->context->smarty->assign($adr_type.'_all_fields', ${$adr_type.'_all_fields'});
}
+2
View File
@@ -69,6 +69,8 @@ class ProductControllerCore extends FrontController
public function canonicalRedirection($canonical_url = '')
{
if (Tools::getValue('live_edit'))
return ;
if (Validate::isLoadedObject($this->product))
parent::canonicalRedirection($this->context->link->getProductLink($this->product));
}
+2
View File
@@ -41,6 +41,8 @@ class SupplierControllerCore extends FrontController
public function canonicalRedirection($canonicalURL = '')
{
if (Tools::getValue('live_edit'))
return ;
if (Validate::isLoadedObject($this->supplier))
parent::canonicalRedirection($this->context->link->getSupplierLink($this->supplier));
}