Announcement

Collapse
No announcement yet.

Products in the same category for product page

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

  • Products in the same category for product page

    So I'm trying to replace a old toolkit function to display all the products in the same category on a product page. All works fine but then I had to do some special coding to get the main image to work and now the pricing tokens don't seem to work. The only token I can get to work is the very basic price token. We use sale pricing from a price group so that the issue. Here is the address:

    https://www.terrysjag.com/product/BD25659X.html

    Here is the code:

    <mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( g.Category_Code, l.settings:current_category )" />
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:current_category:id, g.Offset, 100, g.NextOffset, l.settings:products )" />
    <mvt:foreach iterator="product" array="products">
    <div class="o-layout__item u-width-3--l u-text-center x-product-list__item">
    <a class="u-block x-product-list__link" href="/product/&mvte:product:code;.html" title="&mvte:product:name;">
    <figure class="x-product-list__figure">
    <mvt:do name="l.image_count" file="g.Module_Library_DB" value="ProductImageDataList_Load_Product(l.setting s:product:id, l.settings:imagedata)" />
    <mvt:foreach iterator="data" array="imagedata">
    <img style="max-height: 120px; max-width: 120px;" class="x-product-list__image" src="&mvt:data:image:image;" alt="&mvte:product:name;">
    </mvt:foreach> <figcaption>
    <strong class="x-product-list__name">&mvte:product:name;</strong>
    <mvt:if expr="l.settings:product:base_price GT l.settings:product:price">
    <span class="u-text-bold x-product-layout-purchase__name u-font-small u-color-red">
    Reg. Price:<s id="price-value-additional">&mvt:product:formatted_base_price;</s>
    </span> &nbsp;&nbsp;&nbsp;
    </mvt:if>
    Sale Price:&mvt:product:formatted_price; &mvt:product:formatted_base_price; $&mvt:product:price;
    </figcaption>
    </figure>
    </a>
    </div>
    </mvt:foreach>


  • In the past, having a product loop on the product page sometimes caused some issues. Although I have not tested this, you might try changing your loop variables like this:
    Code:
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( g.Category_Code, l.settings:current_category )"/>
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:current_category:id, g.Offset, 100, g.NextOffset, l.settings:more_products )"/>
    <mvt:foreach iterator="more_product" array="more_products">
        <div class="o-layout__item u-width-3--l u-text-center x-product-list__item">
            <a class="u-block x-product-list__link" href="/product/&mvte:more_product:code;.html" title="&mvte:more_product:name;">
                <figure class="x-product-list__figure">
                    <mvt:do name="l.image_count" file="g.Module_Library_DB" value="ProductImageDataList_Load_Product(l.settings:more_product:id, l.settings:imagedata)"/>
                    <mvt:foreach iterator="data" array="imagedata">
                        <img style="max-height: 120px; max-width: 120px;" class="x-product-list__image" src="&mvt:data:image:image;" alt="&mvte:more_product:name;">
                    </mvt:foreach>
                    <figcaption>
                        <strong class="x-product-list__name">&mvte:more_product:name;</strong>
                        <mvt:if expr="l.settings:more_product:base_price GT l.settings:more_product:price">
                            <span class="u-text-bold x-product-layout-purchase__name u-font-small u-color-red">Reg. Price:<s id="price-value-additional">&mvt:more_product:formatted_base_price;</s></span> &nbsp;&nbsp;&nbsp;
                        </mvt:if>
                        Sale Price:&mvt:more_product:formatted_price; &mvt:more_product:formatted_base_price; $&mvt:more_product:price;
                    </figcaption>
                </figure>
            </a>
        </div>
    </mvt:foreach>
    Matt Zimmermann
    Director of UI/UX Standards and Theme Development
    / Miva, Inc.

    Comment


    • Even though all the products are using a price group for sale pricing, the only token working is
      $&mvt:more_product:price; So not working correctly. Thank you for helping. Please try and figure this out as this is a live store. K

      Comment


      • Man it bums me out when you get one answer and when it doesn't work it stops.

        Comment


        • Still looking into this one.
          Matt Zimmermann
          Director of UI/UX Standards and Theme Development
          / Miva, Inc.

          Comment


          • Thank you so much. A live site.

            K

            Comment


            • When you are explicitly loading the products in a category, you have to also load their discounts as the runtime_ function does not do this. You will need to add this: https://docs.miva.com/code-samples/d...discount-price
              Matt Zimmermann
              Director of UI/UX Standards and Theme Development
              / Miva, Inc.

              Comment

              Working...
              X

              This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

              This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

              Accept