[Skip to main content](#vessel-content)

#   How to access Currency variable in user cookie?

##

- **[mixsemi](/forum/user/19194-mixsemi "View mixsemi's Profile")**
- [![mixsemi's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/19194-mixsemi "View mixsemi's Profile") Topic Author
- [ Offline](/forum/user/19194-mixsemi)

Less More

- Posts: 16
- Thank you received: 0
-
-

13 years 5 months ago -  13 years 5 months ago [\#106563](#106563) by [mixsemi](/forum/user/19194-mixsemi "View mixsemi's Profile")  *[How to access Currency variable in user cookie?](/forum/2-general-talk-about-hikashop/83009-how-to-access-currency-variable-in-user-cookie#106563 "Hi,  I am trying to use Jumi to write some custom code and need to access the Currency ID on the customer's cookie.  Basically, I want to display a price list of a bunch of my products on one single page. Right now it is in USD, but I want to make it so that when the customer changes the currency to say EUR, all the prices on the price list change to EUR automatically.  I know how to write PHP code to access mysql data, but I don't know how to access the Currency ID number on the cookie.  Can someone please kindly let me know how I can access the cookie data? Assume that I am starting on a blank PHP script with nothing initialized (a blank Jumi page).  Thanks,  Robin")* was created by *[mixsemi](/forum/user/19194-mixsemi "View mixsemi's Profile")*

Hi,

I am trying to use Jumi to write some custom code and need to access the Currency ID on the customer's cookie.

Basically, I want to display a price list of a bunch of my products on one single page. Right now it is in USD, but I want to make it so that when the customer changes the currency to say EUR, all the prices on the price list change to EUR automatically.

I know how to write PHP code to access mysql data, but I don't know how to access the Currency ID number on the cookie.

Can someone please kindly let me know how I can access the cookie data? Assume that I am starting on a blank PHP script with nothing initialized (a blank Jumi page).

Thanks,

Robin

Last edit: 13 years 5 months ago by [mixsemi](/forum/user/19194-mixsemi "View mixsemi's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzgzMDA5LWhvdy10by1hY2Nlc3MtY3VycmVuY3ktdmFyaWFibGUtaW4tdXNlci1jb29raWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14279
-
-

13 years 5 months ago [\#106586](#106586) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to access Currency variable in user cookie?](/forum/2-general-talk-about-hikashop/83009-how-to-access-currency-variable-in-user-cookie#106586 "Hi,  I am trying to use Jumi to write some custom code and need to access the Currency ID on the customer's cookie.  Basically, I want to display a price list of a bunch of my products on one single page. Right now it is in USD, but I want to make it so that when the customer changes the currency to say EUR, all the prices on the price list change to EUR automatically.  I know how to write PHP code to access mysql data, but I don't know how to access the Currency ID number on the cookie.  Can someone please kindly let me know how I can access the cookie data? Assume that I am starting on a blank PHP script with nothing initialized (a blank Jumi page).  Thanks,  Robin")*

Hi,

The currency id is not stored in user cookies but in the user session.

If HikaShop is loaded, you can simply call the function hikashop_getCurrency() and that will give you back the current currency id.

Otherwise, you can use:
$app = JFactory::getApplication();
$main_currency = 2;
$currency_id = (int)$app-&gt;getUserState( 'com_hikashop.currency_id', $main_currency );

Note that there is already a currency switcher module installed automatically along with HikaShop.

The following user(s) said Thank You: [mixsemi](/forum/user/19194-mixsemi "View mixsemi's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzgzMDA5LWhvdy10by1hY2Nlc3MtY3VycmVuY3ktdmFyaWFibGUtaW4tdXNlci1jb29raWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[mixsemi](/forum/user/19194-mixsemi "View mixsemi's Profile")**
- [![mixsemi's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/19194-mixsemi "View mixsemi's Profile") Topic Author
- [ Offline](/forum/user/19194-mixsemi)

Less More

- Posts: 16
- Thank you received: 0
-
-

13 years 5 months ago [\#106656](#106656) by [mixsemi](/forum/user/19194-mixsemi "View mixsemi's Profile")  Replied by *[mixsemi](/forum/user/19194-mixsemi "View mixsemi's Profile")* on topic *[How to access Currency variable in user cookie?](/forum/2-general-talk-about-hikashop/83009-how-to-access-currency-variable-in-user-cookie#106656 "Hi,  I am trying to use Jumi to write some custom code and need to access the Currency ID on the customer's cookie.  Basically, I want to display a price list of a bunch of my products on one single page. Right now it is in USD, but I want to make it so that when the customer changes the currency to say EUR, all the prices on the price list change to EUR automatically.  I know how to write PHP code to access mysql data, but I don't know how to access the Currency ID number on the cookie.  Can someone please kindly let me know how I can access the cookie data? Assume that I am starting on a blank PHP script with nothing initialized (a blank Jumi page).  Thanks,  Robin")*

This worked! T H A N K Y O U !!!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzgzMDA5LWhvdy10by1hY2Nlc3MtY3VycmVuY3ktdmFyaWFibGUtaW4tdXNlci1jb29raWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.103 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
