Magento - 如何设置类别的每个订单的最小产品数量?

发布于 2024-09-30 07:01:01 字数 126 浏览 4 评论 0原文

是否可以在 Magento 中设置每个订单类别所需的最小产品数量。一位客户销售野生动物画作,商店类别之一是“卡片”,一次运送少于 6 张的成本效益不高。

我如何强制卡片类别中至少有 6 种产品?

谢谢, 担

Is it possible to set the minimum number of products required for a category per order in Magento. A client sells wildlife paintings, one of the shop categories is 'cards', it isn't very cost effective to ship less than 6 of these at a time.

How would I force a minimum of 6 products from the cards category?

Thanks,
Dan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

带上头具痛哭 2024-10-07 07:01:01

如果从商业角度来看,您可以要求用户购买一定数量的卡,B00MER 的建议可能是最简单的途径。缺点是他们需要订购多张同一张卡。

如果您需要允许使用多张不同的卡并仍强制实施限制,请考虑对整个购物车使用最低订单金额。这将涵盖其他产品的小批量运输无法盈利的情况。

如果这不起作用,请考虑使用表费率运输并将其用作无利可图订单的手续费。或者所有订单的手续费。

如果这不起作用,据我所知,您需要按照您的描述进行一些自定义代码检查。对于属于多个子类别等的产品,这将如何运作?绝对可行,但语义可能很奇怪。

希望有帮助!

谢谢,

B00MER's suggestion is probably the easiest path if, from a business perspective, you can require users to buy the cards in certain quantities. The downside will be that they will be required to order multiples of the same card.

If you need to allow multiple different cards and still enforce limits, consider using a minimum order amount for the entire cart. This will cover cases of other products where shipping small quantities is not profitable.

If that doesn't work, consider using table rate shipping and using that as a handling fee for unprofitable orders. Or a handling fee for all orders.

If that doesn't work, AFAIK, you'll need to do some custom code checks as you describe. How would this work with products that are in several subcategories and so forth? Definitely doable, but the semantics may be odd.

Hope that helps!

Thanks,
Joe

ㄖ落Θ余辉 2024-10-07 07:01:01

作为替代建议,请考虑创建购物车价格规则,该规则虽然不会阻止较小的数量,但可以为潜在客户提供鼓励。

例如,规则可能具有以下条件:

  • 产品属性组合(如果找到某个商品等...)
  • 购物车中的数量等于或大于 6
  • 属性集是您专门使用的集卡片

,然后为这些卡片提供免费送货服务。

As an alternative suggestion consider creating a cart price rule that, while not preventing smaller quantities, can offer encouragements to potential customers.

For example a rule might have the conditions:

  • Product attribute combination (If an item is FOUND etc...)
  • Quantity in cart equals or is greater than 6
  • Attribute set is whichever set you use exclusively for cards

and then offer free shipping on those cards.

焚却相思 2024-10-07 07:01:01

当订单还包含更大的东西(例如画布绘画)时,大概运输卡片的成本可以忽略不计。
将您选择的运输方式的最小重量设置为 1 磅,并将每张卡片的重量设置为 0.18(五分之一到六分之一之间)。这样一来,顾客必须同时购买至少 5 个其他商品或一些重物。

Presumably the cost of shipping a card is negligible when an order also contains something much bigger, like a canvas painting.
Set the minimum weight of your chosen shipping method to something like 1 Lb and the weight of each card to 0.18 (between one fifth and one sixth). That way a customer has to buy at least 5 others or something heavy at the same time.

箹锭⒈辈孓 2024-10-07 07:01:01

我不知道类别,但如果您想添加单个产品页面允许的最小数量,有一种圆形的方法可以做到这一点。

像平常一样使用 Magento 创建产品页面。创建完成后,转到该页面并查看源代码。获取所有代码并将其转储到编辑器(即记事本++)中。从那里向下滚动代码,直到大约第 560-580 行,具体取决于您的布局。您应该找到 javascript 函数:

 productAddToCartForm.submit = function(button, url) {
        if (this.validator.validate()) {
            var form = this.form;
            var oldUrl = form.action;

            if (url) {
               form.action = url;
            }
            var e = null;
            try {
                this.form.submit();
            } catch (e) {
            }
            this.form.action = oldUrl;
            if (e) {
                throw e;
            }

            if (button && button != 'undefined') {
                button.disabled = true;
            }
        }

    }.bind(productAddToCartForm);

从这里您可以将其编辑为类似于以下内容:

