首页 文章

Magento Cart规则BUG - 在“小于”和可配置产品时错误应用

提问于
浏览
0

我刚刚发现Magento似乎有一个关于购物车规则的1.8的错误 .

让's say we have some configurable products and want to add a 3034935 for a specific product if the qty is less then 50. In my case it a surcharge not a discount (you can easily add negative discount so it' ll通过更改两个文件来收取附加费,请参阅http://php.quicoto.com/extra-fee-shopping-cart-price-rules-magento/) .

那么magento做什么?

1)检查规则是否对该产品有效2)如果不是,它检查它是否是可配置产品,然后获取第一个简单产品,并检查规则 .

在这种情况下,真正的原因数量小于50(因为这个简单的产品甚至不在购物车....)

将规则扩展到“少于50且超过1”并没有奏效 .

$product = $object->getProduct();
    if (!($product instanceof Mage_Catalog_Model_Product)) {
        $product = Mage::getModel('catalog/product')->load($object->getProductId());
    } 
    // here, everythign correct. $valid is false cause item is less then x times in cart..
    $valid = parent::validate($object);  



// this part makes no sense, cause he's checking on a child which is not in cart.
     /** /
     if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
        $children = $object->getChildren();
        $valid = $children && $this->validate($children[0]);
    }/**/

这个小片段与它有关,在我看来它没有任何意义 . 为什么应该根据可配置的第一个产品检查规则?为什么要随机检查一些其他产品的规则?

有没有人对此有所了解?

我现在的解决方案,只是评论这一行...... ;-)并且规则得到应用 .

迎接费利克斯

here's an image about the rule in magento backend

1 回答

  • 0

    看起来 $objectMage_Sales_Quote_Item 的实例 . 如果是这样,它解释了为什么要对第一个孩子检查规则 - 因为它是购物车中可配置产品的子项 the only . 它不能同时包含购物车中特定可配置产品的一个子项

相关问题