简体   繁体   English

如何折扣仅适用于Commerce Server 2007中的一种送货方式?

[英]How to make a discount apply to only one shipping method in Commerce Server 2007?

I searched and searched for an answer for this seemingly simple question in Commerce Server 2007, but have found nothing useful. 我在Commerce Server 2007中搜索并搜索了这个看似简单的问题的答案,但没有发现任何有用的东西。 This seems like something that should be possible. 这似乎应该是可能的。 How to make a discount apply to only one shipping method in Commerce Server 2007? 如何折扣仅适用于Commerce Server 2007中的一种送货方式?

If you want a discount to be only applicable if the user selected a certain shipping method, then this is not possible out-of-the-box. 如果您希望折扣仅在用户选择某种送货方式时适用,则无法开箱即用。

You can always write a custom pipeline component, but dealing with the discounts in the pipeline could be complicated. 您始终可以编写自定义管道组件,但处理管道中的折扣可能会很复杂。

I've run into this problem before, I had a scenario where the standard delivery option was the only one that would ever be discounted and the next day and international options would always be full price. 我以前遇到过这个问题,我有一个场景,标准交付选项是唯一一个可以打折的选项,第二天和国际选项总是全价。

In this instance I wrote a custom pipeline component which removed any shipping discounts if any other shipping method other than the standard was selected. 在这个例子中,我编写了一个自定义管道组件,如果选择了除标准之外的任何其他运输方法,则删除任何运输折扣。

I added this scriptor component into the total pipeline below the ShippingDiscountAdjust component, it's a bit of a hack as I've hardcoded the standard deliveries id in, but that won't ever change so I could get away with it: 我将这个scriptor组件添加到了ShippingDiscountAdjust组件下面的总管道中,这有点像黑客,因为我已经硬编码了标准的交付ID,但这不会改变所以我可以侥幸逃脱:

function MSCSExecute(config, orderform, context, flags)

        Dim shipments        ' SimpleList of shipments in the basket
        Dim shipment        ' An shipment dictionary from the list
        Dim sShipmentID

        ' Save shipping discounts for each shipment (as written by ShippingDiscountAdjust)
        If not isNull(orderForm.Value("shipments")) then
            Set shipments = orderForm.Value("shipments")    
            For Each shipment in shipments            
               sShipmentID = shipment("shipping_method_id")
            Next

            if sShipmentID <> "{00000000-0000-0000-0000-005719007655}" and orderForm.value("_cy_shipping_discounts_total") > 0 then
                orderform.value("_shipping_discount_description") = ""

                For Each shipment in shipments            
                     orderForm.value("_cy_shipping_total") =orderForm.value("_cy_shipping_total")  + shipment.value("_cy_shipping_discounts_subtotal")
                     shipment.value("_cy_shipping_discounts_subtotal") = 0
                Next

                orderForm.value("_cy_shipping_discounts_total") = 0
            end if
        End If

        MSCSExecute = 1
    end function

    sub MSCSOpen(config)

    end sub


    sub MSCSClose()

    end sub

Steve and Erwin are correct. 史蒂夫和欧文是对的。 There is not an out of the box solution for this, but you can try and work around it using custom pipeline components or scriptor components. 没有开箱即用的解决方案,但您可以尝试使用自定义管道组件或脚本组件来解决它。

There is a commercial alternative. 有一种商业选择。 Enticify is a, drop-in replacement for the Commerce Server discount pipeline components, that does support shipping method specific discounts ( amongst other things ). Enticify是Commerce Server折扣管道组件的替代品,可以支持特定 运输方式的折扣以及其他内容 )。

Disclaimer: I am an Enticify employee. 免责声明:我是一名Enticify员工。

Enticify adds the concept of Shipment Expressions . Enticify增加了Shipment Expressions的概念。 You use these like you do Eligibility Expressions (you actually set them in the Marketing Manager Eligibility tab). 您可以像使用Eligibility Expressions一样使用它们(实际上是在Marketing Manager Eligibility选项卡中设置它们)。 However, you can make a discount shipping method specific by targeting properties like shipping_method_id . 但是,您可以通过定位shipping_method_id属性来制定特定折扣送货方式。

Here you see the shipment expression targeting the shipping_method_id (but you could target other shipment properties): 在这里,您可以看到以shipping_method_id目标的货件表达式(但您可以定位其他货件属性):

根据送货方式ID验证货件表达

And here you see it listed in the eligibility expressions dialog: 在这里,您可以看到它在资格表达式对话框中列出:

在此输入图像描述

When run, this discount will only apply to shipments that meet this expression. 运行时,此折扣仅适用于符合此表达式的货件。 You can read more in the Enticify Shipping Discounts documentation . 您可以在Enticify Shipping Discounts文档中阅读更多内容 This is quite powerful, as it can be used to qualify product discounts too (eg get a discount on product X when you choose next day shipping). 这是非常强大的,因为它也可用于限定产品折扣 (例如,当您选择第二天发货时获得产品X的折扣)。

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

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