productAddToCartForm.submit = function(button, url) {
    var LJSM1 = parseFloat(document.getElementById('bundle-option-1-qty-input').value);
    var L2 = parseFloat(document.getElementById('bundle-option-2-qty-input').value);
    var L3 = parseFloat(document.getElementById('bundle-option-3-qty-input').value);
    var L4 = parseFloat(document.getElementById('bundle-option-4-qty-input').value);
    var L5 = parseFloat(document.getElementById('bundle-option-7-qty-input').value);
    var L6 = parseFloat(document.getElementById('bundle-option-6-qty-input').value);
        if (this.validator.validate()) {
        if((L1+L2+L3+L4+L5+L6) <= 15){
        alert("Sorry you are below the minimum order. Please increase your order to 16 or more to continue.");
        }
        else{
            var form = this.form;
            var oldUrl = form.action;

            if (url) {
               form.action = url;
            }
            var e = null;
            try {
                this.form.submit();
            } catch (e) {
            }
            this.form.action = oldUrl;
            if (e) {
                throw e;
            }

            if (button && button != 'undefined') {
                button.disabled = true;
            }
        }
        }
    }.bind(productAddToCartForm);

在我的例子中,我添加了一个简单的 if/else 语句,并调用页面内的选项,并将它们分配给一个变量,然后我对其求和。

修改此代码后,您可以将其保存到与原始页面 URL 同名的 .html 文件,然后将其上传到 magento 目录的根目录。这充当原始页面的一种掩码,因此当浏览产品时,您将被定向到此页面而不是原始的 Magento 页面。购物车、选项和 java 脚本仍然可以工作,一切都会正常进行。唯一的缺点是,当您获取代码时,无论页面看起来是什么样子,其他人都会看到这样的页面。因此,我建议删除购物车、产品比较以及其他任何具有唯一数据的代码,以免造成任何混淆。最重要的是,如果您对原始 Magento 页面或主题进行任何更改,您将必须非常快速地再次运行该过程以更新代码。

I don't know about Categories but if you want to add a minimum quantity allowed for a single product page there is a round about way of doing it.

Using Magento create the product page as you normally would. Once created go to the page and view the source code. Grab all of the code and dump it into a editor (i.e. notepad++). From there scroll down through the code until about line 560-580 depending on your layout. You should find the javascript function:

 productAddToCartForm.submit = function(button, url) {
        if (this.validator.validate()) {
            var form = this.form;
            var oldUrl = form.action;

            if (url) {
               form.action = url;
            }
            var e = null;
            try {
                this.form.submit();
            } catch (e) {
            }
            this.form.action = oldUrl;
            if (e) {
                throw e;
            }

            if (button && button != 'undefined') {
                button.disabled = true;
            }
        }

    }.bind(productAddToCartForm);

From here you would edit it to look like something similar to this:

productAddToCartForm.submit = function(button, url) {
    var LJSM1 = parseFloat(document.getElementById('bundle-option-1-qty-input').value);
    var L2 = parseFloat(document.getElementById('bundle-option-2-qty-input').value);
    var L3 = parseFloat(document.getElementById('bundle-option-3-qty-input').value);
    var L4 = parseFloat(document.getElementById('bundle-option-4-qty-input').value);
    var L5 = parseFloat(document.getElementById('bundle-option-7-qty-input').value);
    var L6 = parseFloat(document.getElementById('bundle-option-6-qty-input').value);
        if (this.validator.validate()) {
        if((L1+L2+L3+L4+L5+L6) <= 15){
        alert("Sorry you are below the minimum order. Please increase your order to 16 or more to continue.");
        }
        else{
            var form = this.form;
            var oldUrl = form.action;

            if (url) {
               form.action = url;
            }
            var e = null;
            try {
                this.form.submit();
            } catch (e) {
            }
            this.form.action = oldUrl;
            if (e) {
                throw e;
            }

            if (button && button != 'undefined') {
                button.disabled = true;
            }
        }
        }
    }.bind(productAddToCartForm);

In my case I added a simple if/else statement and called the options within the page and assigned them to a variable which I then summed.

After you have modified this code you can then save it to a .html file with the same name as the original page's URL and then upload it to the root of your magento directory. This acts as a sort of mask to the original page and so when browsing to the product you will be directed to this page instead of the original Magento page. The shopping cart, options, and java script will still work and everything will act normally. The only downsides are that whatever the page looked like when you grabbed the code is what it will look like to everyone else. So I recommend deleting the code for your shopping cart, product compare, and anything else that would have unique data so that there isn't any confusion. On top of that if you make any changes to the original Magento page or to your themes you will have to run through the process again really quick to update the code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文