// Normalization: replacing spaces by tabulations
This commit is contained in:
+76
-76
@@ -104,9 +104,9 @@ class CartRuleCore extends ObjectModel
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ObjectModel::add()
|
* @see ObjectModel::add()
|
||||||
*/
|
*/
|
||||||
public function add($autodate = true, $nullValues = false)
|
public function add($autodate = true, $nullValues = false)
|
||||||
{
|
{
|
||||||
if (!parent::add($autodate, $nullValues))
|
if (!parent::add($autodate, $nullValues))
|
||||||
@@ -116,9 +116,9 @@ class CartRuleCore extends ObjectModel
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ObjectModel::delete()
|
* @see ObjectModel::delete()
|
||||||
*/
|
*/
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
if (!parent::delete())
|
if (!parent::delete())
|
||||||
@@ -139,13 +139,13 @@ class CartRuleCore extends ObjectModel
|
|||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy conditions from one cart rule to an other
|
* Copy conditions from one cart rule to an other
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @param int $id_cart_rule_source
|
* @param int $id_cart_rule_source
|
||||||
* @param int $id_cart_rule_destination
|
* @param int $id_cart_rule_destination
|
||||||
*/
|
*/
|
||||||
public static function copyConditions($id_cart_rule_source, $id_cart_rule_destination)
|
public static function copyConditions($id_cart_rule_source, $id_cart_rule_destination)
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->Execute('
|
||||||
@@ -170,30 +170,30 @@ class CartRuleCore extends ObjectModel
|
|||||||
// Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cart_rule_product_rule_value` WHERE `id_product_rule` NOT IN (SELECT `id_product_rule` FROM `'._DB_PREFIX_.'cart_rule_product_rule`)');
|
// Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'cart_rule_product_rule_value` WHERE `id_product_rule` NOT IN (SELECT `id_product_rule` FROM `'._DB_PREFIX_.'cart_rule_product_rule`)');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the id associated to the given code
|
* Retrieves the id associated to the given code
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @param string $code
|
* @param string $code
|
||||||
* @return int|bool
|
* @return int|bool
|
||||||
*/
|
*/
|
||||||
public static function getIdByCode($code)
|
public static function getIdByCode($code)
|
||||||
{
|
{
|
||||||
if (!Validate::isDiscountName($code))
|
if (!Validate::isDiscountName($code))
|
||||||
return false;
|
return false;
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `id_cart_rule` FROM `'._DB_PREFIX_.'cart_rule` WHERE `code` = \''.pSQL($code).'\'');
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `id_cart_rule` FROM `'._DB_PREFIX_.'cart_rule` WHERE `code` = \''.pSQL($code).'\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param $id_lang
|
* @param $id_lang
|
||||||
* @param $id_customer
|
* @param $id_customer
|
||||||
* @param bool $active
|
* @param bool $active
|
||||||
* @param bool $includeGeneric
|
* @param bool $includeGeneric
|
||||||
* @param bool $inStock
|
* @param bool $inStock
|
||||||
* @param Cart|null $cart
|
* @param Cart|null $cart
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getCustomerCartRules($id_lang, $id_customer, $active = false, $includeGeneric = true, $inStock = false, Cart $cart = null)
|
public static function getCustomerCartRules($id_lang, $id_customer, $active = false, $includeGeneric = true, $inStock = false, Cart $cart = null)
|
||||||
{
|
{
|
||||||
if (!CartRule::isFeatureActive())
|
if (!CartRule::isFeatureActive())
|
||||||
@@ -228,10 +228,10 @@ class CartRuleCore extends ObjectModel
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id_customer
|
* @param $id_customer
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function usedByCustomer($id_customer)
|
public function usedByCustomer($id_customer)
|
||||||
{
|
{
|
||||||
return (bool)Db::getInstance()->getValue('
|
return (bool)Db::getInstance()->getValue('
|
||||||
@@ -242,11 +242,11 @@ class CartRuleCore extends ObjectModel
|
|||||||
AND o.`id_customer` = '.(int)$id_customer);
|
AND o.`id_customer` = '.(int)$id_customer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param $name
|
* @param $name
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function cartRuleExists($name)
|
public static function cartRuleExists($name)
|
||||||
{
|
{
|
||||||
if (!CartRule::isFeatureActive())
|
if (!CartRule::isFeatureActive())
|
||||||
@@ -258,11 +258,11 @@ class CartRuleCore extends ObjectModel
|
|||||||
WHERE `code` = \''.pSQL($name).'\'');
|
WHERE `code` = \''.pSQL($name).'\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param $id_customer
|
* @param $id_customer
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function deleteByIdCustomer($id_customer)
|
public static function deleteByIdCustomer($id_customer)
|
||||||
{
|
{
|
||||||
$return = true;
|
$return = true;
|
||||||
@@ -273,9 +273,9 @@ class CartRuleCore extends ObjectModel
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getProductRuleGroups()
|
public function getProductRuleGroups()
|
||||||
{
|
{
|
||||||
if (!Validate::isLoadedObject($this) || $this->product_restriction == 0)
|
if (!Validate::isLoadedObject($this) || $this->product_restriction == 0)
|
||||||
@@ -295,10 +295,10 @@ class CartRuleCore extends ObjectModel
|
|||||||
return $productRuleGroups;
|
return $productRuleGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id_product_rule_group
|
* @param $id_product_rule_group
|
||||||
* @return array ('type' => ? , 'values' => ?)
|
* @return array ('type' => ? , 'values' => ?)
|
||||||
*/
|
*/
|
||||||
public function getProductRules($id_product_rule_group)
|
public function getProductRules($id_product_rule_group)
|
||||||
{
|
{
|
||||||
if (!Validate::isLoadedObject($this) || $this->product_restriction == 0)
|
if (!Validate::isLoadedObject($this) || $this->product_restriction == 0)
|
||||||
@@ -320,13 +320,13 @@ class CartRuleCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Todo : Add shop management
|
// Todo : Add shop management
|
||||||
/**
|
/**
|
||||||
* Check if this cart rule can be applied
|
* Check if this cart rule can be applied
|
||||||
*
|
*
|
||||||
* @param Context $context
|
* @param Context $context
|
||||||
* @param bool $alreadyInCart
|
* @param bool $alreadyInCart
|
||||||
* @return bool|mixed|string
|
* @return bool|mixed|string
|
||||||
*/
|
*/
|
||||||
public function checkValidity(Context $context, $alreadyInCart = false)
|
public function checkValidity(Context $context, $alreadyInCart = false)
|
||||||
{
|
{
|
||||||
if (!CartRule::isFeatureActive())
|
if (!CartRule::isFeatureActive())
|
||||||
@@ -779,7 +779,7 @@ class CartRuleCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $reduction_value;
|
return $reduction_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCartRuleCombinations()
|
protected function getCartRuleCombinations()
|
||||||
{
|
{
|
||||||
@@ -872,11 +872,11 @@ class CartRuleCore extends ObjectModel
|
|||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param Context|null $context
|
* @param Context|null $context
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function autoAddToCart(Context $context = null)
|
public static function autoAddToCart(Context $context = null)
|
||||||
{
|
{
|
||||||
if ($context === null)
|
if ($context === null)
|
||||||
@@ -936,21 +936,21 @@ class CartRuleCore extends ObjectModel
|
|||||||
$context->cart->addCartRule($cartRule->id);
|
$context->cart->addCartRule($cartRule->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function isFeatureActive()
|
public static function isFeatureActive()
|
||||||
{
|
{
|
||||||
return (bool)Configuration::get('PS_CART_RULE_FEATURE_ACTIVE');
|
return (bool)Configuration::get('PS_CART_RULE_FEATURE_ACTIVE');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param $id_lang
|
* @param $id_lang
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getCartsRuleByCode($name, $id_lang)
|
public static function getCartsRuleByCode($name, $id_lang)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->ExecuteS('
|
return Db::getInstance()->ExecuteS('
|
||||||
|
|||||||
Reference in New Issue
Block a user