简体   繁体   English

如何观察产品的“添加到购物车”多个选项

[英]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. 我是Magento的新手,我扩展了核心模块Mage:将结帐/购物车添加到购物车,并提供多种产品选择。 How can I use the observer with the following event : controller_action_predispatch_checkout_cart_add 如何将观察者与以下事件一起使用: 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 文件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. 我不知道如何在Magento中使用观察者。

Use Mage::app()->getRequest()->getParams() in our Observer.php file 在我们的Observer.php文件中使用Mage::app()->getRequest()->getParams()

It will return array of all parameters sent to called controller's action 它将返回发送给被调用控制器动作的所有参数的数组

Hope this helps you 希望这对您有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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