Merge branch 'ticket-14666-appli-discount' into develop
This commit is contained in:
commit
dd3b834e44
@ -840,10 +840,9 @@ class Cart extends CartCore {
|
||||
if (!$order_total)
|
||||
return Tools::displayError('Cannot add voucher if order is free.');
|
||||
|
||||
// Ony for API (application)
|
||||
$subdomain = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], '.'));
|
||||
if ($subdomain != 'api' && $discountObj->appli == 1) {
|
||||
return Tools::displayError('This voucher is not valid');
|
||||
// Only for API (application)
|
||||
if (!Tools::isApi() && $discountObj->appli == 1) {
|
||||
return Tools::displayError('This voucher is only valid on the application');
|
||||
}
|
||||
|
||||
if (!$discountObj->active)
|
||||
|
@ -128,5 +128,14 @@ class Tools extends ToolsCore {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static function isApi()
|
||||
{
|
||||
$subdomain = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], '.'));
|
||||
if ($subdomain == 'api') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user