Glossary Item Box
There are three major components to the Shipping Cost Calculator:
The ShippingCost.aspx page is used to create a pop-up window for the Shipping Cost Calculator. ShippingCost.aspx is located in the root directory of your store. It uses the ShippingCost.ascx user control to render the calculator.
The ShippingCost.ascx user control displays both the input fields and the results of the shipping cost calculation within the pop-up window (ShippingCost.aspx). ShippingCost.ascx is located in the BVCAddons folder of your store.
Sections of the content are turned on or off by the code depending on the state of the calculation. Although you can move elements around to suite your requirements, it is not a good idea to delete any server controls (server controls are controls that have the runat="server" attribute). If you want to hide specific elements so they never appear, surround them with HTML comment markers like this:
<!-- Hide this label <asp:Label id="test" runat="server">Test</asp:Label> -->
The ShippingCostCart.ascx user control displays the Shipping Cost Calculator within the shopping cart page (cart.aspx). ShippingCostCart.ascx is also located in the BVCAddons folder of your store. The same advice from above regarding server controls applies to ShippingCostCart.ascx.
As noted above, the ShippingCost.aspx page uses the ShippingCost.ascx user control to create the calculator input fields and format the output. Similarly, ShippingCostCart displays the calculator within the the shopping cart page. You can use either or both methods. If you followed the installation instructions, then when you edit ShippingCost.aspx or cart.aspx, you will find this HTML tag that inserts the appropriate calculator control:
<bvcaddons:ShippingCostControl id="ShippingCost" runat="server" />
In addition to id and runat, ShippingCostControl supports two properties that affect the calculator display: CombineHandlingWithShipping and LocalizeToCountry.
CombineHandlingWithShipping (can be abbreviated to CombineHandling) takes a boolean value (true or false). The default value is false. When CombineHandlingWithShipping is false, shipping and handling fees are shown separately. When CombineHandlingWithShipping is true, handling fees are combined with the shipping rates and no separate handling fee is displayed.
To combine handling fees with shipping, add the highlighted text to the ShippingCostControl tag as shown:
<bvcaddons:ShippingCostControl id="ShippingCost1" runat="server"
CombineHandlingWithShipping="True" />
LocalizeToCountry (can be abbreviated to Localize) also takes a boolean value. The default value is true. When LocalizeToCountry is true, then the Shipping Cost Calculator will attempt to display labels and prompts in the language of the destination country. When LocalizeToCountry is false, the Shipping Cost Calculator will display labels and prompts of the current UI culture or in the neutral culture if the current UI culture resources do not exist. See Localization for more information about supplying a local resource file.
RateTextStringFormat is the pattern used to format each rate in the rate list. The default value is "{0} -{1:C}" which results in a rate listing similar to "By Item - $5.95". Each rate is formatted using the .NET String.Format method. Two arguments are passed in. The first is the name of the rate (i.e. "By Item"). The second is the cost of the rate. If CombineHandlingWithShipping="True", then the cost includes the handling fee.
To change the format of each rate listing to the pattern "Name (Cost)", add the highlighted text to the ShippingCostControl tag as shown:
<bvcaddons:ShippingCostControl id="ShippingCost1" runat="server"
RateTextStringFormat="{0} ({1:C})" />
As in the rest of BVC2004, themes are applied to the Shipping Cost Calculator to create a matching appearance. See CSS Styles for more information.
| See Also |
Copyright © 2005 by Structured Solutions