Merge branch 'ticket-13564-giftOnShoppingCart' into develop
This commit is contained in:
commit
e20992d824
@ -310,7 +310,11 @@ class CartController extends CartControllerCore
|
||||
self::$cart->gift_message = '';
|
||||
} elseif(Tools::getValue('action') == 'add_message'){
|
||||
self::$cart->gift = 1;
|
||||
self::$cart->gift_message = strip_tags(Tools::getValue('message'));
|
||||
if (!Validate::isMessage(Tools::getValue('message')) {
|
||||
die('{"hasError" : true, "errors" : ["'.Tools::displayError('Invalid gift message.', false).'"]}');
|
||||
} else {
|
||||
self::$cart->gift_message = strip_tags(Tools::getValue('message'));
|
||||
}
|
||||
}
|
||||
|
||||
if(self::$cart->update()){
|
||||
|
@ -262,13 +262,37 @@ class ParentOrderController extends ParentOrderControllerCore {
|
||||
// }
|
||||
|
||||
if(count($this->errors) === 0) {
|
||||
parent::_processCarrier();
|
||||
//parent::_processCarrier();
|
||||
$this->_processCarrierCustom();
|
||||
}
|
||||
} else {
|
||||
parent::_processCarrier();
|
||||
//parent::_processCarrier();
|
||||
$this->_processCarrierCustom();
|
||||
}
|
||||
}
|
||||
|
||||
public function _processCarrierCustom() {
|
||||
self::$cart->recyclable = (int)(Tools::getValue('recyclable'));
|
||||
|
||||
if (isset(self::$cookie->id_customer) AND self::$cookie->id_customer)
|
||||
{
|
||||
$address = new Address((int)(self::$cart->id_address_delivery));
|
||||
if (!($id_zone = Address::getZoneById($address->id)))
|
||||
$this->errors[] = Tools::displayError('No zone match with your address');
|
||||
}
|
||||
else
|
||||
$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))))
|
||||
self::$cart->id_carrier = (int)(Tools::getValue('id_carrier'));
|
||||
elseif (!self::$cart->isVirtualCart() AND (int)(Tools::getValue('id_carrier')) == 0)
|
||||
$this->errors[] = Tools::displayError('Invalid carrier or no carrier selected');
|
||||
|
||||
Module::hookExec('processCarrier', array('cart' => self::$cart));
|
||||
|
||||
return self::$cart->update();
|
||||
}
|
||||
|
||||
public function setMedia() {
|
||||
parent::setMedia();
|
||||
|
||||
|
@ -541,7 +541,7 @@ function giftMessage(add, next, all){
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user