Page 1 of 1

Phoca Cart Currencies

Posted: 07 Jul 2020, 13:51
by farisidrees
Hi,

I managed phoca cart to have 2 currencies, one of them is the default with exch. rate of 1, and the other is the local currency which has X rate.

I want to use the second (Local) currency as default for visitors when they access my store, and I prefer they don't see real default currency which is used only for me when I add product's price..

Any help would be appreciated.

Re: Phoca Cart Currencies

Posted: 08 Jul 2020, 14:04
by Jan
Hi, as default, default currency is set. To display Phoca Cart in another currency as default, it needs to be customized directly in the code:

Code: Select all

$session = JFactory::getSession();
$id = $session->get('currency', 0, 'phocaCart');

// if there is no currency set, don't set the default by my own specific
if ((int)$id < 1) {
   $id = 2;// my own currency
   $session->set('currency', (int)$id, 'phocaCart');
}
This is setting of session, so it can be set e.g. in your template, etc. There is no need to set it in soem Phoca Cart code.

Jan

Re: Phoca Cart Currencies

Posted: 11 Jul 2020, 10:43
by farisidrees
Hi Jan,

Thanks for your support,

Could you please give me a hint where should I add that code? (File name, location,...)?

Re: Phoca Cart Currencies

Posted: 11 Jul 2020, 12:37
by Jan
Hi, session is managed by Joomla! CMS, so you can include it everywhere in Joomla!. I would suggest, you will add it to your template index.php

root /templates/your_template/index.php

or e.g. to Phoca Cart part, to controller:

components\com_phocacart\controller.php


below:

Code: Select all

public function display($cachable = false, $urlparams = false)
	{
Important is, wherever you place the code, you should do a backup of this file because when upgrading, such modification can be lost.

Jan

Re: Phoca Cart Currencies

Posted: 12 Jul 2020, 10:50
by farisidrees
It's Working perfectly.

Thank you Jan

Re: Phoca Cart Currencies

Posted: 15 Jul 2020, 15:13
by Jan
OK

Re: Phoca Cart Currencies

Posted: 06 Jun 2023, 14:56
by Jan