How can I get cart_id in session?

  • Posts: 3
  • Thank you received: 0
11 years 1 month ago #153879

I want to customize a checkout page.
I print_r($Session);
it shows
=======================================================================================================
Array ( [__default] => Array ( [session.counter] => 69 [session.timer.start] => 1398698205 [session.timer.last] => 1398699831 [session.timer.now] => 1398699833 [session.client.browser] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36 [registry] => JRegistry Object ( [data:protected] => stdClass Object ( [com_hikashop] => stdClass Object ( [zone_id] => 206 [ssl_redirect] => 0 [vote] => stdClass Object ( [list_limit] => 999 ) [cart_id] => 118 [shipping_method] => [shipping_id] => [shipping_data] => [cart_new] => 1 [payment_method] => [payment_id] => [payment_data] => [popup] => 0 [popup_cart_type] => cart ) ) ) [user] => JUser Object ( [isRoot:protected] => [id] => 0 [name] => [username] => => [password] => [password_clear] => [block] => [sendEmail] => 0 [registerDate] => [lastvisitDate] => [activation] => [params] => [groups] => Array ( [0] => 9 ) [guest] => 1 [lastResetTime] => [resetCount] => [_params:protected] => JRegistry Object ( [data:protected] => stdClass Object ( ) ) [_authGroups:protected] => Array ( [0] => 1 [1] => 9 ) [_authLevels:protected] => Array ( [0] => 1 [1] => 1 [2] => 5 ) [_authActions:protected] => [_errorMsg:protected] => [_errors:protected] => Array ( ) [aid] => 0 ) [session.token] => 12e05fcbfd2fc0023bc1cf0abc321034 ) [hikashop_viewed_products] => Array ( [33] => 33 ) ) ======================================================================================================= I found cart_id value is 118.I want to new a varible to get 118 and echo it. how Can I do?[email] => [password] => [password_clear] => [block] => [sendEmail] => 0 [registerDate] => [lastvisitDate] => [activation] => [params] => [groups] => Array ( [0] => 9 ) [guest] => 1 [lastResetTime] => [resetCount] => [_params:protected] => JRegistry Object ( [data:protected] => stdClass Object ( ) ) [_authGroups:protected] => Array ( [0] => 1 [1] => 9 ) [_authLevels:protected] => Array ( [0] => 1 [1] => 1 [2] => 5 ) [_authActions:protected] => [_errorMsg:protected] => [_errors:protected] => Array ( ) [aid] => 0 ) [session.token] => 12e05fcbfd2fc0023bc1cf0abc321034 ) [hikashop_viewed_products] => Array ( [33] => 33 ) )
=======================================================================================================

I found cart_id value is 118.I want to new a varible to get 118 and echo it.
how Can I do?

Last edit: 11 years 1 month ago by s1003933.

Please Log in or Create an account to join the conversation.

  • Posts: 83990
  • Thank you received: 13604
  • MODERATOR
11 years 1 month ago #153880

Like that:

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

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum