如何实现基于权重的magento动态计算价格? [英] how to implement dynamic calculating price in magento based on weight ?

查看:90
本文介绍了如何实现基于权重的magento动态计算价格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在Magento开发一个电子商务网站,用于珠宝业务,其电子商务网站基于重量",而不是价格,因为黄金价格每天都在变化,或者一天中发生着3次以上的变化.可以根据黄金价格每次更改产品价格.然后,如何在这种情况下管理价格?

Hi i’m developing a eCommerce site in Magento for jewellery business and its based on a "weight", not the price because gold rate is changing in day by day or more then 3 times in a day.So it is not possible to change the product price every time according to gold rate. Then, how to manage the prices on this scenario?

示例:今天我在网站上添加了一个10克的18K金戒指,现在的黄金价格为每10克30000卢比,所以今天这枚戒指的价格为30000卢比,但是,第二天价格将改变(每10克32,000卢比),那么我的产品价格必须从30,000卢比更改为32,000卢比.

Example case: Today I have added a 18K gold ring of 10gm to my site and right now gold rate is Rs30,000 per 10gm, so today price of this ring is Rs30,000 but, Next day the rate will be changed (Rs32,000 per 10gm) then, my product price must be changed from Rs30,000 to Rs32,000.

这不可能每次都更新所有产品的价格. 我正在使用Magento平台.请分享您对这种情况的想法.

This is not possible to update the price of all products every time. I am using Magento platform. Please, Share your idea regarding this situation.

推荐答案

要简单起见,您应该使用两种方法解决问题.

To make this simple, you should work on a 2 ways solutions.

在前端,不显示价格($ _product-> getPrice()),而只是根据重量显示实际价格.

In the frontend, do not show price ($_product->getPrice()) but just show the real price according to weight.

例如,如果您在后端存储了价格/grm,请使用$ product-> getWeight * Mage :: getStoreConfig('mycompany/gold/dayprice').

Example if you have price/grm stored in the backend use $product->getWeight * Mage::getStoreConfig('mycompany/gold/dayprice').

这样,价格将动态显示在产品页面或列表页面中.

That way price will be shown dynamically in the product page or list page.

现在,您应该在添加到购物车"事件上使用观察员"将价格更改为合适的价格.

Now you should use an Observer on the add to cart event to change the price to the good one.

通过这种方式,无论产品的价格是多少,因为显示和添加将使用公式.

This way, don't matter what price is set on the product because showing and adding will use the formulae.

这篇关于如何实现基于权重的magento动态计算价格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