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.
Phoca Cart Currencies
-
- Phoca Newbie
- Posts: 6
- Joined: 07 Jul 2020, 13:03
- Jan
- Phoca Hero
- Posts: 48227
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Cart Currencies
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:
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
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');
}
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 6
- Joined: 07 Jul 2020, 13:03
Re: Phoca Cart Currencies
Hi Jan,
Thanks for your support,
Could you please give me a hint where should I add that code? (File name, location,...)?
Thanks for your support,
Could you please give me a hint where should I add that code? (File name, location,...)?
- Jan
- Phoca Hero
- Posts: 48227
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Cart Currencies
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:
Important is, wherever you place the code, you should do a backup of this file because when upgrading, such modification can be lost.
Jan
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)
{
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 6
- Joined: 07 Jul 2020, 13:03
Re: Phoca Cart Currencies
It's Working perfectly.
Thank you Jan
Thank you Jan
- Jan
- Phoca Hero
- Posts: 48227
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
- Jan
- Phoca Hero
- Posts: 48227
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Cart Currencies
It can now be done with a plugin: https://github.com/PhocaCz/PhocaCartCur ... v4.0.0.zip
If you find Phoca extensions useful, please support the project