Announcement

Collapse
No announcement yet.

Need Help Adding International Customers to a Price Group at Checkout

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need Help Adding International Customers to a Price Group at Checkout

    Hi everyone,

    I have some code on my store to automatically add customers whose shipping country is not the US or Canada to a 25% off Price Group at checkout. It works, except that domestic customers are somehow being added to the price group on OSEL, so they see "International 25% Discount" in their basket on OSEL, and then it disappears on OPAY. We are getting emails from US and Canada customers asking why they don't get the discount.

    Forehead-Slap.jpg

    Here is my code:
    Code:
    <mvt:if expr="g.Basket:ship_cntry NE 'US' AND g.Basket:ship_cntry NE 'CA'">
    <mvt:do file="g.Module_Feature_PGR_UT" name="l.result" value="Basket_Assign_Persistent_PriceGroup(g.Baske t:basket_id,'25POffINT')" />
    <mvt:elseif expr="g.Basket:ship_cntry EQ 'US' OR g.Basket:ship_cntry EQ 'CA'"><mvt:do file="g.Module_Feature_PGR_UT" name="l.result" value="Basket_Remove_Persistent_PriceGroup(g.Baske t:basket_id,'25POffINT')" />
    <mvt:else>
    &nbsp;
    </mvt:if>
    What am I doing wrong?

    #2
    Hello,

    I am not sure if it was just a copy and paste issue but there seems to be a random space in your code snippet. In both the Basket_Assign_Persistent_PriceGroup and Basket_Remove_Persistent_PriceGroup functions the first parameter has a space after the 'e' in the word Basket.

    Nicholas Adkins
    Lead Developer / Miva, Inc.
    [email protected]
    http://www.miva.com

    Comment


      #3
      Yes, it was a copy/paste issue. Here is the exact code I have on my OSEL page. Why would it add domestic customers to the price group when the if statement specifically excludes the US and Canada? And then it removes it again on the next page.

      Code:
      <mvt:if expr="g.Basket:ship_cntry NE 'US' AND g.Basket:ship_cntry NE 'CA'">
      <mvt:do file="g.Module_Feature_PGR_UT" name="l.result" value="Basket_Assign_Persistent_PriceGroup(g.Basket:basket_id,'25POffINT')" />
      <mvt:elseif expr="g.Basket:ship_cntry EQ 'US' OR g.Basket:ship_cntry EQ 'CA'"><mvt:do file="g.Module_Feature_PGR_UT" name="l.result" value="Basket_Remove_Persistent_PriceGroup(g.Basket:basket_id,'25POffINT')" />
      <mvt:else>
      &nbsp;
      </mvt:if>
      Thanks for any insight.

      Comment


        #4
        At first glance I do not see any issues. I implemented the code on my development store and I was not been able to replicate the issue that you are seeing. Do you have a Miva ReadyTheme applied to the store or is it the default framework? Have you tried to output the shipping country variables on the page to see what they are outputting? Is there any custom code that would modify the shipping information at all?

        Nicholas Adkins
        Lead Developer / Miva, Inc.
        [email protected]
        http://www.miva.com

        Comment


          #5
          On a slightly different topic: I wasn't aware of these persistent-price-group features. I can check the LSK, of course, but can I get a quick summary? Is this a way to temporarily add a shopper to a price group, even if they aren't logged in?

          Thanks -- Kent
          Kent Multer
          Magic Metal Productions
          http://TheMagicM.com
          * Web developer/designer
          * E-commerce and Miva
          * Author, The Official Miva Web Scripting Book -- available on-line:
          http://www.amazon.com/exec/obidos/IS...icmetalproducA

          Comment


            #6
            Originally posted by Nick View Post
            At first glance I do not see any issues. I implemented the code on my development store and I was not been able to replicate the issue that you are seeing. Do you have a Miva ReadyTheme applied to the store or is it the default framework? Have you tried to output the shipping country variables on the page to see what they are outputting? Is there any custom code that would modify the shipping information at all?
            I’m using Shadows theme. I can’t think of any code that would be interfering, but I’ll check for that too. What’s weird is that my code works. I just don’t need the price group showing up briefly for a customer who shouldn’t see it. As a workaround, could I somehow selectively hide that discount with CSS on OSEL?

            Kent, by using this code, yes, you can add non-logged in shoppers to a price group with whatever if/then criteria you need.

            Comment


              #7
              Originally posted by bshaf View Post

              I’m using Shadows theme. I can’t think of any code that would be interfering, but I’ll check for that too. What’s weird is that my code works. I just don’t need the price group showing up briefly for a customer who shouldn’t see it. As a workaround, could I somehow selectively hide that discount with CSS on OSEL?

              Kent, by using this code, yes, you can add non-logged in shoppers to a price group with whatever if/then criteria you need.
              I think I understand the issue now, the basket charges loop is still showing the discount even though they have been removed because the basket needs to update in order for the discount to be removed. You could try something like this snippet, https://gist.github.com/steveosoule/...60da387dffd947, which will remove any charges that do not need to be there.

              Originally posted by Kent Multer View Post
              On a slightly different topic: I wasn't aware of these persistent-price-group features. I can check the LSK, of course, but can I get a quick summary? Is this a way to temporarily add a shopper to a price group, even if they aren't logged in?

              Thanks -- Kent
              Kent here is a link to more information about the feature: https://docs.miva.com/how-to-guides/...-template-code

              Feel free to email me with any further questions.


              Nicholas Adkins
              Lead Developer / Miva, Inc.
              [email protected]
              http://www.miva.com

              Comment


                #8
                I put this code just below the price group code and it's acting weird. This code is all in the header of the OSEL page, is that where it should be? If I set the country to UK, it seems to work. If I set the country back from UK to US, it does this:

                Image26.jpg
                You can see the 25% International Discount is now showing both as the Shipping and the actual discount with the country set to US. The $83.65 was the shipping when the country was UK, and it didn't update. When I advance to OPAY, this all disappears and it looks fine. I'm trying to paste the full code of my page and it won't let me.

                Here is the URL of my organization's store, https://store.slaafws.org so you can see what it's doing.
                Thanks for helping look into this.

                Comment


                  #9
                  I had to remove the "clear stale charges" code, as it was causing the page to act worse than before with not updating the cart. The only way I have found to work around this problem is to clear the check box to display "other basket level discounts" on OPAY.

                  Comment

                  Working...
                  X