//, Tools and Tips/CubeCart 3.0 Currency and Shipping Solutions

CubeCart 3.0 Currency and Shipping Solutions

Currency Updating the Easy Way

It is thus fortunate that there exists a CubeCart module for updating all of your FX rates, with a single click. You won’t have to waste any time checking the latest rates on the Web, and manually setting those values in your CubeCart site.

To get started, visit the Automatic Currency Updater page

Download and install the Automatic Currency Updater, which consists of a single PHP script, UpDateXchange.php. Create a new directory in CubeCart’s admin/ directory, named UpDateXchange. Put UpDateXchange.php in that new directory.

In your copy of UpDateXchange.php, set $udx_defaultcurrency to the three-letter currency code for the default currency of the CubeCart store. For instance, American sites would use “USD”. Also, uncomment the value of $udx_ratesfrom corresponding to whatever online source you want to use for FX rates. For instance, I chose “finance.yahoo.com”.

In the file admin/includes/navigation.inc.php, below the currency.php line, insert the following code:

    <li>
		<a <?php if(permission("settings","write")==TRUE){ ?>
		href="<?php echo $GLOBALS['rootRel']; ?>admin/UpDateXchange/UpDateXchange.php"
		class="txtLink"<?php }else{ echo $link401; } ?>>Update Xchange rates</a>
	</li>

Once you have done all of the above steps, then in the CubeCart admin area, under the “Store Config” menu, you should see a new menu item, “Update Xchange rates”.

When you click on that link, the module queries your chosen FX rate provider, and sets all of the values within CubeCart.

Afterwards, all of your foreign currency rates should be up-to-date, as seen in the screenshot below.

Further Reading

There is limited documentation for the Automatic Currency Updater offered on the Web site listed earlier, and even less in the PHP script itself. But that should not pose a problem, because installation and use of the module is relatively straightforward, with minor customization needed – as explained above.

However, CubeCartForums.org has a discussion of this module. Note that CubeCartForums.org is not affiliated with Devellion Limited (the developer and vendor of CubeCart itself), but instead Inspired Solutions. The site hosts several useful forums, for two different versions of CubeCart, including links to free and commercial CubeCart modules.

Shipping by Subtotal

By default, CubeCart has built-in support for ten different shipping methods that you can make available to your site’s customers: per category, Royal Mail, by weight, by price, free shipping, by percent, flat rate, per item, UPS, and USPS. However, many online sellers wish to charge fixed rates for various subtotal ranges. We will learn how you could do that. Our first example will be the simplest: We will charge each US-based customer a fixed shipping rate of $60, and each non-US customer a rate of $25 (in conjunction with requiring that they provide their own FedEx, UPS, or DHL account number).

Firstly, visit the Shipping by Subtotal page

Download and unzip the archive file, which contains two directories, named “admin” and “modules”, and one file, named ReadMe.txt. Extract the two directories into your CubeCart root directory. Doing this adds the following two files to your CubeCart installation: admin\modules\shipping\By_Subtotal\index.php and modules\shipping\By_Subtotal\calc.php.

It also adds a new option in Modules > Shipping, “By Subtotal”. By default, the “Free Shipping” method is the only one enabled.

Disable “Free Shipping” by clicking its “Configure” link and setting “Status” to “Disabled”.

Enable “By Subtotal” by clicking its “Configure” link.

Set “Status” to “Enabled”, and click the “Edit Config” button. Then set “Use Zones” to “Yes”, and “Tax Class” to “Tax Exempt”. That latter setting is needed, otherwise the flat shipping rate is increased by the tax rate, which most merchants would not want.

