// Normalize

This commit is contained in:
rMalie
2012-01-25 16:13:36 +00:00
parent accafe14cb
commit cb9a7f281f
9 changed files with 50 additions and 47 deletions
+2 -2
View File
@@ -164,7 +164,7 @@ class AddressControllerCore extends FrontController
} }
else if ($zip_code_format) else if ($zip_code_format)
$this->errors[] = '<strong>'.Tools::displayError('Zip/ Postal code').'</strong> '.Tools::displayError('is required.'); $this->errors[] = '<strong>'.Tools::displayError('Zip/ Postal code').'</strong> '.Tools::displayError('is required.');
else if ($postcode AND !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode)) else if ($postcode && !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
$this->errors[] = '<strong>'.Tools::displayError('Zip/ Postal code').'</strong> '.Tools::displayError('is invalid.') $this->errors[] = '<strong>'.Tools::displayError('Zip/ Postal code').'</strong> '.Tools::displayError('is invalid.')
.'<br />'.Tools::displayError('Must be typed as follows:').' ' .'<br />'.Tools::displayError('Must be typed as follows:').' '
.str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $zip_code_format))); .str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $zip_code_format)));
@@ -174,7 +174,7 @@ class AddressControllerCore extends FrontController
if ($country->isNeedDni() && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni')))) if ($country->isNeedDni() && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
$this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.'); $this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
else if (!$country->isNeedDni()) else if (!$country->isNeedDni())
$address->dni = NULL; $address->dni = null;
// Don't continue this process if we have errors ! // Don't continue this process if we have errors !
if ($this->errors && !Tools::isSubmit('ajax')) if ($this->errors && !Tools::isSubmit('ajax'))
+3 -3
View File
@@ -231,7 +231,7 @@ class AuthControllerCore extends FrontController
$addressItems[] = trim($addressItem); $addressItems[] = trim($addressItem);
// Add missing require fields for a new user susbscription form // Add missing require fields for a new user susbscription form
foreach($requireFormFieldsList as $fieldName) foreach ($requireFormFieldsList as $fieldName)
if (!in_array($fieldName, $addressItems)) if (!in_array($fieldName, $addressItems))
$addressItems[] = trim($fieldName); $addressItems[] = trim($fieldName);
@@ -450,7 +450,7 @@ class AuthControllerCore extends FrontController
$this->errors = array_unique(array_merge($this->errors, $address->validateController())); $this->errors = array_unique(array_merge($this->errors, $address->validateController()));
// US customer: normalize the address // US customer: normalize the address
if($address->id_country == Country::getByIso('US')) if ($address->id_country == Country::getByIso('US'))
{ {
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php'); include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
$normalize = new AddressStandardizationSolution; $normalize = new AddressStandardizationSolution;
@@ -481,7 +481,7 @@ class AuthControllerCore extends FrontController
if (Country::isNeedDniByCountryId($address->id_country) && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni')))) if (Country::isNeedDniByCountryId($address->id_country) && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
$this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.'); $this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
elseif (!Country::isNeedDniByCountryId($address->id_country)) elseif (!Country::isNeedDniByCountryId($address->id_country))
$address->dni = NULL; $address->dni = null;
} }
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == ''))
+5 -7
View File
@@ -70,11 +70,11 @@ class CartControllerCore extends FrontController
$this->processChangeProductInCart(); $this->processChangeProductInCart();
else if (Tools::getIsset('delete')) else if (Tools::getIsset('delete'))
$this->processDeleteProductInCart(); $this->processDeleteProductInCart();
else if(Tools::getIsset('changeAddressDelivery')) else if (Tools::getIsset('changeAddressDelivery'))
$this->processChangeProductAddressDelivery(); $this->processChangeProductAddressDelivery();
else if(Tools::getIsset('allowSeperatedPackage')) else if (Tools::getIsset('allowSeperatedPackage'))
$this->processAllowSeperatedPackage(); $this->processAllowSeperatedPackage();
else if(Tools::getIsset('duplicate')) else if (Tools::getIsset('duplicate'))
$this->processDuplicateProduct(); $this->processDuplicateProduct();
// Make redirection // Make redirection
if (!$this->errors && !$this->ajax) if (!$this->errors && !$this->ajax)
@@ -147,14 +147,12 @@ class CartControllerCore extends FrontController
if (!Configuration::get('PS_ALLOW_MULTISHIPPING')) if (!Configuration::get('PS_ALLOW_MULTISHIPPING'))
return; return;
if ( if (!$this->context->cart->duplicateProduct(
!$this->context->cart->duplicateProduct(
$this->id_product, $this->id_product,
$this->id_product_attribute, $this->id_product_attribute,
$this->id_address_delivery, $this->id_address_delivery,
(int)Tools::getValue('new_id_address_delivery') (int)Tools::getValue('new_id_address_delivery')
) ))
)
{ {
//$error_message = $this->l('Error durring product duplication'); //$error_message = $this->l('Error durring product duplication');
// For the moment no translations // For the moment no translations
+1 -1
View File
@@ -99,7 +99,7 @@ class CategoryControllerCore extends FrontController
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'category' => $this->category, 'category' => $this->category,
'products' => (isset($this->cat_products) && $this->cat_products) ? $this->cat_products : NULL, 'products' => (isset($this->cat_products) && $this->cat_products) ? $this->cat_products : null,
'id_category' => (int)$this->category->id, 'id_category' => (int)$this->category->id,
'id_category_parent' => (int)$this->category->id_parent, 'id_category_parent' => (int)$this->category->id_parent,
'return_category_name' => Tools::safeOutput($this->category->name), 'return_category_name' => Tools::safeOutput($this->category->name),
+1 -1
View File
@@ -131,7 +131,7 @@ class OrderDetailControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
if (!$id_order = (int)(Tools::getValue('id_order')) OR !Validate::isUnsignedId($id_order)) if (!$id_order = (int)(Tools::getValue('id_order')) || !Validate::isUnsignedId($id_order))
$this->errors[] = Tools::displayError('Order ID required'); $this->errors[] = Tools::displayError('Order ID required');
else else
{ {
+3 -3
View File
@@ -46,9 +46,9 @@ class OrderFollowControllerCore extends FrontController
Tools::redirect('index.php?controller=history'); Tools::redirect('index.php?controller=history');
if (!$order_qte_input = Tools::getValue('order_qte_input')) if (!$order_qte_input = Tools::getValue('order_qte_input'))
Tools::redirect('index.php?controller=order-follow&errorDetail1'); Tools::redirect('index.php?controller=order-follow&errorDetail1');
if ($customizationIds = Tools::getValue('customization_ids') AND !$customizationQtyInput) if ($customizationIds = Tools::getValue('customization_ids') && !$customizationQtyInput)
Tools::redirect('index.php?controller=order-follow&errorDetail1'); Tools::redirect('index.php?controller=order-follow&errorDetail1');
if (!$ids_order_detail = Tools::getValue('ids_order_detail') AND !$customizationIds) if (!$ids_order_detail = Tools::getValue('ids_order_detail') && !$customizationIds)
Tools::redirect('index.php?controller=order-follow&errorDetail2'); Tools::redirect('index.php?controller=order-follow&errorDetail2');
$order = new Order((int)($id_order)); $order = new Order((int)($id_order));
@@ -88,7 +88,7 @@ class OrderFollowControllerCore extends FrontController
elseif (Tools::isSubmit('errorDetail2')) elseif (Tools::isSubmit('errorDetail2'))
$this->context->smarty->assign('errorDetail2', true); $this->context->smarty->assign('errorDetail2', true);
elseif (Tools::isSubmit('errorNotReturnable')) elseif (Tools::isSubmit('errorNotReturnable'))
$this->context->smarty->assign('errorNotReturnable',true); $this->context->smarty->assign('errorNotReturnable', true);
$this->context->smarty->assign('ordersReturn', $ordersReturn); $this->context->smarty->assign('ordersReturn', $ordersReturn);
+31 -26
View File
@@ -43,7 +43,7 @@ class OrderOpcControllerCore extends ParentOrderController
$this->context->smarty->assign('is_multi_address_delivery', $this->context->cart->isMultiAddressDelivery()); $this->context->smarty->assign('is_multi_address_delivery', $this->context->cart->isMultiAddressDelivery());
$this->isLogged = (bool)($this->context->customer->id AND Customer::customerIdExistsStatic((int)($this->context->cookie->id_customer))); $this->isLogged = (bool)($this->context->customer->id && Customer::customerIdExistsStatic((int)($this->context->cookie->id_customer)));
if ($this->context->cart->nbProducts()) if ($this->context->cart->nbProducts())
{ {
@@ -58,18 +58,18 @@ class OrderOpcControllerCore extends ParentOrderController
{ {
$txtMessage = urldecode(Tools::getValue('message')); $txtMessage = urldecode(Tools::getValue('message'));
$this->_updateMessage($txtMessage); $this->_updateMessage($txtMessage);
if (sizeof($this->errors)) if (count($this->errors))
die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}'); die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}');
die(true); die(true);
} }
break; break;
case 'updateCarrierAndGetPayments': case 'updateCarrierAndGetPayments':
if ((Tools::isSubmit('delivery_option') || Tools::isSubmit('id_carrier')) AND Tools::isSubmit('recyclable') AND Tools::isSubmit('gift') AND Tools::isSubmit('gift_message')) if ((Tools::isSubmit('delivery_option') || Tools::isSubmit('id_carrier')) && Tools::isSubmit('recyclable') && Tools::isSubmit('gift') && Tools::isSubmit('gift_message'))
{ {
if ($this->_processCarrier()) if ($this->_processCarrier())
{ {
$carriers = $this->context->cart->simulateCarriersOutput(); $carriers = $this->context->cart->simulateCarriersOutput();
$address_delivery = new Address($this->context->cart->id_address_delivery);
$return = array( $return = array(
'summary' => $this->context->cart->getSummaryDetails(), 'summary' => $this->context->cart->getSummaryDetails(),
'HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'), 'HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'),
@@ -82,11 +82,12 @@ class OrderOpcControllerCore extends ParentOrderController
} }
else else
$this->errors[] = Tools::displayError('Error occurred updating cart.'); $this->errors[] = Tools::displayError('Error occurred updating cart.');
if (sizeof($this->errors)) if (count($this->errors))
die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}'); die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}');
exit; exit;
} }
break; break;
case 'updateTOSStatusAndGetPayments': case 'updateTOSStatusAndGetPayments':
if (Tools::isSubmit('checked')) if (Tools::isSubmit('checked'))
{ {
@@ -97,9 +98,11 @@ class OrderOpcControllerCore extends ParentOrderController
))); )));
} }
break; break;
case 'getCarrierList': case 'getCarrierList':
die(Tools::jsonEncode($this->_getCarrierList())); die(Tools::jsonEncode($this->_getCarrierList()));
break; break;
case 'editCustomer': case 'editCustomer':
if (!$this->isLogged) if (!$this->isLogged)
exit; exit;
@@ -116,12 +119,13 @@ class OrderOpcControllerCore extends ParentOrderController
'id_customer' => (int)$this->context->customer->id, 'id_customer' => (int)$this->context->customer->id,
'token' => Tools::getToken(false) 'token' => Tools::getToken(false)
); );
if (!sizeof($this->errors)) if (!count($this->errors))
$return['isSaved'] = (bool)$this->context->customer->update(); $return['isSaved'] = (bool)$this->context->customer->update();
else else
$return['isSaved'] = false; $return['isSaved'] = false;
die(Tools::jsonEncode($return)); die(Tools::jsonEncode($return));
break; break;
case 'getAddressBlockAndCarriersAndPayments': case 'getAddressBlockAndCarriersAndPayments':
if ($this->context->customer->isLogged()) if ($this->context->customer->isLogged())
{ {
@@ -154,9 +158,10 @@ class OrderOpcControllerCore extends ParentOrderController
} }
die(Tools::displayError()); die(Tools::displayError());
break; break;
case 'makeFreeOrder': case 'makeFreeOrder':
/* Bypass payment step if total is 0 */ /* Bypass payment step if total is 0 */
if (($id_order = $this->_checkFreeOrder()) AND $id_order) if (($id_order = $this->_checkFreeOrder()) && $id_order)
{ {
$email = $this->context->customer->email; $email = $this->context->customer->email;
if ($this->context->customer->is_guest) if ($this->context->customer->is_guest)
@@ -165,6 +170,7 @@ class OrderOpcControllerCore extends ParentOrderController
} }
exit; exit;
break; break;
case 'updateAddressesSelected': case 'updateAddressesSelected':
if ($this->context->customer->isLogged(true)) if ($this->context->customer->isLogged(true))
{ {
@@ -174,7 +180,7 @@ class OrderOpcControllerCore extends ParentOrderController
$this->errors[] = Tools::displayError('This address is not yours.'); $this->errors[] = Tools::displayError('This address is not yours.');
elseif (!Address::isCountryActiveById((int)(Tools::getValue('id_address_delivery')))) elseif (!Address::isCountryActiveById((int)(Tools::getValue('id_address_delivery'))))
$this->errors[] = Tools::displayError('This address is not in a valid area.'); $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) elseif (!Validate::isLoadedObject($address_delivery) || !Validate::isLoadedObject($address_invoice) || $address_invoice->deleted || $address_delivery->deleted)
$this->errors[] = Tools::displayError('This address is invalid.'); $this->errors[] = Tools::displayError('This address is invalid.');
else else
{ {
@@ -183,7 +189,7 @@ class OrderOpcControllerCore extends ParentOrderController
if (!$this->context->cart->update()) if (!$this->context->cart->update())
$this->errors[] = Tools::displayError('An error occurred while updating your cart.'); $this->errors[] = Tools::displayError('An error occurred while updating your cart.');
if (!sizeof($this->errors)) if (!count($this->errors))
{ {
$result = $this->_getCarrierList(); $result = $this->_getCarrierList();
// Wrapping fees // Wrapping fees
@@ -200,11 +206,12 @@ class OrderOpcControllerCore extends ParentOrderController
die(Tools::jsonEncode($result)); die(Tools::jsonEncode($result));
} }
} }
if (sizeof($this->errors)) if (count($this->errors))
die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}'); die('{"hasError" : true, "errors" : ["'.implode('\',\'', $this->errors).'"]}');
} }
die(Tools::displayError()); die(Tools::displayError());
break; break;
case 'multishipping': case 'multishipping':
$this->_assignSummaryInformations(); $this->_assignSummaryInformations();
if ($this->context->customer->id) if ($this->context->customer->id)
@@ -215,6 +222,7 @@ class OrderOpcControllerCore extends ParentOrderController
$this->display(); $this->display();
die(); die();
break; break;
case 'cartReload': case 'cartReload':
$this->_assignSummaryInformations(); $this->_assignSummaryInformations();
if ($this->context->customer->id) if ($this->context->customer->id)
@@ -226,10 +234,12 @@ class OrderOpcControllerCore extends ParentOrderController
$this->display(); $this->display();
die(); die();
break; break;
case 'noMultiAddressDelivery': case 'noMultiAddressDelivery':
$this->context->cart->setNoMultishipping(); $this->context->cart->setNoMultishipping();
die(); die();
break; break;
default: default:
throw new PrestaShopException('Unknown method "'.Tools::getValue('method').'"'); throw new PrestaShopException('Unknown method "'.Tools::getValue('method').'"');
} }
@@ -280,7 +290,7 @@ class OrderOpcControllerCore extends ParentOrderController
'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'),
'errorCarrier' => Tools::displayError('You must choose a carrier before', false), 'errorCarrier' => Tools::displayError('You must choose a carrier before', false),
'errorTOS' => Tools::displayError('You must accept terms of service before', false), 'errorTOS' => Tools::displayError('You must accept terms of service before', false),
'isPaymentStep' => (bool)(isset($_GET['isPaymentStep']) AND $_GET['isPaymentStep']), 'isPaymentStep' => (bool)(isset($_GET['isPaymentStep']) && $_GET['isPaymentStep']),
'genders' => Gender::getGenders(), 'genders' => Gender::getGenders(),
)); ));
/* Call a hook to display more information on form */ /* Call a hook to display more information on form */
@@ -298,7 +308,7 @@ class OrderOpcControllerCore extends ParentOrderController
)); ));
/* Load guest informations */ /* Load guest informations */
if ($this->isLogged AND $this->context->cookie->is_guest) if ($this->isLogged && $this->context->cookie->is_guest)
$this->context->smarty->assign('guestInformations', $this->_getGuestInformations()); $this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
if ($this->isLogged) if ($this->isLogged)
@@ -359,7 +369,7 @@ class OrderOpcControllerCore extends ParentOrderController
{ {
$carriers = $this->context->cart->simulateCarriersOutput(); $carriers = $this->context->cart->simulateCarriersOutput();
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'HOOK_EXTRACARRIER' => NULL, 'HOOK_EXTRACARRIER' => null,
'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array( 'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array(
'carriers' => $carriers, 'carriers' => $carriers,
'checked' => $this->context->cart->simulateCarrierSelectedOutput(), 'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
@@ -386,11 +396,11 @@ class OrderOpcControllerCore extends ParentOrderController
return '<p class="warning">'.Tools::displayError('Please sign in to see payment methods').'</p>'; return '<p class="warning">'.Tools::displayError('Please sign in to see payment methods').'</p>';
if ($this->context->cart->OrderExists()) if ($this->context->cart->OrderExists())
return '<p class="warning">'.Tools::displayError('Error: this order is already validated').'</p>'; return '<p class="warning">'.Tools::displayError('Error: this order is already validated').'</p>';
if (!$this->context->cart->id_customer OR !Customer::customerIdExistsStatic($this->context->cart->id_customer) OR Customer::isBanned($this->context->cart->id_customer)) if (!$this->context->cart->id_customer || !Customer::customerIdExistsStatic($this->context->cart->id_customer) || Customer::isBanned($this->context->cart->id_customer))
return '<p class="warning">'.Tools::displayError('Error: no customer').'</p>'; return '<p class="warning">'.Tools::displayError('Error: no customer').'</p>';
$address_delivery = new Address($this->context->cart->id_address_delivery); $address_delivery = new Address($this->context->cart->id_address_delivery);
$address_invoice = ($this->context->cart->id_address_delivery == $this->context->cart->id_address_invoice ? $address_delivery : new Address($this->context->cart->id_address_invoice)); $address_invoice = ($this->context->cart->id_address_delivery == $this->context->cart->id_address_invoice ? $address_delivery : new Address($this->context->cart->id_address_invoice));
if (!$this->context->cart->id_address_delivery OR !$this->context->cart->id_address_invoice OR !Validate::isLoadedObject($address_delivery) OR !Validate::isLoadedObject($address_invoice) OR $address_invoice->deleted OR $address_delivery->deleted) if (!$this->context->cart->id_address_delivery || !$this->context->cart->id_address_invoice || !Validate::isLoadedObject($address_delivery) || !Validate::isLoadedObject($address_invoice) || $address_invoice->deleted || $address_delivery->deleted)
return '<p class="warning">'.Tools::displayError('Error: please choose an address').'</p>'; return '<p class="warning">'.Tools::displayError('Error: please choose an address').'</p>';
if (count($this->context->cart->getDeliveryOptionList()) == 0) if (count($this->context->cart->getDeliveryOptionList()) == 0)
{ {
@@ -399,11 +409,11 @@ class OrderOpcControllerCore extends ParentOrderController
else else
return '<p class="warning">'.Tools::displayError('Error: There are no carriers available that deliver to this address').'</p>'; return '<p class="warning">'.Tools::displayError('Error: There are no carriers available that deliver to this address').'</p>';
} }
if (!$this->context->cart->getDeliveryOption() AND !$this->context->cart->isVirtualCart()) if (!$this->context->cart->getDeliveryOption() && !$this->context->cart->isVirtualCart())
return '<p class="warning">'.Tools::displayError('Error: please choose a carrier').'</p>'; return '<p class="warning">'.Tools::displayError('Error: please choose a carrier').'</p>';
if (!$this->context->cart->id_currency) if (!$this->context->cart->id_currency)
return '<p class="warning">'.Tools::displayError('Error: no currency has been selected').'</p>'; return '<p class="warning">'.Tools::displayError('Error: no currency has been selected').'</p>';
if (!$this->context->cookie->checkedTOS AND Configuration::get('PS_CONDITIONS')) if (!$this->context->cookie->checkedTOS && Configuration::get('PS_CONDITIONS'))
return '<p class="warning">'.Tools::displayError('Please accept Terms of Service').'</p>'; return '<p class="warning">'.Tools::displayError('Please accept Terms of Service').'</p>';
/* If some products have disappear */ /* If some products have disappear */
@@ -466,13 +476,9 @@ class OrderOpcControllerCore extends ParentOrderController
$this->context->smarty->assign($vars); $this->context->smarty->assign($vars);
if ($this->context->customer->id)
$groups = $this->context->customer->getGroups();
else
$groups = array(1);
if (!Address::isCountryActiveById((int)($this->context->cart->id_address_delivery)) && $this->context->cart->id_address_delivery != 0) if (!Address::isCountryActiveById((int)($this->context->cart->id_address_delivery)) && $this->context->cart->id_address_delivery != 0)
$this->errors[] = Tools::displayError('This address is not in a valid area.'); $this->errors[] = Tools::displayError('This address is not in a valid area.');
elseif ((!Validate::isLoadedObject($address_delivery) OR $address_delivery->deleted) && $this->context->cart->id_address_delivery != 0) elseif ((!Validate::isLoadedObject($address_delivery) || $address_delivery->deleted) && $this->context->cart->id_address_delivery != 0)
$this->errors[] = Tools::displayError('This address is invalid.'); $this->errors[] = Tools::displayError('This address is invalid.');
else else
{ {
@@ -487,7 +493,7 @@ class OrderOpcControllerCore extends ParentOrderController
Cart::addExtraCarriers($result); Cart::addExtraCarriers($result);
return $result; return $result;
} }
if (sizeof($this->errors)) if (count($this->errors))
return array( return array(
'hasError' => true, 'hasError' => true,
'errors' => $this->errors 'errors' => $this->errors
@@ -507,15 +513,14 @@ class OrderOpcControllerCore extends ParentOrderController
$inv_all_fields = array(); $inv_all_fields = array();
$dlv_all_fields = array(); $dlv_all_fields = array();
foreach (array('inv','dlv') as $adr_type) foreach (array('inv', 'dlv') as $adr_type)
{ {
foreach (${$adr_type.'_adr_fields'} as $fields_line) foreach (${$adr_type.'_adr_fields'} as $fields_line)
foreach(explode(' ',$fields_line) as $field_item) foreach (explode(' ', $fields_line) as $field_item)
${$adr_type.'_all_fields'}[] = trim($field_item); ${$adr_type.'_all_fields'}[] = trim($field_item);
$this->context->smarty->assign($adr_type.'_adr_fields', ${$adr_type.'_adr_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'}); $this->context->smarty->assign($adr_type.'_all_fields', ${$adr_type.'_all_fields'});
} }
} }
} }
+2 -2
View File
@@ -98,7 +98,7 @@ class ParentOrderControllerCore extends FrontController
$this->errors[] = Tools::displayError('Voucher code invalid'); $this->errors[] = Tools::displayError('Voucher code invalid');
else else
{ {
if ($cartRule = new CartRule(CartRule::getIdByCode($code)) AND Validate::isLoadedObject($cartRule)) if ($cartRule = new CartRule(CartRule::getIdByCode($code)) && Validate::isLoadedObject($cartRule))
{ {
if ($error = $cartRule->checkValidity($this->context)) if ($error = $cartRule->checkValidity($this->context))
$this->errors[] = $error; $this->errors[] = $error;
@@ -116,7 +116,7 @@ class ParentOrderControllerCore extends FrontController
'discount_name' => Tools::safeOutput($code) 'discount_name' => Tools::safeOutput($code)
)); ));
} }
elseif ($id_cart_rule = (int)Tools::getValue('deleteDiscount') AND Validate::isUnsignedId($id_cart_rule)) elseif ($id_cart_rule = (int)Tools::getValue('deleteDiscount') && Validate::isUnsignedId($id_cart_rule))
{ {
$this->context->cart->removeCartRule($id_cart_rule); $this->context->cart->removeCartRule($id_cart_rule);
Tools::redirect('index.php?controller=order-opc'); Tools::redirect('index.php?controller=order-opc');
+1 -1
View File
@@ -234,7 +234,7 @@ class ProductControllerCore extends FrontController
$id_shop = $this->context->shop->getID(true); $id_shop = $this->context->shop->getID(true);
$quantity_discounts = SpecificPrice::getQuantityDiscounts($id_product, $id_shop, $id_currency, $id_country, $id_group, null, true); $quantity_discounts = SpecificPrice::getQuantityDiscounts($id_product, $id_shop, $id_currency, $id_country, $id_group, null, true);
foreach($quantity_discounts as &$quantity_discount) foreach ($quantity_discounts as &$quantity_discount)
if ($quantity_discount['id_product_attribute']) if ($quantity_discount['id_product_attribute'])
{ {
$combination = new Combination((int)$quantity_discount['id_product_attribute']); $combination = new Combination((int)$quantity_discount['id_product_attribute']);