开发者

Event Observer - Trigger an event

开发者 https://www.devze.com 2023-03-16 15:56 出处:网络
I would like to create an event observer that I want to show a message / alert box when total weight of cart surpass 23 kg (to tell the truth, I want an event to check weight limit and trigger the ale

I would like to create an event observer that I want to show a message / alert box when total weight of cart surpass 23 kg (to tell the truth, I want an event to check weight limit and trigger the alert box when customer add a product to cart).

Could anybody help me to make s开发者_运维知识库uch an observer?


You don't need anything so involved...

Already you have been given the code to write the weight out, put this code in a block, put it in the header (or even your cart sidebar) and add an IF statement.

Don't just put

if($weight>23) { echo "Too Heavy - Shopping Cart is going to burst itselves!" }

put a custom variable in admin and compare it against that. In that weigh, if you change courier then your customer can update the max weight.


This link could help you :

http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method

If you have SSH access, grep 'dispatchEvent' to get the list of all events

0

精彩评论

暂无评论...
验证码 换一张
取 消