Announcement

Collapse
No announcement yet.

Conditional Message based on Shipping Method

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

    Conditional Message based on Shipping Method

    I need to be able to display an addendum message based on a shipping method. I'm assuming that this would need to be done on the OSEL page since this is where the methods are found. The store has the Shipping Rules configured so it works out that only one shipping method is offered. I need to be able to display a message only when one specific method is displayed.

    I was hoping it was going to be as simple as this:
    Code:
    <mvt:if expr="l.settings:method:code NE 'BROK_UPS_CUSTOM:03'">
    03
    <mvt:else>
    else
    </mvt:if>
    But of course it's not. The 03 displays every time. So what am I doing wrong?

    Thanks,
    Leslie
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: X | Facebook | Pinterest

    #2
    Re: Conditional Message based on Shipping Method

    method:code = '03'

    BROK_UPS_CUSTOM:03

    is created by

    method:module $':'$ method:code
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      Re: Conditional Message based on Shipping Method

      Okay so if I change it to

      Code:
      <mvt:if expr="l.settings:method:code NE '03'">
      my message
      <mvt:else>
      
      </mvt:if>
      So it looks like my mistake is trying to use l.settings:method:code before determining that it's a shipping module. Now to figure it out...
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: X | Facebook | Pinterest

      Comment


        #4
        Re: Conditional Message based on Shipping Method

        I *think* what you want is this:

        <mvt:if expr="l.settings:method:module$':'$l.settings:meth od:code NE 'BROK_UPS_CUSTOM:03'">
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment


          #5
          Re: Conditional Message based on Shipping Method

          So I feel like I'm trying to balance a chemical equation here.

          I did try

          Code:
          <mvt:if expr="l.settings:method:module$':'$l.settings:method:code NE 'BROK_UPS_CUSTOM:03'">NE
          <mvt:else>
          EQ 03
          </mvt:if>
          then I tried

          Code:
          <mvt:if expr="l.settings:shippingmethods:module$':'$l.settings:shippingmethods:code NE 'BROK_UPS_CUSTOM:03'">NE
          <mvt:else>
          EQ 03
          </mvt:if>
          Both with the same results of displaying NE even when the code is 03

          FYI, I have this code in the footer of the OSEL page.
          Leslie Kirk
          Miva Certified Developer
          Miva Merchant Specialist since 1997
          Previously of Webs Your Way
          (aka Leslie Nord leslienord)

          Email me: [email protected]
          www.lesliekirk.com

          Follow me: X | Facebook | Pinterest

          Comment


            #6
            Re: Conditional Message based on Shipping Method

            I have even tried adding this inside the shipping mvt:foreach loop

            Code:
            <mvt:if expr="l.settings:method:code EQ '03'">
            <mvt:if expr = "g.ShippingMethod EQ 'BROK_UPS_CUSTOM:03'">
            03
            <mvt:else>
            Not 03
            </mvt:if>
            </mvt:if>
            There is no joy in Mudville.
            Last edited by lesliekirk; 09-12-15, 05:29 AM.
            Leslie Kirk
            Miva Certified Developer
            Miva Merchant Specialist since 1997
            Previously of Webs Your Way
            (aka Leslie Nord leslienord)

            Email me: [email protected]
            www.lesliekirk.com

            Follow me: X | Facebook | Pinterest

            Comment


              #7
              Re: Conditional Message based on Shipping Method

              And the lightbulb has come on. I wasn't putting Bruce's snippet inside the foreach loop. Once I did that, it was exactly what I needed. Thanks Bruce!
              Leslie Kirk
              Miva Certified Developer
              Miva Merchant Specialist since 1997
              Previously of Webs Your Way
              (aka Leslie Nord leslienord)

              Email me: [email protected]
              www.lesliekirk.com

              Follow me: X | Facebook | Pinterest

              Comment


                #8
                Re: Conditional Message based on Shipping Method

                This is why therapy works, you have to talk it out, lol
                Thanks,

                Rick Wilson
                CEO
                Miva, Inc.
                [email protected]
                https://www.miva.com

                Comment


                  #9
                  Re: Conditional Message based on Shipping Method

                  How did that make you feel Leslie? (Sorry couldn't help myself).

                  I am definitely bookmarking this one. Great snippet for future projects! Thanks Bruce and Leslie for bring this up.

                  Comment


                    #10
                    Re: Conditional Message based on Shipping Method

                    Originally posted by eldon99 View Post
                    How did that make you feel Leslie? (Sorry couldn't help myself).
                    LOL, funny thing, I don't think most people know what my degrees are in
                    Leslie Kirk
                    Miva Certified Developer
                    Miva Merchant Specialist since 1997
                    Previously of Webs Your Way
                    (aka Leslie Nord leslienord)

                    Email me: [email protected]
                    www.lesliekirk.com

                    Follow me: X | Facebook | Pinterest

                    Comment


                      #11
                      Re: Conditional Message based on Shipping Method

                      Yea, sorry my other post didn't make it through (i tried sending it through email) when the forums where freaking out last night.

                      But I see you figured it out. You want to run the test inside the look and create a variable to be used later on the page.
                      Bruce Golub
                      Phosphor Media - "Your Success is our Business"

                      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                      phosphormedia.com

                      Comment


                        #12
                        Re: Conditional Message based on Shipping Method

                        Well, mine's in Journalism :)
                        Bruce Golub
                        Phosphor Media - "Your Success is our Business"

                        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                        phosphormedia.com

                        Comment


                          #13
                          So I'm coming back to my own question as it seems I needed this tidbit again. I tried using this:
                          Code:
                          <mvt:if expr="l.settings:method:module$':'$l.settings:method:code EQ 'baseunit:8'">
                          my message here
                          and when I went to update the page, I was greeted with this awful message:
                          Error compiling template: Line 101: Expression compilation failed: Invalid Argument ':' Found in expression
                          So what did I do wrong?

                          Leslie Kirk
                          Miva Certified Developer
                          Miva Merchant Specialist since 1997
                          Previously of Webs Your Way
                          (aka Leslie Nord leslienord)

                          Email me: [email protected]
                          www.lesliekirk.com

                          Follow me: X | Facebook | Pinterest

                          Comment


                            #14
                            Try escaping the ':' . i.e., '\:' (though i don't recall every having to do this before, perhaps the syntax checking has been tighten up in a recent release.
                            Bruce Golub
                            Phosphor Media - "Your Success is our Business"

                            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                            phosphormedia.com

                            Comment


                              #15
                              What about if you do an mvt:assign to a variable and test for that?
                              Last edited by eldon99; 07-07-16, 11:04 AM.

                              Comment

                              Working...
                              X