简体   繁体   中英

How to Observe 'add to cart' multiple option of a product

I am new to Magento.I have extended core module Mage: checkout/cart to add to cart with multiple options of product. How can I use the observer with the following event : controller_action_predispatch_checkout_cart_add

My code:

config.xml

<controller_action_predispatch_checkout_cart_add>
            <observers>
                <flycart_disable_shopping_cart_page>
                    <type>singleton</type>
                    <class>flycart/observer</class>
                    <method>cartAdd</method>
                </flycart_disable_shopping_cart_page>
            </observers> 
        </controller_action_predispatch_checkout_cart_add>

file Observer.php

    <?php   class Custom_Flycart_Model_Observer{    
public function cartAdd(){
    // CODE Here    }
        }?>

How to can I get multiple product in array post: This is post

在此处输入图片说明

I don't know how to use observers in the Magento.

Use Mage::app()->getRequest()->getParams() in our Observer.php file

It will return array of all parameters sent to called controller's action

Hope this helps you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM