Phoca Cart Currencies

Phoca Cart - complex e-commerce extension
farisidrees
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 07 Jul 2020, 13:03

Phoca Cart Currencies

Post 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.

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48171
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Cart Currencies

Post 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
If you find Phoca extensions useful, please support the project
farisidrees
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 07 Jul 2020, 13:03

Re: Phoca Cart Currencies

Post by farisidrees »

Hi Jan,

Thanks for your support,

Could you please give me a hint where should I add that code? (File name, location,...)?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48171
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Cart Currencies

Post 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
If you find Phoca extensions useful, please support the project
farisidrees
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 07 Jul 2020, 13:03

Re: Phoca Cart Currencies

Post by farisidrees »

It's Working perfectly.

Thank you Jan
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48171
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Cart Currencies

Post by Jan »

OK
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48171
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Cart Currencies

Post by Jan »

If you find Phoca extensions useful, please support the project
Post Reply