Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How to force a secondary currency as default ? Rate Topic   - - - - -

 
  • shikhar
  • Senior Member
  • Members
  • Join Date: 09-Oct 11
  • 156 posts

Posted 13 March 2012 - 01:13 AM #1

I want to force my secondary currency as default on the store.

Primary currency = USD
Secondary currency = INR (I want to show only this on store by default)

I have added the following code to config.local.php but it doesn't work any clues ?


if(empty($_GET['currency']) || ($_GET['currency']!='KD')){
    $_GET['currency'] = 'KD' ;
}

Cs-cart tips at shikhar.me

 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3839 posts

Posted 13 March 2012 - 10:06 AM #2

Administration->Currencies->Drag your default to the top of the list.

 
  • shikhar
  • Senior Member
  • Members
  • Join Date: 09-Oct 11
  • 156 posts

Posted 13 March 2012 - 12:16 PM #3

Its already at the top, but its not primary. I don't think order matters.
Cs-cart tips at shikhar.me

 
  • johnbol1
  • Never Re
  • Members
  • Join Date: 23-Feb 10
  • 4655 posts

Posted 13 March 2012 - 02:08 PM #4

isnt there a check box to set primary currency in edit?

John

Custom printed hi visibility clothing sale the UK's online hivis safety shop
v4.5.2


 
  • shikhar
  • Senior Member
  • Members
  • Join Date: 09-Oct 11
  • 156 posts

Posted 13 March 2012 - 08:31 PM #5

I don't want to change my primary currency, I just want to force or make default the secondary currency on the store front.
Cs-cart tips at shikhar.me

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11384 posts

Posted 14 March 2012 - 05:09 AM #6

Add this code (substituting the currency code for <currency_code> in a addons/my_changes/controllers/customer/init.post.php file
<?php
if( !defined('AREA') ) die('Access denied');
if( CART_SECONDARY_CURRENCY != '<currency_code>')
  fn_redirect(INDEX_SCRIPT."?currency=<currency_code>");
?>

If the secondary currency is not set to what you want this will cause it to be set to it. Note that the user's choice of currency is stored ina a cookie so it should be reset every time that user comes to your store.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • shikhar
  • Senior Member
  • Members
  • Join Date: 09-Oct 11
  • 156 posts

Posted 14 March 2012 - 08:17 AM #7

thanks tbirnseth, but why is my code not working ? can't I simply set currency get var instead of redirecting ?
Cs-cart tips at shikhar.me

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11384 posts

Posted 14 March 2012 - 06:37 PM #8

Your code requires currency to be passed for every page load.
The redirect happens once per user session.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • shikhar
  • Senior Member
  • Members
  • Join Date: 09-Oct 11
  • 156 posts

Posted 14 March 2012 - 07:39 PM #9

Thank tbirnseth, you solution works like charm !!
Cs-cart tips at shikhar.me