Page 1 of 1
How to add a link to product detail in Cart Made Simple
Posted: Sun Jul 24, 2011 11:14 am
by aletsix
Hi all,
I have been using CMSMS for a while and decided to try the eCommerce solutions available. I have just installed the latest version of
CMSMS 1.9.4.2
Cart Made Simple 0.3.8
Shop Made Simple 0.3.4
Payment Made simple 1.4
The modules are fantastic for what I need, there are only just a couple of problems that I need your help with:
1. In the Cart Templates (fe_showcart) I want to create a link for each product name on the list
(<td class="productname">{$entry->prd_name} {if $entry->attr_name != ''}<br />{$entry->attr_name}{/if}</td>) to the corresponding product detail page so that the user can refer to the product image and confirm they want to proceed with the purchase.
I wanted to add an image next to the product but found on other posts that this is not possible (very unfortunate

) so it occurred to me that a link should be sufficient.
2. I have also found a problem when you add the same product twice. It displays the product twice in the view cart module and if you click on "remove" it removes both. Is there any way to just get around this?
Hope to get some feedback from the CMSMS community. Thanks a lot for your help on this
Re: How to add a link to product detail in Cart Made Simple
Posted: Tue Jul 26, 2011 6:56 pm
by Duketown
aletsix,
Please check template 'Category & Products' in tab Templates of Shop Made Simple.
It should contain:
Code: Select all
{if $prodimage!='*none'}<td class="img">
{image src=$entry->prodimage alt=$entry->proddesc}</td>
{* or use the following. The image is then a link to the detail page
{$entry->prodimagelink}</td>
*}
This would generate a thumbnail of the first found image of the product.
Second issue is true. That is happening if one uses the add to cart from the list of products. If however the visitor has added the product via the detail page of the product, all is working as expected.
A change to this will be available as of version 0.3.5 of Shop Made Simple.
Duketown
Re: How to add a link to product detail in Cart Made Simple
Posted: Wed Jul 27, 2011 10:37 am
by aletsix
Hi Duketown,
Thanks for your reply. I tried to copy that code into Cart made simple template (fe_showcart) but it gives me an error:
"string(162) "Smarty error: [in module_db_tpl:CartMadeSimple;cart_fe_showcart line 72]: syntax error: unclosed tag \{if} (opened line 19). (Smarty_Compiler.class.php, line 317)" "
Am I doing something wrong? I looks like this tag will work for Shop Made Simple module but not for Cart Made Simple. Thanks a lot again for your reply.
Re: How to add a link to product detail in Cart Made Simple
Posted: Wed Jul 27, 2011 1:44 pm
by Coldman
Just put {/if} after *}
Code: Select all
{if $prodimage!='*none'}<td class="img">
{image src=$entry->prodimage alt=$entry->proddesc}</td>
{* or use the following. The image is then a link to the detail page
{$entry->prodimagelink}</td>
*}
{/if}
Re: How to add a link to product detail in Cart Made Simple
Posted: Thu Jul 28, 2011 9:37 am
by aletsix
Hi Coldman, I've tried your suggestion but didn't work. I have added a new <th> and the code in the <td> before product quantity. Here is the code:
Code: Select all
{* List of products in cart *}
{literal}
<__script__ language="JavaScript">
function UpdateQty(item)
{
product_id = item.name.substr(0, item.name.indexOf("|"));
attribute_id = item.name.substr(item.name.indexOf("|")+1, 99);
newQty = item.options[item.selectedIndex].text;
<!-- I know, the following is not very neatly done, but it works. Sorry :-) // -->
document.location.href = 'index.php?mact=CartMadeSimple,cntnt01,cart,0&cntnt01product_id='+product_id+'&cntnt01attribute_id='+attribute_id+'&cntnt01qty='+newQty+'&cntnt01perfaction=update_product';
}
</__script>
{/literal}
<div class="productlist">
{if $productcount != 0}
<div ID="productcount">{$label_product_count}</div>
{/if}
<table width="100%" border="0" cellspacing="10" cellpadding="20">
{if $productcount > 0}
<thead>
<tr>
<th>{$prodimage}</th>
<th>{$productqtytext}</th>
<th>{$productnametext}</th>
<th class="productprice">{$productpricetext}</th>
<th class="productamount">{$lineamounttext}</th>
<th class="pageicon"> </th>
<th class="pageicon"> </th>
</tr>
</thead>
<tbody>
{foreach from=$products item=entry}
<tr class="{$entry->rowclass}" onmouseover="this.className='{$entry->rowclass}hover';" onmouseout="this.className='{$entry->rowclass}';">
<td>{$entry->prodimage}{if $prodimage!='*none'}<td class="img">
{image src=$entry->prodimage alt=$entry->proddesc}</td>
{* or use the following. The image is then a link to the detail page
{$entry->prodimagelink}*}{/if}</td>
<td class="productqty"><select name={$entry->product_id}|{$entry->attribute_id} onchange="UpdateQty(this);"> {html_options options=$entry->qtydropdown selected=$entry->myqty}</select></td>
<td class="productname">{$entry->prd_name}{if $entry->attr_name != ''}<br />{$entry->attr_name}{/if}</td>
<td class="productprice">{$entry->price}</td>
<td class="productamount">{$entry->lineamount}</td>
<td class="productremove">{$entry->deletelink}</td>
</tr>
{/foreach}
{else}
<tr class="{cycle values="row1,row2"}">
<td colspan='5' align='center'>{$noproductsincart}</td>
</tr>
</tbody>
{/if}
</table>
{if $productcount > 0}
<div ID="totalamount">{$label_total_amount}</div>
<div ID="checkout">{$startcheckout}</div>
{/if}
<div ID="continue">{$continueshopping}</div>
</div>
and the screen shot of what is displayed: (notice that the columns don't match up). Any help will be much appreciated.
Cheers