Announcement

Collapse
No announcement yet.

Add to Cart on CTGY and SRCH page

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

  • Add to Cart on CTGY and SRCH page

    Has anyone added a "Add to Cart" buttons to the SRCH and/or CTGY page with code snippet they could share?

  • This is not something I have implemented, but here is how I would start it off:
    Code:
    <section class="o-layout u-grids-2 u-grids-3--l x-product-list">
        <mvt:foreach iterator="product" array="category_listing:products">
            <div class="o-layout__item u-text-center x-product-list__item">
                <a class="u-block x-product-list__link" href="&mvte:product:link;" title="&mvte:product:name;">
                    <figure class="x-product-list__figure">
                        <img class="x-product-list__image" src="&mvte:product:imagetypes:main;" alt="&mvte:product:name;">
                        <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="x-product-list__price u-color-gray-30"><s>&mvt:product:formatted_base_price;</s></span>
                                <span class="x-product-list__price u-color-red">&mvt:product:formatted_price;</span>
                            <mvt:else>
                                <span class="x-product-list__price">&mvt:product:formatted_price;</span>
                            </mvt:if>
                        </figcaption>
                    </figure>
                </a>
                <form method="post" action="&mvte:urls:BASK:rr;">
                    <input type="hidden" name="Old_Screen" value="&mvte:global:Screen;"/>
                    <input type="hidden" name="Old_Search" value="&mvte:global:Search;"/>
                    <input type="hidden" name="Action" value="ADPR"/>
                    <input type="hidden" name="Quantity" value="1"/>
                    <input type="hidden" name="Attributes" value="Yes"/>
                    <input type="hidden" name="Product_Code" value="&mvte:product:code;"/>
                    <input type="hidden" name="Current_Product_Code" value="&mvte:global:Product_Code;"/>
                    <input type="hidden" name="Category_Code" value="&mvte:global:Category_Code;"/>
                    <input type="hidden" name="Offset" value="&mvte:global:CatListingOffset;"/>
                    <input type="hidden" name="AllOffset" value="&mvte:global:AllOffset;"/>
                    <input type="hidden" name="CatListingOffset" value="&mvte:global:CatListingOffset;"/>
                    <input type="hidden" name="RelatedOffset" value="&mvte:global:RelatedOffset;"/>
                    <input type="hidden" name="SearchOffset" value="&mvte:global:SearchOffset;"/>
                    <mvt:foreach iterator="facet" array="facets:facets">
                        <mvt:foreach iterator="facet_value" array="facet:values">
                            <mvt:if expr="l.settings:facet_value:selected">
                                <input type="hidden" name="&mvte:facet:code;" value="&mvte:facet_value:value;"/>
                            </mvt:if>
                        </mvt:foreach>
                    </mvt:foreach>
                    <mvt:item name="buttons" param="AddToBasketE"/>
                </form>
            </div>
        </mvt:foreach>
    </section>
    <!-- end .x-product-list -->
    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