init_carts

Tag {init_carts} returns an array of saved shopping carts of given user.

 

Parameters 

  • name - variable name where the returned data is saved. Default value is "carts".
  • user - user ID who owns the carts. If not defined then currently logged in user id is used.

Attributes

  • data - the content of a cart
  • user - the username who owns the cart.
  • sum - the total sum (amount * price) of the cart, monetary value. 
  • vat - the total VAT of the cart, monetary value.
  • delete - href for deleting the cart.
  • print - href, will open the print window for the cart.
  • neworder - href for starting a new order with this cart. 
  • href - href for showing the details of the cart.

Example


 {if $user}
 {init_carts user=$userdata->kasutaja_id}  <p><font class="pealkiri">Salvestatud ostukorvid</font></p>
 <table border=1 width="100%">
 <tr>
 <td class="boxhead">user</td>
 <td class="boxhead">id</td>
 <td class="boxhead">date</td>
 <td class="boxhead">data</td>
 <td class="boxhead">sum</td>
 <td class="boxhead">vat</td>
 </tr>
 {foreach from=$carts item=cart}
 <tr>
 <td class="txt">{$cart->user}</td>
 <td class="txt">{$cart->id}</td>
 <td class="txt">{$cart->date}</td>
 <td class="txt">{$cart->data}</td>
 <td class="txt">{$cart->sum}</td>
 <td class="txt">{$cart->vat}</td>
 </tr>
 {/foreach}
 </table>
{else}
 <form action="{$self}" method=post>
 login: {login_name}
 pass: {login_pass}
 {login_button}
 </form>
{/if}