This template displays the contents of the shopping basket
General Basket references
Term | Data Type | Typical Output | Description |
---|---|---|---|
postcode_form | html | <form… | HTML Postcode checker form |
has_free_delivery_products | boolean | true / false | Determines if a basket contains 100% free delivery items |
products | array | (See products) | |
totals | array | (See totals) | |
payment_modules | array | (See Payment Modules) |
products (array)
The products reference allows you to display products that exist in the basket. This reference is a recursive array containing the following references within each sub array contained within products.
Term | Data Type | Typical Output | Description |
---|---|---|---|
id | int | 4 | The product id |
image_one.active | varchar | http://www.yourstore/images/product_images/mini/product_image.jpg | Mini Image URL & Path |
image_one.small | varchar | http://www.yourstore/images/product_images/small/product_image.jpg | Small Image URL & Path |
image_one.thumb | varchar | http://www.yourstore/images/product_images/thumb/product_image.jpg | Thumb Image URL & Path |
image_one.main | varchar | http://www.yourstore/images/product_images/main/product_image.jpg | Main Image URL & Path |
image_one.large | varchar | http://www.yourstore/images/product_images/large/product_image.jpg | Large Image URL & Path |
code | varchar | 23234 | The product code |
man | varchar | MAN2354 | The manufacturers code code |
link | varchar | http://www.yourstore/product/product_name_1.html | Link to the product |
name | varchar | Product Name | The plain text name for this product |
name_short | varchar | Product Na.. | An abbreviated title of the product |
path | varchar | /p/product-name_3223.html | The link path to the product |
tax | varchar | 20 | Tax rate in percent |
login_for_price | boolean | true/false | User has to log in to view price if true |
attributes | array | (See attributes) | |
tags | array | (See product tags) | |
remove_button | html | HTML button to remove product line | |
code | varchar | 51148 | Your product code |
man_code | varchar | GB8980 | The manufacturers code |
stock | int | 7 | The quantity in stock for this product |
stock_due | varchar | 3-4 Days | Stock Due Message |
stock_allocated | int | 7 | The quantity of stock allocated |
stock_message | html | 7 | * Stock Shortage - More stock due in 3-4 days * |
qty | int | 7 | The quantity for this product |
qty_field | html | HTML qty input field | |
line_total | int | $5.33 | The formatted total for this product line excluding tax in the currency placed |
line_total_inc_tax | int | $6.33 | The formatted total for this product line including tax in the currency placed |
price_ex_tax | varchar | $5.00 | The price excluding tax formatted to the local currency |
price_inc_tax | varchar | $5.90 | The price including tax formatted to the local currency |
price_was | varchar | $5.90 | The RRP price formatted to the local currency |
price_saved | varchar | $5.90 | The price saved formatted to the local currency |
price_saved_percent | varchar | 10% | Saving as a percentage |
price_is_saving | boolean | true / false | Is this product on special? |
savings_text | varchar | Was: $5.66, Saving: 10% | Formated Savings text |
is_editable | boolean | true / false | Determines if a product is editable, ie QTY can be changed |
warranty_days | int | 365 | The warranty in days |
weight | int | 990 | Weight in grams |
type | varchar | Determines if a product is a digital product or physical | |
is_free_delivery | boolean | true / false | Determines if a product is eligible for free delivery |
is_dropship | boolean | true / false | Determines if a product is a dropship product or not |
type | varchar | subproduct | Determines if a product is a subproduct etc |
dropship_message | varchar | Ships in 1-3 Days | Text output explaining this product is a dropship item and there might be a delay |
row_class | varchar | odd | Either odd or even |
attributes (array)
The attributes reference allows you to display products that exist within each products array in the basket. This reference is a recursive array containing the following references within each sub array contained within attributes.
Term | Data Type | Typical Output | Description |
---|---|---|---|
name | varchar | Product Name | The plain text name for this product |
stock | int | 7 | The quantity in stock for this product |
qty | int | 7 | The quantity for this product |
price_ex_tax | varchar | $5.00 | The price excluding tax formatted to the local currency |
content | html | $5.00 | The price excluding tax formatted to the local currency |
This is how we would use the attributes array, within a products reference loop
{% for attribute in product.attributes %} <br />- {{ attribute.qty }} x {{ attribute.name }} {{ attribute.price }} {% if attribute.stock < 1 %} {% set attribute_out_of_stock_count = attribute_out_of_stock_count + 1 %} {% endif %} {% endfor %}
Product Tags (array)
This array accesses a list of product tags assigned to a product which you can cycle through and render using HTML. You will need to make sure any tags are associated with a tag group.
Each product.tags variable is an array containing the following.
Term | Data Type | Typical Output | Description |
---|---|---|---|
tag_group.name | varchar | Colour | The name of the tag group |
tag_group.id | int | 44 | The id of the Tag Group |
tag_group.url | varchar | http://www.. | An optional hyperlink |
tag_group.description | varchar | Colour | A Description for the Tag Group |
tag_group.image | varchar | tag-group-image.jpg | The image associated with the Tag Group |
tag.name | varchar | Red | The name of the tag associated to the group |
tag.id | int | 46 | The id of the tag |
tag.url | varchar | http://www.. | An optional hyperlink |
tag.description | varchar | Colour | A Description for the tag |
tag.image | varchar | tag-image.jpg | The image associated with the tag |
<a href="{{ product.path }}" title="Show me {{ product.name }}"> {% for tag in product.tags %} {% if tag.tag_group.name == 'Collection' and product.category.id not in [25,27,28,29,30,31,32,33,51] %}{{ tag.tag.name }} {% endif %} {% endfor %} {{ product.name }} {% for tag in product.tags %} {% if tag.tag_group.name == 'Finish' %} in {{ tag.tag.name }} {% endif %} {% endfor %} </a>
totals
The totals reference contains the following references. All these can be accessed directly without a loop.
Term | Data Type | Typical Output | Description |
---|---|---|---|
totals.has_surcharge | boolean | Ture / false | Determines if a basket has a delivery surcharge |
totals.surcharge | varchar | $55.00 | Formatted total for delivery surcharge ex tax |
totals.surcharge_inc_tax | varchar | $55.00 | Formatted total for delivery surcharge inc tax |
totals.delivery | varchar | $5.00 | Formatted sub total for delivery ex tax |
totals.delivery_inc_tax | varchar | $5.00 | Formatted sub total for delivery inc tax |
totals.delivery_select | html | <select… | HTML Select list for choosing delivery |
totals.discount | varchar | $5.00 | The gross discount price formatted to the local currency |
totals.sub_total | varchar | $20.00 | Order Sub total formatted to the local currency |
totals.tax | varchar | $5.00 | The tax amount formatted to the local currency |
totals.tax_rate | varchar | $5.00 | The tax rate % |
totals.total | varchar | $25.00 | The total price including tax formatted to the local currency |
totals.total_raw | varchar | 25.00 | The total price including tax without the currency code / prefix |
Usage
<table cellspacing="0" cellpadding="0" class="productList"> <thead> <tr> <th> </th> <th>Product Description</th> <th>Stock</th> <th>Qty</th> <th>Unit Price</th> <th>Line Total</th> </tr> </thead> <tbody> <form id="update" method="post" action="php?action=update"> {{ form_field_seed|raw }} {% for product in products %} {% if product.image_one.active %} {% set product_image %}{{ product.image_one.mini }}{% endset %} {% else %} {% set product_image = "pics/image_na_mini.gif" %} {% endif %} <tr class="{{ product.row_class }}"> <td width="35"><img src="{{ product_image }}" border="1" alt="{{ product.name }}" /></td> <td class="mini_basket_name"> <span class="productName"> <a href="{{ product.path }}" title="Show me {{ product.name }}">{{ product.name }}</a> </span><br><span class="small">Product Code: {{ product.code }} Manufacturers Code: {{ product.man }}</span> {% if product.attributes %}<br /><br /><strong>Product Options</strong>{% endif %} {% for attribute in product.attributes %} <br />- {{ attribute.qty }} x {{ attribute.name }} {{ attribute.price }} {% if attribute.stock < 1 %} {% set attribute_out_of_stock_count = attribute_out_of_stock_count + 1 %} {% endif %} {% endfor %} {% if product.stock < product.qty or attribute_out_of_stock_count > 0 %} <br><span class="red_text">* Stock Shortage - More stock due {{ product.stock_due }} *</br> {% endif %} {% if product.dropship_id > 0 %} <br><span class="red_text">* Ships in 1-3 Days *</span> {% endif %} </td> <td> {% if product.is_editable and product.type != "subproduct" %} {% else %} {{ product.stock }} {% endif %} </td> <td class="mini_basket_qty">{{ product.qty_field|raw }}{{ product.remove_button|raw }}</td> <td class="mini_basket_qty">{% if product.type != "subproduct" %} {{ product.price_ex_tax|raw }} {% endif %}</td> <td class="mini_basket_qty">{% if product.type != "subproduct" %} {{ product.line_total|raw }} {% endif %}</td> </tr> {% endfor %} </form> <tr> <td class="clear"> </td> <td colspan="2" class="totals"> <form name="set_shipping_module" method="post" action="php?action=set_shipping_module"> <strong>Shipping:</strong> <br />{{ totals.delivery_select|raw }} </form> </td> <td class="clear"><input type="button" onclick="document.forms[\'update\'].submit();" class="submit_green" value="update" /></td> <td class="totals"><b>Delivery</b></td> <td class="totals">{{ totals.delivery|raw }}</td> </tr> {% if totals.has_surcharge %} <tr> <td class="clear"> </td> <td colspan="2" class="totals"><img src="pics/box/icon_i.gif" alt="Information" /> There is a surcharge for shipping to your postcode</td> <td class="clear"> </td> <td class="totals"><b>Delivery<br />Surcharge</b></td> <td class="totals">{{ totals.surcharge }}</td> </tr> {% endif %} {% if totals.has_discount %} <tr> <td class="clear"> </td> <td colspan="2" class="clear"> </td> <td class="clear"> </td> <td class="totals_sub"><b>Discount</b></td> <td class="totals_sub">-{{ totals.discount|raw }}</td> </tr> {% endif %} {% if tax_number %} <tr> <td class="clear"> </td> <td colspan="2" class="clear"> </td> <td class="clear"> </td> <td class="totals_sub"><b>Subtotal</b></td> <td class="totals_sub">{{ totals.sub_total|raw }}</td> </tr> <tr class="totals"> <td class="clear"> </td> <td colspan="2" class="clear">{% if has_free_delivery_products %} <strong>Your order is eligible for Free Delivery!</strong> {% endif %}</td> <td class="clear"> </td> <td class="totals"><b>VAT<br>@{{ totals.tax_rate }}%</b></td> <td class="totals">{{ totals.tax|raw }}</td> </tr> {% endif %} <tr class="totals"> <td colspan="4" class="clear"></td> <td class="totals_total">Total</td> <td class="totals_total">{{ totals.total|raw }}</td> </tr> </tbody> </table>
Payment Modules (array)
The payment_modules reference allows you to access available payment modules that exist in for your store. This reference is a recursive array containing the following references within each sub array contained within payment modules.
This array can be used to find out what modules you have available and to decide where to display any payment buttons, such as the Paypal express checkout button.
Term | Data Type | Typical Output | Description |
---|---|---|---|
text | varchar | Paypal Express | The descriptive output name of the payment module |
tag | varchar | paypal | The Instantcart tag identifier for this module |
Voucher Codes
To accept discounts based on a voucher code, you can add a voucher code box to your basket page as follows. This will apply a discount to the basket that matches a code added via the control panel:
<div class="voucher" style="float:left;margin: 0 50px; padding:10px;"> <form name="discount" method="post" action="basket.php?action=add_discount"> <input type="text" name="discount"> <input type="submit" value="Apply Voucher"> </form> </div>
Comments
0 comments
Please sign in to leave a comment.