Announcement

Collapse
No announcement yet.

Wish List Product Custom Field

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

    Wish List Product Custom Field

    We have a product custom field to mark an item out of stock. We need to write a conditional on the Wish List page so that customers can't order out of stock items. We use the below on the CTGY page just fine but it isn't working on the Wish List page. I did make sure that the customfields item was assigned on the WIsh List page:
    Code:
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code, 'stock', l.settings:stock)" />
    <mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields:stock">
    SOLD OUT
    <mvt:else>
    ADD TO CART
    </mvt:if>

    #2

    You are creating your own custom feed variable using the Read_Product_Code() function. However, you are trying to use the Miva generated variable name

    Note: l.settings:custom:stock is what i'm creating below and testing.

    Code:
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code, 'stock', l.settings:custom:stock)" />
    <mvt:if expr="NOT ISNULL l.settings:custom:stock">
    SOLD OUT
    <mvt:else>
    ADD TO CART
    </mvt:if>
    (fyi: i typically use l.settings:custom as the 'prefix' to all variables I create...its just a 'clarity' thing for me and other devs on the team.)
    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 tried that and it isn't working either. Shouldn't the old school way work? But it isn't either

      Code:
      <mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields:stock">
      SOLD OUT
      <mvt:else>
      ADD TO CART
      </mvt:if>

      Comment


        #4
        afiumano Using the product:customfield_values:customfields:CUSTOM_FIE LD_CODE will only work if the custom field has been added to the product display layout template:

        customfield.JPG

        And when using the customfield item you will need to make sure that the item is assigned to the page in order for the Read_Product_Code function to work.
        Nicholas Adkins
        Technical Training Specialist / Miva, Inc.
        [email protected]
        https://www.miva.com/mivalearn

        Comment


          #5
          Nick Yes, I have done both of those things.

          But I am on the Wish List page so I have a 'Wish List Items Layout' section not a product display layout template. I have added the custom field there like in your image. And I have made sure the "customfields" item is assigned to the Wish List page

          Comment


            #6
            afiumano

            When in the Wish List Items Layout template for the default Shadows theme the iterator on the items loop is wishlistitem.

            Code:
            <mvt:foreach iterator="wishlistitem" array="wishlistitems:items">
            So you would need to use that iterator to access the entity:

            Code:
            &mvt:wishlistitem:product:customfield_values:customfields:stock;
            Inside of the wishlistitems loop the variable would be:

            Code:
            l.settings:wishlistitem:product:customfield_values:customfields:stock
            Nicholas Adkins
            Technical Training Specialist / Miva, Inc.
            [email protected]
            https://www.miva.com/mivalearn

            Comment


              #7
              also remember, if you use the manual call to get a custom field, you also need to be sure the Custom Field module is active on that page (a mistake i often make).
              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


                #8
                Nick Bruce - PhosphorMedia Thank you both for your assistance. I was able to get this working. I also got it working on the ORDS page since there is a "Reorder" link there.

                This is the code that I got working on the Wish List page:
                Code:
                <mvt:if expr="NOT ISNULL l.settings:wishlistitem:product:customfield_values:customfields:stock">
                <input disabled="disabled" class="c-button button c-button--small" type="submit" value="Sold Out">
                <mvt:else>
                <input class="c-button button c-button--small" type="submit" value="Add To Cart">
                </mvt:if>

                Comment

                Working...
                X