Continuing with our example of charging US customers a subtotal rate different from that for non-US customers, set the “Zone 1 Countries:” to US, and the “Zone 1 Shiping [sic] Rates:” to 0:60, which means the shipping charge will be $60 regardless of the invoice subtotal. (The term “shipping” is misspelled in four places on the module’s page.) Then set the “Zone 2 Countries:” to the following list:
AD,AE,AF,AG,AI,AL,AM,AN,AO,AQ,AR,AS,AT,AU,AW,AZ,BA,BB,BD,BE,BF,
BG,BH,BI,BJ,BM,BN,BO,BR,BS,BT,BV,BW,BY,BZ,CA,CC,CD,CF,CG,CH,CI,
CK,CL,CM,CN,CO,CR,CS,CU,CV,CX,CY,CZ,DE,DJ,DK,DM,DO,DZ,EC,EE,
EG,EH,ER,ES,ET,FI,FJ,FK,FM,FO,FR,GA,GB,GD,GE,GF,GH,GI,GL,GM,GN,
GP,GQ,GR,GS,GT,GU,GW,GY,HK,HM,HN,HR,HT,HU,ID,IE,IL,IN,IO,IQ,IR,
IS,IT,JM,JO,JP,KE,KG,KH,KI,KM,KN,KP,KR,KW,KY,KZ,LA,LB,LC,LI,LK,
LR,LS,LT,LU,LV,LY,MA,MC,MD,MG,MH,MK,ML,MM,MN,MO,MP,MQ,MR,
MS,MT,MU,MV,MW,MX,MY,MZ,NA,NC,NE,NF,NG,NI,NL,NO,NP,NR,
NU,NZ,OM,PA,PE,PF,PG,PH,PK,PL,PM,PN,PR,PS,PT,PW,PY,QA,RE,RO,
RU,RW, SA,SB,SC,SD,SE,SG,SH,SI,SJ,SK,SL,SM,SN,SO,SR,ST,SV,SY,
SZ,TC,TD,TF,TG,TH,TJ,TK,TL,TM,TN,TO,TR,TT,TV,TW,TZ,UA,UG,UM,
UY,UZ,VA,VC,VE,VG,VI,VN,VU, WF,WS,YE,YT,ZA,ZM,ZW.

Then set “Zone 2 Shiping [sic] Rates:” to 0:25. Lastly, again click the “Edit Config” button.

You are all finished. Now your CubeCart store will automatically charge the correct shipping fee depending upon the location of the customer.

Charging different shipping costs for different ranges of subtotals, is just as easy. For instance, if you want to charge US customers $10 for any order up to $200, and charge $15 for anything up to $500, then you would set the Zone 1 shipping rates to “200:10,500:15”.

There may be other modules out there that can give you the functionality described above, but these two may be the only ones available, and are certainly the most popular.

Currency Updating the Hard Way

One of the advantages of using CubeCart for building an e-commerce site, is that it has built-in support for multiple currencies — eleven in all: Australian dollars, British pounds, Canadian dollars, Chinese yuan, euros, Japanese yen, Mexican peso, Russian rubles, South African rand, Swiss francs, and US dollars. This greatly facilitates the sale of products in all countries that use these currencies. Customers are not restricted to US dollars and euros, as with some shopping carts.

The disadvantage of using this feature — proportional to how many currencies you make available — is having to manually update the foreign exchange (FX) rates, which are fluctuating continuously throughout the day, as foreign-currency trading buffets the quoted rates among each pair of currencies.

This is especially true if the products for sale are high ticket items, in which case your client can incur daily monetary losses if particular FX rates move against your client, and customers are able to purchase valuable items for less than a fair price. But the more frequently that you or your client try to keep the exchange rates up to date in CubeCart, the more time will be lost doing this tedious chore.

Introduction

In the realm of storefront solutions, there are both proprietary and open source alternatives, with the latter category receiving greater interest from businesspeople and software developers, just as we are seeing in other application areas. Sadly, the quality of the open source alternatives is quite uneven, and generally below that of the proprietary ones. That is not say that they are far behind in functionality. In fact, from the perspective of the typical businessperson who just wants to set up their online store as easily as possible with the essential capabilities, some of the open source storefronts can be quite impressive. But for developers who are tasked with maintaining, modifying, and truly understanding the workings of these systems, the poor quality of the code can be shocking. This applies to some of the best-known open-source systems.

Fortunately, there are a handful of open source storefronts/shopping carts that provide all of the basic functionality needed by the business owner to begin selling on the Web, with code quality and rational organization that make it possible for developers to implement and change them as needed, without too much pain. This also makes it easier for developers to create their own modules and themes, which one can think of as prepackaged functionality and site styling, respectively. Among Web developers creating online stores, CubeCart is a popular solution.

In this tutorial, we will learn how to set up some critical functionality in an online store using CubeCart. In particular, we will learn how, using third-party modules, to automate the process of updating currency rates, and how to charge shipping costs by subtotal — both being functionality that is valuable to CubeCart administrators and customers alike. This tutorial assumes that you have a working CubeCart 3.0 installation, and that you feel comfortable modifying an installation as a site administrator.

As always, first back-up your CubeCart files and database before making any changes. While none of the changes delineated in this tutorial are risky, there is always the chance for inadvertently modifying a key component of CubeCart, and rendering your site partially or wholly unusable.

2017-08-16T12:56:27+00:00 April 4th, 2010|General, Tools and Tips|0 Comments

About the Author:

Michael J. Ross is a web developer, writer, and freelance editor.

Leave A Comment