[-] FO : free gift fixed

This commit is contained in:
dMetzger
2012-01-26 17:17:18 +00:00
parent a715093000
commit 47debd52ae
4 changed files with 5 additions and 34 deletions
+3 -7
View File
@@ -274,8 +274,6 @@ class CartCore extends ObjectModel
public function getCartRules()
{
// TODO : add cache
// If the cart has not been saved, then there can't be any cart rule applied
if (!CartRule::isFeatureActive() || !$this->id)
return array();
@@ -307,15 +305,11 @@ class CartCore extends ObjectModel
$row['description'] = $row['name'];
}
// TODO Clean the following line, this line generate bug because getCartRule method not exists
//$results = $this->getCartRule();
return $result;
}
public function getDiscountsCustomer($id_cart_rule)
{
// Todo: see uses and change name
if (!CartRule::isFeatureActive())
return 0;
@@ -703,6 +697,9 @@ class CartCore extends ObjectModel
'id_cart' => (int)$this->id
)))
return false;
if ((int)$cartRule->gift_product)
return $this->updateQty(1, $cartRule->gift_product);
return true;
}
@@ -1303,7 +1300,6 @@ class CartCore extends ObjectModel
$order_total_products = $order_total;
// Todo: consider optimizations
if ($type == Cart::ONLY_DISCOUNTS)
$order_total = 0;
+1 -1
View File
@@ -58,7 +58,7 @@ class OrderCartRuleCore extends ObjectModel
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_cart_rule' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_order_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true),
'value' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
'value_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true)
)