shaman Posted July 13, 2009 Report Share Posted July 13, 2009 Hi first i would like to say the videos are great, i have downloaded the php shopping cart and it works great,but i want to add more items to the site page, i added more items to the store.xml file but when i open the site up on my localhost the items just keep going in the same row has the first one's, what i am tring to do is have 3 items on the top row,which is how is,and when i add more items i would like it to start a new row. If anybody can help me i would be very greatfull. Quote Link to comment Share on other sites More sharing options...
Korken Posted July 13, 2009 Report Share Posted July 13, 2009 (edited) Add a counter, and when you reach 3 print " Hope it helps! //Emil Edit: Example, somthing like this: $i = 0; echo ""; foreach (get_shopping_cart() as $prod) { echo "$prod"; if ($i >= 2) { echo ""; $i = 0; } else i++; } echo ""; Edited July 13, 2009 by Korken Quote Link to comment Share on other sites More sharing options...
administrator Posted July 13, 2009 Report Share Posted July 13, 2009 Just in case anyone is looking, you can find the PHP shopping cart videos on www.killerphp.com. Stefan Quote Link to comment Share on other sites More sharing options...
shaman Posted July 13, 2009 Author Report Share Posted July 13, 2009 Hi Korken thanks for your help but still did not work i hope this code will help you help me,thanks function render_products_from_xml() { $output = " foreach (get_xml_catalog() as $product) { $output .= " $product->title $product->description ?$product->price add to cart "; } $output .= ""; return $output; } Quote Link to comment Share on other sites More sharing options...
Korken Posted July 13, 2009 Report Share Posted July 13, 2009 Hmm, something like this should probably work: >function render_products_from_xml() { $output = "</pre> <table> $product->title $product->description ?$product->price add to cart </table>";<br><br> return $output Quote Link to comment Share on other sites More sharing options...
shaman Posted July 14, 2009 Author Report Share Posted July 14, 2009 Hi Korken that works great thanks very much. kind regards Shaman. Quote Link to comment 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.
Note: Your post will require moderator approval before it will be visible.