Basket
The Aurora basket allows you to present the items a visitor has added to their basket to them with a wide range of related pricing, promotional and availability details.
This article describes all of the data available to the templates on the Basket page.
Variables available on the Basket page
The following is a list of variables that can be accessed by the Aurora Front-end Templates under the Basket page.
Variable name | Type | Currency | Description |
---|---|---|---|
$basketReference | String | This is the Basket Reference for the current user's session. | |
$basket | Array [ $basket_item ] | An array of basket items for the current page. | |
$basket_item | Container | A container holding all of a basket items details. | |
$basket_item.product_id | Integer | The internal ID Aurora uses to identify a product. | |
$basket_item.user_ip | String | The IP of the user accessing the website. | |
$basket_item.user_cookie | String | The cookie value that Aurora uses to track a users presence on the website. | |
$basket_item.product_quantity | Integer | The quantity of the product featured on the current basket line. | |
$basket_item.product_price | Float | Default | The standard price of the product including applicable Tax, as listed on the Front-end. |
$basket_item.product_tax | Float | Default | The tax payable on the standard price of the product. |
$basket_item.basket_price | Float | Selected | The price of the product including applicable Tax, as it is featured in the basket. The 'basket price' can differ from the standard product price for a variety of reasons, mostly involving Basket Promotions and custom product 'add-ons'. |
$basket_item.basket_tax | Float | Selected | The tax payable on the basket price of the product. |
$basket_item.vat_rate | Float | The rate of tax payable on the product, represented as a percentage. | |
$basket_item.product_discount | Float | Default | The discount applicable to this basket line in total. |
$basket_item.product_stock | Integer | The current stock level for the product as a whole (including all variations). | |
$basket_item.variation_stock | Integer | The current stock level for the specific product variation featured in the basket. | |
$basket_item.product | Container | A container holding all of a Product details. | |
$basket_item.product_fields | Array [ String ] | An array of additional fields applicable for the products featured in the current basket line. | |
$basket_item.stock_response | Array | Contains all the stock information based on the product. | |
$basket_item.stock_response.available_stock | Integer | This is a subtraction between actual_stock + pre_order_stock. | |
$basket_item.stock_response.allow_purchase | Boolean | Allow the product to be purchased. | |
$basket_item.stock_response.allow_in_basket | Boolean | Allow the product to be in the basket. | |
$basket_item.stock_response.actual_stock | Integer | Actual stock of the product. | |
$basket_item.stock_response.pre_order_stock | Integer | Preorder stock. | |
$basket_item.product_bundles_data | Array | Contains all product bundles data items for the basket item. | |
$basket_item.bundle_name | String | Contains the item's bundle name if applicable | |
$errors | Array[ String ] | List of generic basket errors. Can be displayed using such code: | |
$free_shipping_spend | Float | Selected | This is how much more the visitor needs to spend before their basket will qualify for free shipping. |
$free_shipping_available | [ TRUE | FALSE ] | This denotes whether free shipping is available at all. | |
$basket_error_message | String | This error is placed when the limitation of a card and renewal cards is not to be placed in one order. The variable is translated and could be used it plain. |
Example Show Basket Discounts
Please see the following example of how to reflect discount within your basket item/line prices.
{assign var="total_discount" value=$basket_item.promotion_discount+$basket_item.price_break_discount}
{if $total_discount > 0}
<s>{$basket_item.basket_price|displayPrice}</s><br />
{assign var="basket_price_inc_discount" value=$basket_item.basket_price-$total_discount}
{$basket_price_inc_discount|displayPrice}
{else}
{$basket_item.basket_price|displayPrice}
{/if}
Example Stock Response Use
Please see the following example for the stock response used to display messages on the basket relating to a products Store and Warehouse availability.
This example has been extracted from the basket/index.tpl.html template.
{if $basket_item.product_bundles_stock_response[$index].allow_purchase == false}
{if $basket_item.product_bundles_stock_response[$index].available_stock == 0}
{assign var='hide_checkout' value=false}
<div class="basketproductstock"><p>{site_text page="Basket" part="Error: Store has no stock" default="Currently this item has no stock in this store. Please remove it, change to a different store or select home delivery to proceed."}</p></div>
{elseif $basket_item.product_bundles_stock_response[$index].available_stock < $basket_item.product_quantity * $basket_item.product_bundles_quantity[$index]}
{assign var='hide_checkout' value=false}
<div class="basketproductstock"><p>{site_text page="Basket" part="Error: Store has insufficient stock" default="This store only has %(available_stock)s of these items in stock and you requested %(quantity_requested)s. Please lower the quantity, change to a different store or select home delivery to proceed." var_available_stock=$basket_item.product_bundles_stock_response[$index].available_stock var_quantity_requested=$basket_item.product_quantity*$basket_item.product_bundles_quantity[$index]}</p></div>
{/if}
{/if}
Example Free Shipping Spend
Aurora calculates the amount required for the customer to spend in order to receive free shipping and presents the following template variables:
{$free_shipping_available}
{$free_shipping_spend}
The following data points are also available within the getBasketDetails AJAX endpoint response:
response.free_shipping_spend_show
response.free_shipping_spend
Please see the following example for displaying a message to the customer, based upon the above variables:
This example has been extracted from the basket/index.tpl.html template.
<div class="basket_freedelivery"{if !$free_shipping_available} style="display: none;"{/if}>
<div class="basket_freedelivery_qualify" {if $free_shipping_spend != '0'}style="display: none;"{/if}>
<p>
{site_text page="Basket" part="Warning: Free shipping qualified"}
</p>
</div>
<div class="basket_freedelivery_extra_spend" {if $free_shipping_spend == '0'}style="display: none;"{/if}>
<p>
{capture assign="shipping_spend_more"}<span class="basket_youonlyneed_price">{$free_shipping_spend|displayPrice}</span>{/capture}
{site_text page="Basket" part="Warning: Free Shipping - spend more to qualify" var_shipping=$shipping_spend_more}
</p>
</div>
</div>
Example Product Bundles Data
The following example iterates over a basket item's product bundles data, outputting the product name and brand field:
{if $basket_item.product_bundles_data}
{foreach from=$basket_item.product_bundles_data item="bundle_product"}
<b>{$bundle_product.product_name}: BRAND: {$bundle_product.fields.brand}</b><br/>
{/foreach}
{/if}
Features
- Continue Shopping with the dropdown to go back to the home page, previous products, or the previous products main category.
Updated 14 days ago