Merge branch 'ticket-12397-LinkCategoryWithDiscount' into develop
This commit is contained in:
commit
fce0de0f03
@ -955,9 +955,15 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
// Check contact infos
|
// Check contact infos
|
||||||
var phone_mobile = /^((\+|00)33\s?|0)[67](\s?\d{2}){4}$/i;
|
var phone_mobile = /^((\+|00)33\s?|0)[67](\s?\d{2}){4}$/i;
|
||||||
var phone_mobile_es = /^((\+|00)34\s?|0)[67](\s?\d{2}){4}$/i;
|
|
||||||
var phone_mobile_without_zero = /^[67](\s?\d{2}){4}$/i;
|
var phone_mobile_without_zero = /^[67](\s?\d{2}){4}$/i;
|
||||||
|
|
||||||
var phone_mobile_be = /^((\+|00)32\s?|0)4(60|[789]\d)(\s?\d{2}){3}$/i;
|
var phone_mobile_be = /^((\+|00)32\s?|0)4(60|[789]\d)(\s?\d{2}){3}$/i;
|
||||||
|
var phone_mobile_without_zero_be = /^4(60|[789]\d)(\s?\d{2}){3}$/i;
|
||||||
|
|
||||||
|
var phone_mobile_es = /^((\+|00)34\s?\d{1}|6)(\s?\d{2}){4}$/i;
|
||||||
|
|
||||||
|
var phone_mobile_it = /^(((\+|00)39\s?[03])|[03])(\s?\d{1}){9}$/i;
|
||||||
|
|
||||||
var email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/i;
|
var email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/i;
|
||||||
|
|
||||||
if (!email.test($('#custMail').val())) {
|
if (!email.test($('#custMail').val())) {
|
||||||
@ -973,15 +979,52 @@ $(document).ready(function () {
|
|||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($('#custPhone').val().length == 9 && !phone_mobile_without_zero.test($('#custPhone').val())){
|
if($('#sl-0-country').val() == 'FR') {
|
||||||
|
if($('#custPhone').val().length == 9 && !phone_mobile_without_zero.test($('#custPhone').val())) {
|
||||||
|
ev.preventDefault();
|
||||||
|
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0681010203 ou 0033681010203');
|
||||||
|
return (false);
|
||||||
|
} else if($('#custPhone').val().length > 9 && !(phone_mobile.test($('#custPhone').val()))) {
|
||||||
|
ev.preventDefault();
|
||||||
|
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0681010203 ou 0033681010203');
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($('#sl-0-country').val() == 'BE'){
|
||||||
|
if($('#custPhone').val().length == 9 && !(phone_mobile_without_zero_be.test($('#custPhone').val()))){
|
||||||
|
ev.preventDefault();
|
||||||
|
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0461010203 ou 0032461010203');
|
||||||
|
return (false);
|
||||||
|
}else if($('#custPhone').val().length > 9 && !(phone_mobile_be.test($('#custPhone').val()))) {
|
||||||
|
ev.preventDefault();
|
||||||
|
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0461010203 ou 0032461010203');
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($('#sl-0-country').val() == 'ES'){
|
||||||
|
if(!(phone_mobile_es.test($('#custPhone').val()))) {
|
||||||
|
ev.preventDefault();
|
||||||
|
alert($('#error-mobile-invalid').val() + '\n\nFormat : 610102031 ou 0034610102031');
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($('#sl-0-country').val() == 'IT' && !(phone_mobile_it.test($('#custPhone').val()))){
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0661010203');
|
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0661010203 / 3354765864 ou 00390661010203 / 00393354765864');
|
||||||
return (false);
|
|
||||||
} else if($('#custPhone').val().length > 9 && !(phone_mobile.test($('#custPhone').val()) || phone_mobile_be.test($('#custPhone').val()))) {
|
|
||||||
ev.preventDefault();
|
|
||||||
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0681010203');
|
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
// if($('#custPhone').val().length == 9 && !phone_mobile_without_zero.test($('#custPhone').val())){
|
||||||
|
// ev.preventDefault();
|
||||||
|
// alert($('#error-mobile-invalid').val() + '\n\nFormat : 0661010203');
|
||||||
|
// return (false);
|
||||||
|
// } else if($('#custPhone').val().length > 9 && !(phone_mobile.test($('#custPhone').val()) || phone_mobile_be.test($('#custPhone').val()))) {
|
||||||
|
// ev.preventDefault();
|
||||||
|
// alert($('#error-mobile-invalid').val() + '\n\nFormat : 0681010203');
|
||||||
|
// return (false);
|
||||||
|
// }
|
||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
});
|
});
|
||||||
|
@ -884,20 +884,30 @@ class Cart extends CartCore {
|
|||||||
$total_cart += $discountObj->include_tax ? $product['total_wt'] : $product['total'];
|
$total_cart += $discountObj->include_tax ? $product['total_wt'] : $product['total'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// $categories = Discount::getCategories($discountObj->id);
|
// @Override Antadis - check discount category
|
||||||
// $returnErrorNoProductCategory = true;
|
$categories = Discount::getCategories($discountObj->id);
|
||||||
// foreach($products AS $product)
|
$returnErrorNoProductCategory = true;
|
||||||
// {
|
foreach($products AS $product)
|
||||||
// if (count($categories))
|
{
|
||||||
// if (Product::idIsOnCategoryId($product['id_product'], $categories))
|
if (count($categories)) {
|
||||||
// {
|
if (Product::idIsOnCategoryId($product['id_product'], $categories))
|
||||||
// if ((!$discountObj->cumulable_reduction AND !$product['reduction_applies'] AND !$product['on_sale']) OR $discountObj->cumulable_reduction)
|
{
|
||||||
// $total_cart += $discountObj->include_tax ? $product['total_wt'] : $product['total'];
|
if ((!$discountObj->cumulable_reduction AND !$product['reduction_applies'] AND !$product['on_sale']) OR $discountObj->cumulable_reduction)
|
||||||
// $returnErrorNoProductCategory = false;
|
$total_cart += $discountObj->include_tax ? $product['total_wt'] : $product['total'];
|
||||||
// }
|
$returnErrorNoProductCategory = false;
|
||||||
// }
|
} else {
|
||||||
// if ($returnErrorNoProductCategory)
|
$returnErrorNoProductCategory = true;
|
||||||
// return Tools::displayError('This discount does not apply to that product category.');
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$returnErrorNoProductCategory = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// @End Override Antadis - check discount category
|
||||||
|
|
||||||
|
if ($returnErrorNoProductCategory) {
|
||||||
|
return Tools::displayError('This discount does not apply to that product category.');
|
||||||
|
}
|
||||||
|
|
||||||
if ($total_cart < $discountObj->minimal)
|
if ($total_cart < $discountObj->minimal)
|
||||||
return Tools::displayError('The order total is not high enough or this voucher cannot be used with those products.');
|
return Tools::displayError('The order total is not high enough or this voucher cannot be used with those products.');
|
||||||
@ -924,20 +934,27 @@ class Cart extends CartCore {
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'discount` d ON c.`id_discount` = d.`id_discount`
|
LEFT JOIN `'._DB_PREFIX_.'discount` d ON c.`id_discount` = d.`id_discount`
|
||||||
WHERE `id_cart` = '.(int)($this->id));
|
WHERE `id_cart` = '.(int)($this->id));
|
||||||
|
|
||||||
// $products = $this->getProducts();
|
// @Override Antadis - check discount category
|
||||||
// foreach ($result AS $k => $discount)
|
$products = $this->getProducts();
|
||||||
// {
|
foreach ($result AS $k => $discount)
|
||||||
// $categories = Discount::getCategories((int)($discount['id_discount']));
|
{
|
||||||
// $in_category = false;
|
$categories = Discount::getCategories((int)($discount['id_discount']));
|
||||||
// foreach ($products AS $product)
|
if(count($categories)) {
|
||||||
// if (Product::idIsOnCategoryId((int)($product['id_product']), $categories))
|
$in_category = false;
|
||||||
// {
|
foreach ($products AS $product) {
|
||||||
// $in_category = true;
|
if (Product::idIsOnCategoryId((int)($product['id_product']), $categories))
|
||||||
// break;
|
{
|
||||||
// }
|
$in_category = true;
|
||||||
// if (!$in_category)
|
} else{
|
||||||
// unset($result[$k]);
|
$in_category = false;
|
||||||
// }
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$in_category)
|
||||||
|
unset($result[$k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// @End Override Antadis - check discount category
|
||||||
|
|
||||||
if ($lite)
|
if ($lite)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user