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

#   How can I get cart\_id in session?

##

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

Less More

- Posts: 3
- Thank you received: 0
-
-

12 years 7 months ago -  12 years 7 months ago [\#153879](#153879) by [s1003933](/forum/user/32392-s1003933 "View s1003933's Profile")  *[How can I get cart\_id in session?](/forum/27-checkout/867771-how-can-i-get-cart-id-in-session#153879 "I want to customize a checkout page. I print&#95;r($Session); it shows ======================================================================================================= Array ( &#91;&#95;&#95;default&#93; =&gt; Array ( &#91;session.counter&#93; =&gt; 69 &#91;session.timer.start&#93; =&gt; 1398698205 &#91;session.timer.last&#93; =&gt; 1398699831 &#91;session.timer.now&#93; =&gt; 1398699833 &#91;session.client.browser&#93; =&gt; Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 &#91;registry&#93; =&gt; JRegistry Object ( &#91;data:protected&#93; =&gt; stdClass Object ( &#91;com&#95;hikashop&#93; =&gt; stdClass Object ( &#91;zone&#95;id&#93; =&gt; 206 &#91;ssl&#95;redirect&#93; =&gt; 0 &#91;vote&#93; =&gt; stdClass Object ( &#91;list&#95;limit&#93; =&gt; 999 )&#91;shipping&#95;method&#93; =&gt; &#91;shipping&#95;id&#93; =&gt; &#91;shipping&#95;data&#93; =&gt; &#91;cart&#95;new&#93; =&gt; 1 &#91;payment&#95;method&#93; =&gt; &#91;payment&#95;id&#93; =&gt; &#91;payment&#95;data&#93; =&gt; &#91;popup&#93; =&gt; 0 &#91;popup&#95;cart&#95;type&#93; =&gt; cart ) ) ) &#91;user&#93; =&gt; JUser Object ( &#91;isRoot:protected&#93; =&gt; &#91;id&#93; =&gt; 0 &#91;name&#93; =&gt; &#91;username&#93; =&gt;  =&gt; &#91;password&#93; =&gt; &#91;password&#95;clear&#93; =&gt; &#91;block&#93; =&gt; &#91;sendEmail&#93; =&gt; 0 &#91;registerDate&#93; =&gt; &#91;lastvisitDate&#93; =&gt; &#91;activation&#93; =&gt; &#91;params&#93; =&gt; &#91;groups&#93; =&gt; Array ( &#91;0&#93; =&gt; 9 ) &#91;guest&#93; =&gt; 1 &#91;lastResetTime&#93; =&gt; &#91;resetCount&#93; =&gt; &#91;&#95;params:protected&#93; =&gt; JRegistry Object ( &#91;data:protected&#93; =&gt; stdClass Object ( ) ) &#91;&#95;authGroups:protected&#93; =&gt; Array ( &#91;0&#93; =&gt; 1 &#91;1&#93; =&gt; 9 ) &#91;&#95;authLevels:protected&#93; =&gt; Array ( &#91;0&#93; =&gt; 1 &#91;1&#93; =&gt; 1 &#91;2&#93; =&gt; 5 ) &#91;&#95;authActions:protected&#93; =&gt; &#91;&#95;errorMsg:protected&#93; =&gt; &#91;&#95;errors:protected&#93; =&gt; Array ( ) &#91;aid&#93; =&gt; 0 ) &#91;session.token&#93; =&gt; 12e05fcbfd2fc0023bc1cf0abc321034 ) &#91;hikashop&#95;viewed&#95;products&#93; =&gt; Array ( &#91;33&#93; =&gt; 33 ) ) =======================================================================================================  I found cart&#95;id value is 118.I want to new a varible to get 118 and echo it. how Can I do?")* was created by *[s1003933](/forum/user/32392-s1003933 "View s1003933's Profile")*

I want to customize a checkout page.
I print_r($Session);
it shows
=======================================================================================================
Array ( [__default] =&gt; Array ( [session.counter] =&gt; 69 [session.timer.start] =&gt; 1398698205 [session.timer.last] =&gt; 1398699831 [session.timer.now] =&gt; 1398699833 [session.client.browser] =&gt; Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 [registry] =&gt; JRegistry Object ( [data:protected] =&gt; stdClass Object ( [com_hikashop] =&gt; stdClass Object ( [zone_id] =&gt; 206 [ssl_redirect] =&gt; 0 [vote] =&gt; stdClass Object ( [list_limit] =&gt; 999 ) \[cart\_id\] =&gt; 118 [shipping_method] =&gt; [shipping_id] =&gt; [shipping_data] =&gt; [cart_new] =&gt; 1 [payment_method] =&gt; [payment_id] =&gt; [payment_data] =&gt; [popup] =&gt; 0 [popup_cart_type] =&gt; cart ) ) ) [user] =&gt; JUser Object ( [isRoot:protected] =&gt; [id] =&gt; 0 [name] =&gt; [username] =&gt;

Last edit: 12 years 7 months ago by [s1003933](/forum/user/32392-s1003933 "View s1003933's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2Nzc3MS1ob3ctY2FuLWktZ2V0LWNhcnQtaWQtaW4tc2Vzc2lvbj90bXBsPW1hcmtkb3du) 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: 86587
- Thank you received: 14326
-
-

12 years 6 months ago [\#153880](#153880) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How can I get cart\_id in session?](/forum/27-checkout/867771-how-can-i-get-cart-id-in-session#153880 "I want to customize a checkout page. I print&#95;r($Session); it shows ======================================================================================================= Array ( &#91;&#95;&#95;default&#93; =&gt; Array ( &#91;session.counter&#93; =&gt; 69 &#91;session.timer.start&#93; =&gt; 1398698205 &#91;session.timer.last&#93; =&gt; 1398699831 &#91;session.timer.now&#93; =&gt; 1398699833 &#91;session.client.browser&#93; =&gt; Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 &#91;registry&#93; =&gt; JRegistry Object ( &#91;data:protected&#93; =&gt; stdClass Object ( &#91;com&#95;hikashop&#93; =&gt; stdClass Object ( &#91;zone&#95;id&#93; =&gt; 206 &#91;ssl&#95;redirect&#93; =&gt; 0 &#91;vote&#93; =&gt; stdClass Object ( &#91;list&#95;limit&#93; =&gt; 999 )&#91;shipping&#95;method&#93; =&gt; &#91;shipping&#95;id&#93; =&gt; &#91;shipping&#95;data&#93; =&gt; &#91;cart&#95;new&#93; =&gt; 1 &#91;payment&#95;method&#93; =&gt; &#91;payment&#95;id&#93; =&gt; &#91;payment&#95;data&#93; =&gt; &#91;popup&#93; =&gt; 0 &#91;popup&#95;cart&#95;type&#93; =&gt; cart ) ) ) &#91;user&#93; =&gt; JUser Object ( &#91;isRoot:protected&#93; =&gt; &#91;id&#93; =&gt; 0 &#91;name&#93; =&gt; &#91;username&#93; =&gt;  =&gt; &#91;password&#93; =&gt; &#91;password&#95;clear&#93; =&gt; &#91;block&#93; =&gt; &#91;sendEmail&#93; =&gt; 0 &#91;registerDate&#93; =&gt; &#91;lastvisitDate&#93; =&gt; &#91;activation&#93; =&gt; &#91;params&#93; =&gt; &#91;groups&#93; =&gt; Array ( &#91;0&#93; =&gt; 9 ) &#91;guest&#93; =&gt; 1 &#91;lastResetTime&#93; =&gt; &#91;resetCount&#93; =&gt; &#91;&#95;params:protected&#93; =&gt; JRegistry Object ( &#91;data:protected&#93; =&gt; stdClass Object ( ) ) &#91;&#95;authGroups:protected&#93; =&gt; Array ( &#91;0&#93; =&gt; 1 &#91;1&#93; =&gt; 9 ) &#91;&#95;authLevels:protected&#93; =&gt; Array ( &#91;0&#93; =&gt; 1 &#91;1&#93; =&gt; 1 &#91;2&#93; =&gt; 5 ) &#91;&#95;authActions:protected&#93; =&gt; &#91;&#95;errorMsg:protected&#93; =&gt; &#91;&#95;errors:protected&#93; =&gt; Array ( ) &#91;aid&#93; =&gt; 0 ) &#91;session.token&#93; =&gt; 12e05fcbfd2fc0023bc1cf0abc321034 ) &#91;hikashop&#95;viewed&#95;products&#93; =&gt; Array ( &#91;33&#93; =&gt; 33 ) ) =======================================================================================================  I found cart&#95;id value is 118.I want to new a varible to get 118 and echo it. how Can I do?")*

Like that: Code:

$app = JFactory::getApplication(); $cart_id = $app-&gt;getUserState( HIKASHOP_COMPONENT.'.cart_id', 0, 'int' ); echo $cart_id;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2Nzc3MS1ob3ctY2FuLWktZ2V0LWNhcnQtaWQtaW4tc2Vzc2lvbj90bXBsPW1hcmtkb3du) 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.045 seconds

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