Announcement

Collapse
No announcement yet.

Product Page Conditional Help

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

    Product Page Conditional Help

    I have a function on our PROD template that I would like not to display on certain products. The function shows how many points can be earned on the product. I have a few products that do not earn points (gift cards, etc). The way it shows now is 0 points.

    #2
    You could set up a custom product field checkbox with a code of no_loyalty_points and a name of No Loyalty Points

    Then on the PROD Template go to the Product Display Layout section and move the new custom field to the selected box and then click update.

    Then wrap this conditional around your function and click update:
    Code:
    <mvt:if expr="l.settings:product:customfield_values:customfields:no_loyalty_points NE '1'">
        <mvt:comment> Checkbox is not checked --^ </mvt:comment>
        Function goes here
    </mvt:if>
    Then for each of those products and go to the custom fields tab, check the box for the new custom field and click update.
    Nick Harkins
    www.loveisarose.com
    *Web Developer
    *Miva
    *Google Analytics, Search Console, Tag Manager, Merchant Center, Ads

    Comment


      #3
      If the number of points is available in an mvt: variable, you don't need a custom field. You can just put an mvt:if element on the page, so that the message about points is only displayed when the number is greater than zero.
      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
        Ah yes Kent Multer I should have suggested he used the token list to see if there is a variable for the number of points. Very good point... pun intended...
        Nick Harkins
        www.loveisarose.com
        *Web Developer
        *Miva
        *Google Analytics, Search Console, Tag Manager, Merchant Center, Ads

        Comment


          #5
          This is the function;

          <mvt:item name="points" param="Product_Points( l.settings:basket, l.settings:product, 0, 0, 1, l.settings:product:points_information )" />
          <i>This item Earns &mvt:product:points_information:points_total; Horse & Kennel Rewards Points</i>

          Comment


            #6
            Try this:
            Code:
            <mvt:item name="points" param="Product_Points( l.settings:basket, l.settings:product, 0, 0, 1, l.settings:product:points_information )" />
            <mvt:if expr="l.settings:product:points_information:points_total GT 0">
                <i>This item Earns &mvt:product:points_information:points_total; Horse & Kennel Rewards Points</i>
            </mvt:if>
            Nick Harkins
            www.loveisarose.com
            *Web Developer
            *Miva
            *Google Analytics, Search Console, Tag Manager, Merchant Center, Ads

            Comment


              #7
              Perfect, works like a charm. Your help is appreciated.

              Comment

              Working...
              X