Conditional for Account Credit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • studio6t6
    Mini Mivite

    • Apr 2019
    • 71

    #1

    Conditional for Account Credit

    I've used this in previous stores many times and for some reason it's not working on a Shadows framework....

    Conditional for determining whether a customer has account credt or not. Is it not this...?

    <mvt:if expr="l.settings:customer:credit NE 0">
    You have credit
    <mvt:else>
    You have no credit
    </mvt:if>

    With or without credit, the message always displays "You have no credit"

    What an I doing wrong?


    Tony Pavao
    Studio6t6
    Vancouver BC Canada
    [email protected]
  • studio6t6
    Mini Mivite

    • Apr 2019
    • 71

    #2
    Probably shouldn't have posted this initially on a Sunday afternoon. Still looking for any insight?

    Thanks,
    Tony Pavao
    Studio6t6
    Vancouver BC Canada
    [email protected]

    Comment

    • Bruce - PhosphorMedia
      Developer Partner











      • Mar 2006
      • 11256

      #3
      I'm not sure what it is (don't have a template handy) but I think I know how you can find it presuming Use Account Balance is activated

      1) Create and account
      2) Add a balance to that account (make it obvious like 1.99)
      3) While logged into the store, use the Token Viewer to see if you can find 1.99.

      If that doesn't work, or isn't reliable, I do know there are a couple of API functions you can call to bring it up.
      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

      • studio6t6
        Mini Mivite

        • Apr 2019
        • 71

        #4
        Thanks, Bruce.

        Using your method I had an "aha' moment. Changed it to to this, but still no luck...

        <mvt:if expr="l.settings:customer:formatted_credit NE 0">

        Tony Pavao
        Studio6t6
        Vancouver BC Canada
        [email protected]

        Comment

        • Bruce - PhosphorMedia
          Developer Partner











          • Mar 2006
          • 11256

          #5
          well, if its formatted, it would probably be '$0.00' see if there is an l.settings:customer:credit value (which would just be a 0 or 1.99).
          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

          • studio6t6
            Mini Mivite

            • Apr 2019
            • 71

            #6
            I'm using whole numbers because this store is only used with points instead of dollars . But it shouldn't matter I wouldn't think. I just used 199 instead of 1.99. The Tool inspector did find it and that's where I saw the l.settings:customer:formatted_credit.
            Tony Pavao
            Studio6t6
            Vancouver BC Canada
            [email protected]

            Comment

            • Bruce - PhosphorMedia
              Developer Partner











              • Mar 2006
              • 11256

              #7
              well, yea, cause inspector is matching the 1.99 within $1.99. (The reason for the odd number is you'd find, say '200' in a lot of places.)

              So, if there is no l.settings:customer:credit value, do this:

              <mvt:assign name=g.s6:customer:credit" value="glosub(l.settings:customer:formatted_credit , '$'. )" />
              then use
              <mvt:if expr="g.s6:customer:credit" GT 0">

              show balance

              </mvt:if>
              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

              • studio6t6
                Mini Mivite

                • Apr 2019
                • 71

                #8
                Aha!! Yes, that worked. Thank you Bruce! It never occurred to be that it was looking for a decimal and dollar sign. I was getting a validation error, so I massaged it to this....

                <mvt:assign name="g.s6:customer:credit" value="glosub(l.settings:customer:formatted_credit , '$' ,'.' )" />

                <mvt:if expr="g.s6:customer:credit GT 0">
                yes points
                <mvt:else>
                no points

                </mvt:if>

                It's Canadian Thanksgiving, so time to have some turkey!!
                Tony Pavao
                Studio6t6
                Vancouver BC Canada
                [email protected]

                Comment

                • Bruce - PhosphorMedia
                  Developer Partner











                  • Mar 2006
                  • 11256

                  #9
                  sounds like a good idea...when's dinner...oh wait...canadians are smart enough not to let us in anymore.
                  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

                  • studio6t6
                    Mini Mivite

                    • Apr 2019
                    • 71

                    #10
                    We'll make a special exception! Come on over ;)
                    Tony Pavao
                    Studio6t6
                    Vancouver BC Canada
                    [email protected]

                    Comment

                    Working...
                    X