Custom shopping cart rules?

I made a coupon [coupon_code = SWIMFREE] if category swimming equipment, and hobby- swimming, the discount will be 50%.

and now I have a problem with checking in 3 steps. Here's a description ...

  • Shopping Basket : Applies to Coupon
  • First step : sending and billing Address
  • Second step . Choose your hobby (there are more sales_flat_quote table, sales_flat_quote_hobby)
  • Final Step : Checkout-> Overview

What I wanted : when the coupon is applied and the hobby is swimming, the third step is changing the price to evaluate each product, and the coupon is still shown there.

How to intercept a coupon after a hobby step?


An example step by step:

1. The cart has already been added

  • 100 $( ).
  • 50 $( ).
  • SWIMFREE, Grand Total - 100 $(- )

2.

  • -

3.

  • ()

4. ""

  • 50 $( ).
  • 50 $( ).
  • SWIMFREE, Grand Total 150 $( ).

, , , sales_flat_quote_hobby

Sales/Model/Quote/Subtotal.php, , .

+5
3

:

.

coupon example

Mage_SalesRule_Model_Rule_Condition_Product

    public function validate(Varien_Object $object){
        if ($this->getAttribute() == 'quote_item_with_hobby') {

            $quote = Mage::getSingleton('checkout/cart')->getQuote();
            $hobby= $quote->getHobbyByItemId($object->getId());

            if ($hobby){
                if ($this->getOperator() == '=='){
                    if (strtolower($this->getValue()) == $hobby->getHobby()) return true;
                    else return false;
                }
                else if ($this->getOperator() == '!='){
                    if (strtolower($this->getValue()) == $hobby->getHobby()) return false;
                    else return true;
                }

            }
            return true;
        }

        return parent::validate($object);
    }

. , true, , return false, .

, . .

+5

. Mage_SalesRule_Model_Quote_Discount.
: . fooobar.com/questions/1122981/..., .

+1

All Articles