Simple javascript to add rupees symbol insted of Rs in Ubercart

Problem: To display new Rupee symbol instead of Rs in web e-commerce projects

 

Indian govt. recently launched a new symbol for Rupee (INR symbol). You can find a tutorial on how to type the Indian Rupee Symbol without changing your keyboard while sticking to Unicode standard  here , but in my example I use simple java script to display the symbol.

The below example will replace the "Rs" notation of rupees into the new symbol in Ubercart, Drupal's module for e-commerce. Below example will use the Jquery to implement the above functionality.

$(document).ready(function() {
$('span.uc-price').each(function(index) {
    $(this).html($(this).text().replace("Rs", '<img src="/finaltouch/sites/default/files/INR.png">'));
  });

});

Here '.uc-price' is the default class used by the Ubercart to show the price format, one can replace the class with its. 

Dear Friend Can you guide me

Dear Friend Can you guide me how can I change Rs. to new symbol in opencart.

Hello, Just wanted to

Hello, Just wanted to say that i really like your site. i found it at Google. Thanks.

Hi, Nice of you to have

Hi, Nice of you to have written on this. I'm trying to incorporate this into a new site I'm building however I do not see the change. I've tried changing the image location and also putting it in the same folder as the script. Anything i need to check for? Cheers, Prakash

This is a vary nice example

This is a vary nice example and also will remain very useful to me. Thnx

Can you explain bit more

Can you explain bit more clearly? How to use this in ubert cart ? I want to use this in drupal view for fetching sell price and diplay rs and webrupee symbol. I could not get through it.

In Drupal 6, if you want to

In Drupal 6, if you want to add a javascript file you just need to add your .js file to the theme's .info file. explained below.

Example .info file:

name = My theme
description = Theme developed by me.
core = 6.x
engine = phptemplate
version = 6.x-1.0
;
scripts[] = my_file.js

In this javascript file you need to add js code mentioned above. Please take care that you define the correct path of your INR image file.

One more thing to check is the "Rs" symbol, make sure that you have same symbol in your admin panel as the above code usese ("Rs") not ("RS") or ("RS.") etc.    

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.