Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2022
    Location
    Chennai
    Posts
    26
    Plugin Contributions
    0

    help question Change Currency Automatically to a Specific Billing Country

    Dear Friends,

    We are new to Zen Cart and we are currently testing v1.5.7d [PHP Version: 8.0.19] at www.celextel.biz.

    Our Default Currency is USD. We would like to change the Currency automatically to INR when the Billing Country is India during Checkout Process.

    We have used the following Code for this purpose at checkout_payment.php file in osCommerce based website:
    Code:
    // Change Currency to INR for Billing Address in India
    	if($order->billing['country']['id'] == "99") {
    		$currency = 'INR';		
    	} 
    // Change Currency to INR for Billing Address in India
    But this code does not seem to work in Zen Cart.

    Please suggest us the code and file to be used for this purpose.

    Thanks,

    Lakshmanan
    Last edited by celextel108; 23 Sep 2022 at 05:19 PM.

  2. #2
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: Change Currency Automatically to a Specific Billing Country

    untested but try this in includes/modules/pages/checkout_payment/header_php.php

    // Change Currency to INR for Billing Address in India
    if($order->billing['country']['id'] == "99") {
    $_SESSION['currency'] = 'INR';
    }
    // Change Currency to INR for Billing Address in India
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  3. #3
    Join Date
    Sep 2022
    Location
    Chennai
    Posts
    26
    Plugin Contributions
    0

    Default Re: Change Currency Automatically to a Specific Billing Country

    Quote Originally Posted by torvista View Post
    untested but try this in includes/modules/pages/checkout_payment/header_php.php

    // Change Currency to INR for Billing Address in India
    if($order->billing['country']['id'] == "99") {
    $_SESSION['currency'] = 'INR';
    }
    // Change Currency to INR for Billing Address in India
    Thanks @torvista.

    The code suggested by you is working.

    We have added the code as follows in includes/modules/pages/checkout_payment/header_php.php:
    Code:
    $order = new order;
    
    /* bof celextel modification */
        // Change Currency to INR for Billing Address in India
    		if($order->billing['country']['id'] == "99") {
    			$_SESSION['currency'] = 'INR';
    		}
    	// Change Currency to INR for Billing Address in India
    /* eof celextel modification */
    
    // Load the selected shipping module(needed to calculate tax correctly)
    Thanks,

    Lakshmanan

  4. #4
    Join Date
    Sep 2022
    Location
    Chennai
    Posts
    26
    Plugin Contributions
    0

    Default Re: Change Currency Automatically to a Specific Billing Country

    We have modified the code as follows:
    Code:
    $order = new order;
    
    /* bof celextel modification */
        // Change Currency to INR for Billing Address in India
    		if($order->billing['country']['id'] == "99") {
    			$_SESSION['currency'] = 'INR';
    		} else {
    			$_SESSION['currency'] = 'USD';
    		}
    	// Change Currency to INR for Billing Address in India
    /* eof celextel modification */
    
    // Load the selected shipping module(needed to calculate tax correctly)

 

 

Similar Threads

  1. v139h How do I make changing language automatically change currency?
    By Enpeek in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 10 Mar 2012, 01:14 PM
  2. Replies: 6
    Last Post: 15 Nov 2011, 06:57 PM
  3. how to sync up when someone puts in their country a specific currency
    By carnygoat in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 1
    Last Post: 14 Jan 2011, 02:24 PM
  4. Shipping only to one country, but Billing from any country
    By mask2011 in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 21 Aug 2010, 07:29 AM
  5. setup zone/country automatically?
    By goldknight in forum General Questions
    Replies: 0
    Last Post: 23 Oct 2008, 09:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR