Customizing the E-Junkie Shopping Cart: Translation

Following up on my post on how to fully customize the E-Junkie cart visually, this post describes how to translate the E-Junkie shopping cart.

The instructions are adapted from the E-Junkie "documentation", which you can find here: Customizing E-junkie Shopping Cart.

Example Translation

This post describes how to translate the E-Junkie cart, the example translated it into Chinese. Click on the image below to launch the demo.

E-Junkie Cart Translated to Chinese

The Process

As with most of the techniques described in the previous post, the translation is accomplished with JavaScript. Two functions are necessary, and both must be included before the E-Junkie cart script.

1
2
3
4
5
<script type="text/javascript">
  function EJEJC_config() {  }
  function EJEJC_shown() {  }
</script>
<script src='http://www.e-junkie.com/ecom/box.js' type='text/javascript'></script>

The first function, EJEJC_config is where shopping cart configuration options may be set. The second function, EJEJS_shown is called just after the cart is shown. This is where the translation is performed.

For translation, the only required option is EJEJC_POSTCALL. Set this to true. Use the following config function to enable the translation:

function EJEJC_config() {
  EJEJC_POSTCALL = true; 
}

Include the following function below the config, swapping the English names for those of your language. Note that it is not necessary to translate everything, just delete the lines for content you dont' want to translate.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function EJEJC_shown() {
  var $ = jQuery;
 
  $('#country1').attr('innerHTML', 'Ship to Country');
  $('#state1').attr('innerHTML', 'ZIP/Postal Code');
  $('#state2').attr('innerHTML', 'Update Cart after entering');
  $('#dscnt_cd').attr('innerHTML', 'Discount Code');
  $('#discount2').attr('innerHTML', 'Update Cart after entering');
  $('#btnContShop').attr('value', 'Continue Shopping');
  $('#btnUpdtCart').attr('value', 'Update Cart');
  $('#EJEJC_closeWindowButton').attr('innerHTML', '<b>Close</b>');
  // Add custom text or HTML next to checkout buttons in the cart:
  $('#tdPmnt').attr('innerHTML', 'Any <b>HTML</b> you want to show');
  // Add custom text or HTML below checkout buttons in the cart:
  $('#tdSell').attr('innerHTML',  'Any <b>HTML</b> you want to show');
 
  // The table headers  
  var tds = $('#ejejctable tr:first td');
  $(tds.get(0)).html('<b>No.</b>');
  $(tds.get(1)).html('<b>Item</b>');
  $(tds.get(2)).html('<b>Remove</b>');
  $(tds.get(3)).html('<b>Quantity</b>');
  $(tds.get(4)).html('<b>Amount (USD)</b>');
  $('#ejejctable td:contains('Total:')').html('Total:</b>');
}

This covers translating the E-Junkie cart. For more translation tips, be sure to checkout Customizing the E-Junkie Shopping Cart: CSS.

Comments (1) | Trackback