Announcement

Collapse
No announcement yet.

Help with my first attempt to work with M9 conditionals.

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

    Help with my first attempt to work with M9 conditionals.

    Help with my first attempt to work with M9 conditionals, code not rendering properly.

    Need to revise "Recently Viewed Items" Product Listing to display (sample):

    [IF Active and Inventory Greater 0]
    [strike]$50.00[/strike] $440.00 [Greater Equal $50.00]Free Shipping Icon[Greater Equal $50.00]
    [Inventory Equal 1]Only 1 left in stock![/Inventory Equal 1]
    [IF Active and Inventory Equal 0]
    Sold Out
    [/IF Active and Inventory Equal 0]
    [/IF Active and Inventory Greater 0]


    Actual Product Listing code with my test snippet that is not working (look for "Start - Test Conditional" comment):
    Code:
    <!-- READYTHEME PRODUCTLISTING 2 begin -->
    
    <mvt:item name="toolkit" param="footsteps|fcount|20" />
    
    
    <mvt:if expr="g.fcount GT 0">
        <h2 class="navy nm">Recently Viewed Items</h2>
        <div class="row product-carousel">
            <div class="column whole large-whole medium-whole recently-viewed">
                <div id="js-recently-added" class="expanded">
    
    
    
    
                <!-- This function is used for debugging-->
                <mvt:comment><mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:footsteps ), ',', '<br>'))" /></mvt:comment>
    
    
                <mvt:do name="l.null" file="g.Module_Feature_TUI_UT" value="CommonComponentFields_Initialize_Product_Discounts_Runtime(l.settings:footsteps, miva_array_elements(l.settings:footsteps))" />
    
    
    
    
                        <mvt:foreach iterator="footstep" array="footsteps">
                            <div class="category-product recently-viewed align-center medium-align-left js-featured-products-height-min">
    
                                <div class="category-prod-container">
                                    <div class="category-product-image-wrapper flag">
                                    <mvt:do file="g.Module_Feature_URI_UT" name="l.settings:footstep:link" value="Store_Product_URL(l.settings:footstep, NULL)" />
                                        <a href="&mvt:footstep:link;">
    
                                            <mvt:comment>Lookup Main Image</mvt:comment>
                                            <mvt:do name="l.image_count" file="g.Module_Library_DB" value="ProductImageDataList_Load_Product(l.settings:footstep:id, l.settings:product:images)" />
                                            <mvt:foreach iterator="image" array="product:images">
                                                <mvt:if expr="l.settings:image:imagetype:code EQ 'main'">
                                                    <mvt:assign name="l.settings:product:main" value="l.settings:image" />
                                                    <mvt:foreachstop/>
                                                </mvt:if>
                                            </mvt:foreach>
                                            <mvt:if expr="l.settings:product:main:image:id">
                                                <mvt:do file="g.Module_Library_DB" name="l.result" value="GeneratedImage_FindOrInsert_Image_Dimensions( l.settings:product:main:image, '255', '255', l.settings:product:main:generated )" />
                                            </mvt:if>
                                            <mvt:if expr="NOT ISNULL l.settings:product:main:generated:image">
                                                <img src="&mvte:product:main:generated:image;" alt="&mvte:product:name;" title="&mvte:product:name;" />
                                            <mvt:elseif expr="NOT ISNULL l.settings:product:imagetypes:thumbimage">
                                                <img src="&mvte:product:imagetypes:thumbimage;" alt="&mvte:product:name;" title="&mvte:product:name;" />
                                            <mvt:else>
                                                <mvt:if expr="NOT ISNULL l.settings:product:imagetypes:main">
                                                    <img src="&mvte:product:imagetypes:main;" alt="&mvte:product:name;" title="&mvte:product:name;" />
                                                <mvt:elseif expr="NOT ISNULL l.settings:footstep:image">
                                                    <img src="&mvt:footstep:image;">
                                                <mvt:else>
                                                    <img src="themes/levels/images/img_no_thumb.jpg" alt="&mvte:product:name;" title="&mvte:product:name;" />
                                                </mvt:if>
                                            </mvt:if>
                                            <mvt:comment><mvt:if expr="NOT ISNULL l.settings:footstep:image">
                                                <img src="&mvt:footstep:image;">
                                            <mvt:else>
                                                <img src="themes/levels/images/img_no_thumb.jpg">
                                            </mvt:if></mvt:comment>
                                        </a>
                                        <div class="category-product-cta-wrapper">
                                            <button type="button" class="button category-product-cta-button category-product-cta-quickview js-quick-view" data-product-link="&mvte:urls:PROD:auto_sep;Product_Code=&mvt:footstep:code;&amp;show=quickview">
                                                <span class="levels-icon-eye"></span>
                                                <span class="category-product-cta-quickview-text"> Quickview</span>
                                            </button>
                                            <form action="&mvte:urls:BASK:auto;" method="POST" class="category-product-form">
                                                <input type="hidden" name="Action" value="ADPR">
                                                <input type="hidden" name="Product_Code" value="&mvt:footstep:code;">
                                                <input type="hidden" name="Category_Code" value="&mvte:global:Category_Code;">
                                                <input type="hidden" name="Quantity" value="1">
                                                <button class="button category-product-cta-button category-product-cta-button-adpr">
                                                    <span data-icon="&#xe07a;"></span><span class="category-product-cta-adpr-text"> Add to Cart</span>
                                                </button>
                                            </form>
                                        </div>  
                                    </div>
                                    <span class="breaker"></span>
                                    <div class="featured-product-bottom">
                                        <p class="category-product-name"><a href="&mvt:global:sessionurl;Screen=PROD&Product_Code=&mvta:footstep:code;&Store_Code=&mvta:global:Store_Code;">&mvt:footstep:name;</a></p>
    
    
                                        <p class="pricing">
    
    
                                            <span class="category-product-price bold">&mvt:footstep:formatted_price;</span>
    
    
    
                                            <!-- test-->
    
                                            <mvt:if expr="l.settings:footstep:price GE 50">
                                                <span class="truck-icon"><img src="graphics/00000001/free-shipping-truck.png" alt="Free Shipping" title="This item qualifies for Free US Shipping & Handling"></span>
                                            </mvt:if>
                                        </p>
                                        <mvt:if expr="l.settings:product:inv_available EQ 1">
                                            <p><strong class="limited-stock">Only 1 left in stock!</strong></p>
                                        </mvt:if>
            <mvt:comment>Start - Test Conditional; Price Group, 1 left in Stock, Sold Out Hide Price, Truck Icon > $50, JC.</mvt:comment>
            <mvt:if expr="l.settings:product:inv_active EQ 1 AND l.settings:product:inv_available LE 0">
      <mvt:comment>Do not show price for out of stock products</mvt:comment>
      <strong class="sold-out">Sold Out</strong>
      <mvt:else>
      <mvt:if expr="l.settings:product:base_price GT l.settings:product:price"> <span class="category-product-retail-price">&mvt:product:formatted_base_price;</span> <span class="category-product-sale-price">&mvt:product:formatted_price;</span>
        <mvt:if expr="l.settings:product:price GE 50"><strong class="free-shipping"><span class="free-ship-icon"></span></strong></mvt:if>
        <mvt:else>
        <span class="category-product-price">&mvt:product:formatted_price;</span>
        <mvt:if expr="l.settings:product:price GE 50"><strong class="free-shipping"><span class="free-ship-icon"></span></strong></mvt:if>
      </mvt:if>
      <mvt:if expr="l.settings:product:inv_available EQ 1"> <strong class="show limited-stock">Only 1 left in stock!</strong>
        <mvt:comment>
          <mvt:elseif expr="l.settings:product:inv_available GT 1">
          <strong class="show limited-stock">Only 1 left in stock!</strong></mvt:comment>
      </mvt:if>
    </mvt:if>
            <mvt:comment>End - Test Conditional; Price Group, 1 left in Stock, Sold Out Hide Price, Truck Icon > $50, JC.</mvt:comment>
                                    </div>
                                </div>
                            </div>
                        </mvt:foreach>
    
    
                    <div class="clear"></div>
                </div>
            </div>
        </div>
    </mvt:if>
    <!-- READYTHEME PRODUCTLISTING 2 end -->
    
    
    <!-- READYTHEME PRODUCTLISTING 2 end -->
    Finally, would Tool Belt module help make things easier for me to learn using M9 conditionals?
    Thank you, Bill Davis

    #2
    IMO, any valid sample code could help you learn conditionals. You might take a look at docs.miva.com and drill down in the developers' section.
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    Comment

    Working...
    X