Announcement

Collapse
No announcement yet.

Custom Field conditional statement no longer works

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

    Custom Field conditional statement no longer works

    For the longest time, this code worked, and now, it doesn't. I was using this code to hide the add to cart button, and to provide a message to customers that the item they're looking at could only be purchased in-store. Worked great until recently, when a customer ordered one of these items.

    Code:
    <mvt:if expr="l.settings:product:customfield_values:customfields:add-to-cart EQ 'yes'">
    -message to customer-
    </mvt:if>
    I have a custom field created with the code 'add-to-cart' - and it's set up as a checkbox.

    Is there anything that has changed recently that broke this? I've tried re-creating a new field, changing from a checkbox to drop down, plain text, all to no avail.
    Dylan Buchfink
    The Mattress & Sleep Company
    http://www.tmasc.ca/

    #2
    Not sure why it worked before...but checkbox custom fields evaluate to either 1 for yes or null for no.

    Typically, just use <mvt:if expr="l.settings:product:customfield_values:custom fields:add-to-cart">
    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
      Maybe the customfields component got de-assigned from the page by an accidental slip of someone's mouse?
      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


        #4
        Could be, but i've always seen checkbox fields eval as 1 and null
        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
          Originally posted by Bruce - PhosphorMedia View Post
          Not sure why it worked before...but checkbox custom fields evaluate to either 1 for yes or null for no.

          Typically, just use <mvt:if expr="l.settings:product:customfield_values:custom fields:add-to-cart">
          I am as perplexed. Tried your version as well, no luck.

          And with Kent's suggestion, I did make sure to assign the custom field - even removed it and added it back in.

          I've just decided to scrap this idea and use a drop-down list with a yes/no variable. That did the trick. Just so confused as to how it was working originally, lol. Thanks guys!

          Dylan Buchfink
          The Mattress & Sleep Company
          http://www.tmasc.ca/

          Comment


            #6
            Try changing the hyphens in the custom field code to underscores. I had this same problem, and that fixed it.

            Comment


              #7
              'yes' is still valid for old data, but if you update the data now, it will be 1

              please read this topic with solution:
              https://www.miva.com/forums/forum/on...yes-and-ne-yes

              now you have to use ISNULL or NOT ISNULL to check if checkbox is set

              Comment

              Working...
              X