Announcement

Collapse
No announcement yet.

Coding > clearing cache or flushing variables

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

    Coding > clearing cache or flushing variables

    Not sure why this doesn't work, just some more of my playing with the code. Nothing urgent here, not system critical, just me learning baby stuff.

    In the Global Header I added some code to check for our local IP (numbers replaced in example) and if it matches I show a bar across the top that shows the customer name/email and logout button. This is because we use the 'shop as customer' feature and a the guys here have gotten confused, not realizing they were logged in as someone else.

    <mvt:assign name="g.localip" value="s.remote_addr" />
    <mvt:if expr="g.localip EQ '11.22.33.44'">
    <div style="z-index: 400; width: 100%;text-align: center;background: #DB3232;color: #ffffff;padding: 6px;font-weight: bold; font-size: 1em;">CURRENTLY LOGGED IN AS:&nbsp;&mvt:global:customer:login;&nbsp;&nbsp;(& mvt:global:customer:pw_email;)&nbsp;&nbsp;&nbsp;&n bsp;<a style="color: #fff; text-decoration:underline" href="&mvte:urls:SFNT:secure_sep;Action=LOGO&SCREE N=REDIRECT_IPID&p=ip2782g">Logout</a></div>
    </mvt:if>

    The &SCREEN=REDIRECT_IPID&p=ip2782g gets this

    <mvt:if expr="'ip2782g' CIN s.request_uri EQ">
    <mvt:item name="toolkit" param="sassign|newurl|http://www.allfrom1supply.com" />
    <mvt:item name="toolkit" param="headeroutput|Status|301 Moved Permanently" />
    <mvt:item name="toolkit" param="vheaderoutput|Location|g.newurl" />
    </mvt:if>

    and this is simply because I found that after logging out the customer name and email remained in the top bar, but by sending it to a new page using the code above that flushed the customer name/email. However after I logout the customer, and then log in from the front end as a customer myself using that same bar to log out myself, with the same parameters no longer clears out the customer (me) name/email. It seemed odd to me.

    Any thoughts?

    Dropbox is a free service that lets you bring your photos, docs, and videos anywhere and share them easily. Never email yourself a file again!

    #2
    &mvte:urls:SFNT:secure_sep;Action=LOGO

    Should reload the storefront page and remove the account. I'd look into why that's not happening ...also, this is incorrect (though I supposed its from typing cause the compiler shouldn't allow it:

    <mvt:if expr="'ip2782g' CIN s.request_uri EQ">
    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
      I'll play with &mvte:urls:SFNT:secure_sep;Action=LOGO some more and see what I can sort out.

      The other statement that shouldn't work, does - or at least it doesn't generate an error.

      Thanks.

      Comment


        #4
        Well, it's not going to do what you think it's going to do :) (very surprised is passing compiling cause you have an Compare Operator with nothing on the the other side...)
        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
          Removed that floating extra EQ - thanks.

          Okay, well tried again. If I login as a customer from front end, via my ip and then logout va the bar I added it works. If I 'Shop as Cusrtomer' and logout it works. If I "Shop as Customer" and then logout, then login as someone else in the same window the message stays but I AM really logged out - it just doesn't go away.

          I did change one line, to hide the logout bar if login is empty ' ' so I guess there could be some value.in there besides ' ' (not sure if empty is same as null?)
          <mvt:if expr="g.localip EQ '11.22.33.44' AND g.customer:login NE ''">

          In any case I'm just OCD'ing at this point. It works for all intents as purposes as expected.
          Last edited by habreu; 06-12-17, 10:23 AM.

          Comment


            #6
            Maybe try generating the display using <mvt:if expr="g.bask:cust_id"> Write Logged in Message </mvt:if> (wrapped in doc ready of course)

            BTW: Hint-At-Miva. Shop As Customer SHOULD have a variable present (maybe it does, but I couldn't find it).
            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


              #7
              I will try - thanks.

              Comment


                #8
                Okay, not sure that it was important but finally appended a random number to the logout link

                <mvt:assign name="g.nrandom" value="random( 100 )" />

                and that did it.

                Comment


                  #9
                  ah, you where reloading the page from Cache. BTW: s.time_t is usually the go to random number.
                  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


                    #10
                    Thanks - switched that over. Inordinately proud of myself, though I won't mention publicly how long it took me to sort out something so simple. :)

                    Comment


                      #11
                      yea i wouldn't have necessarily caught that as I have my developer browser set to Never Chache...
                      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

                      Working...
                      X