ExperShop Lite Shopping CartHome Contents Please email any bug reports, comments or suggestions to ExperLog's Online Support OverviewExperShop Lite includes a shopping cart: items can be added and removed from the shopping cart, and the shopping cart content can be displayed in ExperShop DynHtml templates.The shopping cart also includes facilities to calculate taxes and shipping costs.
Displaying the cart contentThe shopping cart is accessible from DynHtml templates as a predefined data set, calledShoppingCart .
For example, you can loop on the shopping cart content at any time: $LoopOnResults ShoppingCart item Item Reference: $item:ProdId$ - Price: $item:Price$<br> $EndLoopShopping cart items include the following information:
$ShoppingCart
:TotalPrice$ is the total price for the shopping cart, tax and shipping
costs included.
The following fields can be displayed:
Adding/Removing itemsThe following actions can affect the shopping cart content:
To remove an item from the cart, use the ESUpdateCart action (and either specify a DEL-[ItemId] parameter equal to "y", or set the item quantity to "0").
Handling products with options (colors, sizes...)When you add an item to the shopping cart (with the ESAddToCart action), you may define additional parameters to handle product options:OptionNames lists the option names (comma separated): for example, <input type="hidden" name="OptionNames" value="Color,Size">For each option, you must define an input control: the input's name is the option's name, and its value will set the option's value. Example: <select size="1" name="Color"> <option>Red <option>Blue </select> <select size="1" name="Size"> <option>10 <option>20 </select>Then, when the form is submitted, the item is added to the cart with the corresponding options set. In the page
that lists the cart content, you can retrieve the option values like this
: $LoopOnResults ShoppingCart item Name=$item:Name$, Color=$item:Options.Color$,Note that, in the shop admin, the options will be retrieved from the order item as $item:Options$, in a less user-friendly manner: this will display a string that looks like { Color=Blue, Size=10 } - which is enough to be human-readable. Keeping user info in the cartThe shopping cart can keep user information in memory: the information is kept as long as the cart is not emptied. To store
user information in the cart, use the ESUpdateCart or ESAddToCart actions,
with UINFO_ <input type=text name="UINFO_FirstName">will cause an information called "FirstName" to be stored in the shopping cart when the form is submitted. To retrieve
previously stored user information, use $ShoppingCart:UInfo. Your first name is: $ShoppingCart:UInfo.FirstName$
Calculating taxes and shipping costsTaxes and shipping cost calculation is based on named "zones", defined in the shop configuration file.Zones define the way taxes and shipping costs are calculated. The shopping
cart can be associated to a tax zone and a shipping zone: zones are affected
using the Different kinds of shipping cost calculation algorithms can be used:
Example : defining two shipping zones For example, let's define a "Drive-In" zone for customers who come to the shop (with free shipping, of course), and a "Home" zone for customers who require delivery at home (we'll charge them a flat rate cost, for example 10 USD). The definitions in the configuration file can be the following: #Define a "drive-in" free zone shop.shippingcost.DriveIn.rate: 0 shop.shippingcost.DriveIn.type: FLAT #Define a "home" zone with 10$ flat charge shop.shippingcost.Home.rate: 10 shop.shippingcost.Home.type: FLAT #Default shipping zone is "home" shop.shippingcost.defaultzone: HomeIn the example above, the shipping cost will be 10$ by default, except if the customer chooses the "drive-in" option. Note that rates are generally numbers, but you may also define intervals: for example, shop.shippingcost.Home.type: PRICE shop.shippingcost.Home.rate: [0,100[=10;[100,+[=2;means the shipping cost for the "Home" zone is 10$ if 0 <= total price < 100$, and 2$ if total price >= 100$ Calculating shipping costs based on a Weight database tableYou can define weight-based shipping costs in a database table: the table will specify weight intervals, and corresponding costs, per shipping zone. For example, we'll define 2 shipping zones (Europe and USA), each one with 2 shipping modes (Normal and Express), each Zone/Mode combination having 3 rates defined by weight intervals (0-2 kg, 2-10kg, 10-1000kg). First, declare the shipping zones in the configuration file:
shop.shippingcost.defaultzone: USA shop.shippingcost.defaultmode: Normal shop.shippingcost.USA_Normal.type: weight_table shop.shippingcost.USA_Express.type: weight_table shop.shippingcost.Europe_Normal.type: weight_table shop.shippingcost.Europe_Express.type: weight_tableThen, create a new table in the database, called EShippingCost. The table must include the following columns, of type Number:
Example in Postgres syntax:
create table EShippingCost ( MinWeight float4, MaxWeight float4, USA_Normal float4, USA_Express float4, Europe_Normal float4, Europe_Express float4 );Then, you just have to fill in the table: you can do that by yourself (writing database insert requests, or using a database GUI tool), or use the expershop bulk Loader, as follows: Create an input file that contains the values
$TABLE EShippingCost $COLUMN MinWeight N $COLUMN MaxWeight N $COLUMN USA_Normal N $COLUMN USA_Express N $COLUMN Europe_Normal N $COLUMN Europe_Express N $SEPARATORS ; $POSTFIX ; $BEGINDATA 0;2;8;12;14;18 2;10;10;14;15;20 10;1000;15;18;20;25 $ENDDATAThis means :
Run the loader This will generate the INSERT SQL requests to fill in your table: save them into a file, and execute it as an SQL script in your database. |