We’re currently waiting for access to the language.ini file and proper multi language support from BC. In the mean time we have to rely on 1) editing what labels we can through design mode, 2) deleting %%LNG.%% variables and replacing them with our own text or 3) using crude smart little hacks using jQuery.
So for this 5 minute masterclass, I’m going to show you how to change a status message in the cart page with jQuery.
One such status message appears when your customer submits a coupon code
to discount their order. Generally, BC notifies the customer that “The
coupon that you entered has been applied to your cart”. Fair enough, but
we might want to say something like “Thank you for taking advantage of
one of our awesome offers!”. This can be done quickly and easily with
one line of code.
To do this, simply open your cart.html template file from Design > Template Files and before the closing </body> tag, add the following code:
<script type="text/javascript"><br>
$("div.SuccessMessage").text($("div.SuccessMessage").text().replace("The
coupon that you entered has been applied to your cart.", "Thank you for
taking advantage of one of our awesome offers!"));<br>
</script>
<img title="Updated Status Message" src="http://www.flairconsultancy.com/wp-live/wp-content/uploads/2011/09/language.png" alt="Updated Status Message" width="570" height="300"><br>
And there we have it, a status message updated using jQuery. You can do
this with any text you previously thought impossible to edit. Just
change the selector (the <strong>$(“div.SuccessMessage”)</strong> part) to the appropriate class/id of the element you want to replace. Happy editing!