PDA

View Full Version : Smarty Template Code for Product Name & Desc in cart?



BryanB
02-04-10, 11:52 PM
I'm trying to add the product name and description in the shopping cart above where it says "subtotal"

I've tried using this code but it wont display:
{$product.name}-{$product.description}

I'd like to include it here, as it is not included if you link directly to a product.
http://content.screencast.com/users/BryanBittner/folders/Jing/media/05d05093-56d7-45ca-a654-6dae3279efd7/00001072.png

This is on /cart.php?a=view

and here is my viewcart.tpl lines 9-28

<p class="ordersummary">
{$product.name}-{$product.description}<br />
{$LANG.ordersubtotal}: {$subtotal}<br />
{if $promotioncode}{$promotiondescription}: {$discount}<br />{/if}
{if $taxrate}{$taxname} @ {$taxrate}%: {$taxtotal}<br />{/if}
{if $taxrate2}{$taxname2} @ {$taxrate2}%: {$taxtotal2}<br />{/if}
<b>{$LANG.ordertotalduetoday}: {$total}</b><br />
{if $totalrecurringmonthly || $totalrecurringquarterly || $totalrecurringsemiannually || $totalrecurringannually || $totalrecurringbiennially}
{$LANG.ordertotalrecurring}: {if $totalrecurringmonthly}{$totalrecurringmonthly} {$LANG.orderpaymenttermmonthly}, {/if}
{if $totalrecurringquarterly}{$totalrecurringquarterly } {$LANG.orderpaymenttermquarterly}, {/if}
{if $totalrecurringsemiannually}{$totalrecurringsemian nually} {$LANG.orderpaymenttermsemiannually}, {/if}
{if $totalrecurringannually}{$totalrecurringannually} {$LANG.orderpaymenttermannually}, {/if}
{if $totalrecurringbiennially}{$totalrecurringbiennial ly} {$LANG.orderpaymenttermbiennially}, {/if}{/if}
</p>
<center>
<p>Not the correct amount?
Click here to start over:
<input type="button" value="{$LANG.orderstartover}" onclick="window.location='cart.php?a=startover'" />
</p>
</center>

Any ideas?

m00
02-05-10, 09:25 AM
You are missing the foreach:


<p class="ordersummary">
{foreach key=num item=product from=$products}
{$product.productinfo.name}-{$product.productinfo.description}<br />
{/foreach}
{$LANG.ordersubtotal}: {$subtotal}<br />
{if $promotioncode}{$promotiondescription}: {$discount}<br />{/if}
{if $taxrate}{$taxname} @ {$taxrate}%: {$taxtotal}<br />{/if}
{if $taxrate2}{$taxname2} @ {$taxrate2}%: {$taxtotal2}<br />{/if}
<b>{$LANG.ordertotalduetoday}: {$total}</b><br />
{if $totalrecurringmonthly || $totalrecurringquarterly || $totalrecurringsemiannually || $totalrecurringannually || $totalrecurringbiennially}
{$LANG.ordertotalrecurring}: {if $totalrecurringmonthly}{$totalrecurringmonthly} {$LANG.orderpaymenttermmonthly}, {/if}
{if $totalrecurringquarterly}{$totalrecurringquarterly } {$LANG.orderpaymenttermquarterly}, {/if}
{if $totalrecurringsemiannually}{$totalrecurringsemian nually} {$LANG.orderpaymenttermsemiannually}, {/if}
{if $totalrecurringannually}{$totalrecurringannually} {$LANG.orderpaymenttermannually}, {/if}
{if $totalrecurringbiennially}{$totalrecurringbiennial ly} {$LANG.orderpaymenttermbiennially}, {/if}{/if}
</p>
<center>
<p>Not the correct amount?
Click here to start over:
<input type="button" value="{$LANG.orderstartover}" onclick="window.location='cart.php?a=startover'" />
</p>
</center>

(I don't know if the description works, I'm not sure if the variable exists)

BryanB
02-05-10, 07:41 PM
That worked, description too. Thanks!

bunhosting
02-06-10, 05:47 AM
is it me or am i missing a viewcart.tpl file in my template folder?

m00
02-06-10, 09:22 AM
is it me or am i missing a viewcart.tpl file in my template folder?

Yes, you are missing it there. ;) It's in the /templates/orderforms/<your order form>/ folder.