We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22614
    • 5 Posts
    Hi,
    I have several products, divided into several categories. The user can navigate into a category display, where all products from each category are displayed. This is accomplished by a Ditto call, and it displays the image and a link to the individual product. However, I would also like to add an "add to cart" button, and for that I need to collect also product information, such as price, SKU# etc. All these information is available as TV, for each individual product. How do I pass the TV values for each product with my Ditto call (or any other way) across pages?

    My Ditto call that displays all products for each category (paginated) goes like this

    <div id="category-descr">
    [[Ditto? &amp;parents=`13` &amp;tpl=`specific_category` &amp;display=`6` &amp;orderBy=`[*product_id*] ASC` &amp;paginate=`1` &amp;paginateAlwaysShowLinks=`0`]]
    <div class="previous-next"> [+previous+] [+next+]</div><!--end previous-next-->
    </div><!--end category descr-->

    My &tpl chunk goes like this

    <div class="product-info">
    <a href="[~[+id+]~]" class="product-name" >[+pagetitle+]</a> <a href="[~[+id+]~]" class="product-image-link" ><img src="[+product_image+]" class="reflect product-image-category rheight33" /></a>
    </div><!--end product info-->

    I suspect (but of course, may be completely wrong) that I can collect the TV’s with my &tpl, just as I collect the [+product_image+] TV, but I don’t know what to assign them to. Any advise? Thank you.

    EDIT: I figured it out. I was going on it the right way, but overcomplicated it. There is no need to assign it to anything. Basically, all I needed was to add [+product_price+], [+product_id+] and other TVs into the tpl chunk, and then set the display to none in the CSS. So my final code looks like this:

    <div class="product-info">
    <a href="[~[+id+]~]" class="product-name" >[+pagetitle+]</a> <a href="[~[+id+]~]" class="product-image-link" ><img src="[+product_image+]" class="reflect product-image-category rheight33" /></a>
    <p class="hidden">[+product_name+]

    [+product_id+]

    [+product_price+]

    [+product_category+]

    [+product_weight+]
    </p>
    {{foxycart_cart}} <!--foxycart snippet-->
    <div class="product-text">[+introtext+]</div><!--end product text-->
    </div><!--end product info-->

    Very simple and Foxycart picks up all the necessary TVs.