KrK Posted May 15, 2007 Share Posted May 15, 2007 Can someone help? Need to get the data from this: $cart only function i found sofar is just to show it : print_r($cart); the data inside $cart is: shoppingCart Object ( [contents] => Array ( [414] => Array ( [qty] => 1 ) [13] => Array ( [qty] => 1 ) [220] => Array ( [qty] => 2 ) [216] => Array ( [qty] => 1 ) [73] => Array ( [qty] => 1 ) ) [total] => 20465 [weight] => 0 [cartID] => 43224 [content_type] => ) Need to get the contents array and total , weight , cartID , content_type values out of there, so that i can use them in php functions, cose can't use $cart in allmost eany function. Server: PHP Version 5.2.1 System Windows NT USER-JQ7JTZE0T1 5.1 build 2600 Server API Apache 2.0 Handler Tryed to get around the problem and get the data from some other channle but can't find, please help.. Thanks to all ahead foreany help Quote Link to comment https://forums.phpfreaks.com/topic/51495-solved-need-help-heting-arrys-value-strings-from-object-to-work-on-php-functions/ Share on other sites More sharing options...
MadTechie Posted May 15, 2007 Share Posted May 15, 2007 what about echo $cart['total']; etc EDIT: or echo $cart->total; EDIT #2: we're need to see some code really! Quote Link to comment https://forums.phpfreaks.com/topic/51495-solved-need-help-heting-arrys-value-strings-from-object-to-work-on-php-functions/#findComment-253595 Share on other sites More sharing options...
KrK Posted May 15, 2007 Author Share Posted May 15, 2007 Too easy, it wont let me off thehook.. Fatal error: Cannot use object of type shoppingCart as array in C:\Program Files\xampp\htdocs\s\sale24\test.php on line 55 Some function that help to get the array and the values out somehow.. :\ maybe ? Quote Link to comment https://forums.phpfreaks.com/topic/51495-solved-need-help-heting-arrys-value-strings-from-object-to-work-on-php-functions/#findComment-253598 Share on other sites More sharing options...
MadTechie Posted May 15, 2007 Share Posted May 15, 2007 well i have no idea what your dealing with.. how is $cart set ? is it a class ? etc find the first point where $cart is used and post it please did you try echo $cart->total; ? Quote Link to comment https://forums.phpfreaks.com/topic/51495-solved-need-help-heting-arrys-value-strings-from-object-to-work-on-php-functions/#findComment-253606 Share on other sites More sharing options...
KrK Posted May 15, 2007 Author Share Posted May 15, 2007 echo $cart->total; prints 0 Tryed print_r($cart->contents); and got Array ( ) tryed to change some valuesup ahead, and i got 20465 , vorking in several now with the last echo $cart->total; u gave thnx Quote Link to comment https://forums.phpfreaks.com/topic/51495-solved-need-help-heting-arrys-value-strings-from-object-to-work-on-php-functions/#findComment-253627 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.