如何在magento中为类别设置最低订购量(MOQ)? [英] How to set Minimum Order Quantiy (MOQ) for a category in magento?

查看:31
本文介绍了如何在magento中为类别设置最低订购量(MOQ)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为类别添加购物车中允许的最小数量".

How to add Minimum Qty Allowed in Shopping Cart for a category.

在Magento(版本1.6.2.0)后端中,系统>配置>库存>产品库存选项选项卡,可以为客户组"设置购物车中允许的最小数量";不适用于类别.

In Magento (ver. 1.6.2.0) backend, System > Configuration > Inventory > Product Stock Options tab, you can set the 'Minimum Qty Allowed in Shopping Cart' but for Customer Group; not for Category.

我们有很多类别的商品绝对不同,并且需要特定类别的最小起订量.

We have lots of categories having absolutely different kinds of items and need different MOQs for specified category.

我将如何强制至少6种珠宝类别的产品和7种胸罩类别的产品?

How would I force a minimum of 6 products from the jewellery category and 7 dozen from the bra category?

谢谢萨满

推荐答案

Magento本身无法实现您所描述的内容.Magento原生提供与类别和产品的1:1:1关系,

What you describe would not be natively possible with Magento. Magento natively provides a 1:many relationship with categories and products,

即.产品可以分为许多类别

Ie. A product can be in many categories

您提出的建议会导致产品出现竞争条件,如果该产品存在多个类别,则该产品的库存控制可能有两个可能的标准.

What you propose would induce a race condition for a product whereby there could be 2 possible critera for a product's inventory controls if the product exists in more than one category.

例如.如果您将类别A MOQ 设置为6,并且将 Category B MOQ 设置为10,产品C 都存在-它继承哪个规则(最高/最低)?

Eg. If you set Category A to have a MOQ of 6, and Category B to have a MOQ of 10 and Product C exists in both - which rule does it inherit (highest/lowest)?

因此,这在本地是不可能的,但是您可以构建一个自定义模块来实现它.

As a result, this isn't going to be natively possible, but you could build a custom module to achieve it.

通过 category-&s; save()观察者

Via a category->save() observer

您可以为类别创建一个自定义属性-MOQ,然后让您的模块侦听"类别保存,并相应地遍历所有产品以设置所述产品的MOQ.

You could create a custom attribute for the category - MOQ, then have your module 'listen' to the category save, and iterate through all products accordingly to set the MOQ for said products.

优势-每个产品的控制更加精细,前端速度不会受到影响/开销

Advantages - More granular control per product, no speed impact/overheads for frontend

缺点-保存类别的速度慢

通过修改 isSaleable()函数

By modifying the isSaleable() function

您可以重写确定产品是否可销售的标准功能.在修改后的函数中,检查所述产品的类别,获取最小起订量(最高/最低- ),然后返回true; return false;

You could rewrite the standard function which determines if a product is saleable. In your modified function, check categories of said product, obtain the MOQ (highest/lowest - whichever) then return true; or return false; accordingly.

优势-更少的管理麻烦,不再需要不必要地在产品级别持续更新索引

Advantages - Less administration hanging around, stops having to continually update indexes at a product level needlessly

缺点-检查产品是否可销售的速度较慢(前端似乎较慢)

Disadvantages - Slower to check if product is saleable (frontend would seem slower)

无论哪种方式,您都需要构建一个自定义模块,或者寻找专业人员来为您量身定制一个模块.

Either way, you need to build a custom module, or seek a professional to make one for you.

这篇关于如何在magento中为类别设置最低订购量(MOQ)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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