Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hello KK,
As I advance in the use of couch cart, I keep thinking of some possible scenarios and I happen to have one lingering in my head now.

I want to create a separate gift-cards.php template (This will be used to add gift cards of different values so buyers can buy and add to the shopping cart) just like the usual template for uploading products and adding to the cart.

Now my question is, does couch allow the use of two different shop products templates in the same folder? (in my case gift_cards.php and shop.php and can both template have the pp_price, pp_product_thumb and all other editable fields) without confusing the cart?

Thank you
To be honest, using a single template for the products was a basic assumption while building the addon.
However, I think if you were to use multiple templates that would still work.
Please try and let us know how it goes.

Also, with the 'conditional fields' now available (viewtopic.php?f=5&t=11512), it shouldn't be too difficult to use a single template but have two (or more) sets of fields for different types of products i.e. essentially mimicking multiple templates using a single one with conditional fields.

You may try that approach also.

Hope this helps,
I confirm that 2 templates will work, as I did that a long time ago as well. If you remember, KK, there was something about the line item in cart.php that we fixed to accomodate for multiple templates.

Edit: I just found that topic that also brings helpful insights viewtopic.php?f=4&t=9845 I did quite a deep investigation without much understanding of PHP and I am really proud that fix made its way to Couch :)
Good luck to OP. Let us know if you find it working well.
Thanks KK and trendoman,
I will try the separate templates option as I want to keep the gift cards completely away from the shop products. Thank you once more
Hi KK and trendoman,
So I went ahead with gift card template by doing the following:
1. I created the gift cards template (A non-clonable one)
2. Defined the product description, product image, pp_product_thumb, pp_price, pp_options and pp_requires_shipping editables.
3.The pp_options will hold the card type and amount options.

Everything works fine except when I add a gift card to the cart ,the tag <cms:show title /> in the pp_cart_items tag shows
Default page for gift-cards.php * PLEASE CHANGE THIS TITLE * for only the gift cards. All other items from the shop template shows fine.
Also the <cms:show link /> goes to a url in this format: http://localhost:8888/duba/gift-cards.php?p=588 instead of http://localhost:8888/duba/gift-cards.php

Any pointers? Thank you
It's a non-clonable template.. In reality it is a template with 1 cloned hidden page. So tag <pp_cart_items> doesn't give a difference and shows page info, so the output is correct. Here is what you can do -

As in the mentioned topic define an editable (perhaps hidden) pp_mastertemplate. Then inside 'pp_cart_items' check if that variable contains the name of the gift cards template and use other variables in such case - k_template_title and k_template_link

Code: Select all
<cms:pp_cart_items>
   ..
   <cms:if mastertemplate = 'gift-cards.php'>
      
      <cms:pages masterpage=mastertemplate id=id >
         <cms:show k_template_title /> - <cms:show k_template_link />
      </cms:pages>
      
   <cms:else />

      <cms:show title /> - <cms:show link />
      
   </cms:if>   
   ..
</cms:pp_cart_items>
Thanks trendoman. It worked perfectly.
7 posts Page 1 of 1