greg Posted March 12, 2006 Share Posted March 12, 2006 I use OScommerce, and the following code is the shopping cart content of a customer.What code should I need to convert this to normal view and display in a page.I really appreciate anyone's help.gregO:12:"shoppingcart":7:{s:8:"contents";a:1:{i:1024;a:2:{s:3:"qty";s:2: "72";s:11:"custom_data"; a:7:{s:10:"item_color";a:2:{s:10:"color_name";s:6:"Purple";s:10 :"color_code";s:7:"#912690";}s:7:"comment";s:0:"";s:12:"imprint_area";a:1:{i:3458;a:5:{s:7:"icolors";a:1:{i:0;s:14:"Purple:#a65692";}s:6:"colors";a:1:{s:6:"Purple";s:7:"#a65692";}s:5:"lines";a:1:{i:1;a:7:{s:4:"text";s:16:"SECOND LINE";s:9:"font_size";s:2:"10";s:11:"font_family";s:5:"Arial";s:4:"bold";s:1:"0";s:7:"italics";s:1:"0";s:5:"align";s:4:"left";s:10:"font_color";a:2:{s:10:"color_name";s:6:"Purple";s:10:"color_code";s:7:"#a65692";}}}s:4:"name";s:20:"Primary Imprint Area";s:5:"image";s:32 Quote Link to comment https://forums.phpfreaks.com/topic/4790-help-in-serializing-from-oscommerce/ Share on other sites More sharing options...
hitman6003 Posted March 13, 2006 Share Posted March 13, 2006 Well, to start, please edit your post and remove that incredibly long string from it so that we dont' have to scroll a mile to the right to view your post.Use serialize to change your string back into an array, then you can display it back however you want. Quote Link to comment https://forums.phpfreaks.com/topic/4790-help-in-serializing-from-oscommerce/#findComment-16843 Share on other sites More sharing options...
greg Posted March 13, 2006 Author Share Posted March 13, 2006 Hello hitman6003,Oh my god! - Sorry for that long walk, it wasn't my intention.I appreciate your help, but can you elaborate a little bid for me please. The point is that I don't go so deep in php, so in other words, I'm starting. I need help please.thanks Quote Link to comment https://forums.phpfreaks.com/topic/4790-help-in-serializing-from-oscommerce/#findComment-16847 Share on other sites More sharing options...
hitman6003 Posted March 13, 2006 Share Posted March 13, 2006 That string is a representation of an array. It's obtained by using the function serialize (http://www.php.net/serialize) on an array. In order to return it to it's original form, which is a very usable array, you will want to use unserialize (http://www.php.net/unserialize).From there, you can loop through it and produce a table, or select out only certain elements for a table, or what ever you want to do with it. Quote Link to comment https://forums.phpfreaks.com/topic/4790-help-in-serializing-from-oscommerce/#findComment-16848 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.