PHP / MySQL foreach not working correctly for me -


im rather new php / mysql , addon im trying fix on cs-cart software keeps failing , ive been trying hours hoping can me:

php in question:

$acid = $_request['id'];  $productsget = db_get_field("select cart ?:abandoned_cart user_id = ?i", $acid); fn_print_die($productsget); $products = unserialize($productsget);  $shippingcost = db_get_field("select shipping ?:abandoned_cart user_id = ?s", $acid); $tax = db_get_field("select tax ?:abandoned_cart user_id = ?s", $acid); $ordertotal = db_get_field("select order_total ?:abandoned_cart user_id = ?s", $acid); $email = db_get_field("select email ?:abandoned_cart user_id = ?s", $acid);  $sum=0; //echo $products; if (!empty($products)) {   foreach($products $product){     $text .='       <tr>         <td><a  href="http://'.$_server['server_name'].'?dispatch=products.view&product_id='.$product['product_id'].'"> <img title="" height="120" width="120" alt="" src="'.$product['main_pair']['detailed']['image_path'].'"></a></td>         <td><a href="#" style=" font-weight:bold; color:#333; font-size:13px; text-decoration:none;">'.$product['product'].'</a><a href="#">&nbsp;<i></i></a><div style=" font-weight:bold; color:#333; font-size:12px; margin-top:4px; text-decoration:none;"> code: <span>'.$product['product_code'].'<!--product_code_update_2512012004--></span> </div></td>         <td style=" text-align:center;"><span style=" font-weight:bold; color:#333; font-size:12px; margin-top:4px; text-decoration:none;">$</span><span style=" font-weight:bold; color:#333; font-size:12px; margin-top:4px; text-decoration:none;">'.$product['price'].'</span> </td>         <td><div style="display: inline-block;vertical-align: top;width: 56px;"><input type="text" disabled value="'.$product['amount'].'" size="3"  style="border:1px solid #c2c9d0; box-shadow:0 1px 3px rgba(0, 0, 0, 0.1) inset; border-radius:3px; float: left;height: 33px;text-align: center;width: 36px;"></div></td>         <td style="font-size:14px;  font-weight:bold; color:#333; text-align:center; font-size:13px; text-decoration:none;"><span>$</span><span stye=" color:#000;">'.$product['price']*$product['amount'].'</span> </td>       </tr>';     $sum =$sum+$product['price']*$product['amount'];   } } 

response fn_print_die($productget);

"a:1:{i:598710622;a:24:{s:10:\"product_id\";i:511;s:12:\"product_code\";s:4:\"3021\";s:7:\"product\";s:33:\"avatar lounger - wildberry deluxe\";s:6:\"amount\";i:1;s:15:\"product_options\";a:1:{i:365;s:3:\"731\";}s:5:\"price\";d:249;s:12:\"stored_price\";s:1:\"n\";s:9:\"main_pair\";a:5:{s:7:\"pair_id\";s:4:\"1027\";s:8:\"image_id\";s:1:\"0\";s:11:\"detailed_id\";s:4:\"2123\";s:8:\"position\";s:1:\"0\";s:8:\"detailed\";a:8:{s:10:\"image_path\";s:95:\"http://beanbags.ambientlounge.com/images/detailed/2/wildberry-deluxe-4_h85w-74.jpg?t=1401991929\";s:3:\"alt\";s:0:\"\";s:7:\"image_x\";s:4:\"1500\";s:7:\"image_y\";s:4:\"1500\";s:15:\"http_image_path\";s:95:\"http://beanbags.ambientlounge.com/images/detailed/2/wildberry-deluxe-4_h85w-74.jpg?t=1401991929\";s:16:\"https_image_path\";s:96:\"https://beanbags.ambientlounge.com/images/detailed/2/wildberry-deluxe-4_h85w-74.jpg?t=1401991929\";s:13:\"absolute_path\";s:90:\"/home/ambcom/public_html/staging/beanbags/images/detailed/2/wildberry-deluxe-4_h85w-74.jpg\";s:13:\"relative_path\";s:41:\"detailed/2/wildberry-deluxe-4_h85w-74.jpg\";}}s:5:\"extra\";a:2:{s:15:\"product_options\";a:1:{i:365;s:3:\"731\";}s:18:\"unlimited_download\";s:1:\"n\";}s:15:\"stored_discount\";s:1:\"n\";s:10:\"company_id\";s:1:\"1\";s:12:\"amount_total\";i:1;s:12:\"options_type\";s:1:\"p\";s:15:\"exceptions_type\";s:1:\"f\";s:15:\"modifiers_price\";d:0;s:6:\"is_edp\";s:1:\"n\";s:12:\"edp_shipping\";s:1:\"n\";s:8:\"discount\";i:0;s:10:\"promotions\";a:0:{}s:11:\"tax_summary\";a:3:{s:8:\"included\";d:22.6400000000000005684341886080801486968994140625;s:5:\"added\";i:0;s:5:\"total\";d:22.6400000000000005684341886080801486968994140625;}s:10:\"base_price\";d:249;s:12:\"category_ids\";a:1:{i:0;i:66;}s:13:\"display_price\";d:249;s:5:\"taxes\";a:1:{i:6;a:7:{s:9:\"rate_type\";s:1:\"p\";s:10:\"rate_value\";s:6:\"10.000\";s:18:\"price_includes_tax\";s:1:\"y\";s:9:\"regnumber\";s:11:\"60499021423\";s:8:\"priority\";i:0;s:12:\"tax_subtotal\";d:22.6400000000000005684341886080801486968994140625;s:11:\"description\";s:3:\"gst\";}}}}" 

as above function debug here whats in database field:

a:1:{i:598710622;a:24:{s:10:\"product_id\";i:511;s:12:\"product_code\";s:4:\"3021\";s:7:\"product\";s:33:\"avatar lounger - wildberry deluxe\";s:6:\"amount\";i:1;s:15:\"product_options\";a:1:{i:365;s:3:\"731\";}s:5:\"price\";d:249;s:12:\"stored_price\";s:1:\"n\";s:9:\"main_pair\";a:5:{s:7:\"pair_id\";s:4:\"1027\";s:8:\"image_id\";s:1:\"0\";s:11:\"detailed_id\";s:4:\"2123\";s:8:\"position\";s:1:\"0\";s:8:\"detailed\";a:8:{s:10:\"image_path\";s:95:\"http://beanbags.ambientlounge.com/images/detailed/2/wildberry-deluxe-4_h85w-74.jpg?t=1401991929\";s:3:\"alt\";s:0:\"\";s:7:\"image_x\";s:4:\"1500\";s:7:\"image_y\";s:4:\"1500\";s:15:\"http_image_path\";s:95:\"http://beanbags.ambientlounge.com/images/detailed/2/wildberry-deluxe-4_h85w-74.jpg?t=1401991929\";s:16:\"https_image_path\";s:96:\"https://beanbags.ambientlounge.com/images/detailed/2/wildberry-deluxe-4_h85w-74.jpg?t=1401991929\";s:13:\"absolute_path\";s:90:\"/home/ambcom/public_html/staging/beanbags/images/detailed/2/wildberry-deluxe-4_h85w-74.jpg\";s:13:\"relative_path\";s:41:\"detailed/2/wildberry-deluxe-4_h85w-74.jpg\";}}s:5:\"extra\";a:2:{s:15:\"product_options\";a:1:{i:365;s:3:\"731\";}s:18:\"unlimited_download\";s:1:\"n\";}s:15:\"stored_discount\";s:1:\"n\";s:10:\"company_id\";s:1:\"1\";s:12:\"amount_total\";i:1;s:12:\"options_type\";s:1:\"p\";s:15:\"exceptions_type\";s:1:\"f\";s:15:\"modifiers_price\";d:0;s:6:\"is_edp\";s:1:\"n\";s:12:\"edp_shipping\";s:1:\"n\";s:8:\"discount\";i:0;s:10:\"promotions\";a:0:{}s:11:\"tax_summary\";a:3:{s:8:\"included\";d:22.6400000000000005684341886080801486968994140625;s:5:\"added\";i:0;s:5:\"total\";d:22.6400000000000005684341886080801486968994140625;}s:10:\"base_price\";d:249;s:12:\"category_ids\";a:1:{i:0;i:66;}s:13:\"display_price\";d:249;s:5:\"taxes\";a:1:{i:6;a:7:{s:9:\"rate_type\";s:1:\"p\";s:10:\"rate_value\";s:6:\"10.000\";s:18:\"price_includes_tax\";s:1:\"y\";s:9:\"regnumber\";s:11:\"60499021423\";s:8:\"priority\";i:0;s:12:\"tax_subtotal\";d:22.6400000000000005684341886080801486968994140625;s:11:\"description\";s:3:\"gst\";}}}} 

php error in console:

fatal error: ob_get_clean() [<a href='ref.outcontrol'>ref.outcontrol</a>]: cannot use output buffering in output buffering display handlers in /home/ambcom/public_html/staging/beanbags/app/tygh/ajax.php on line 131

php error log:

[mon feb 08 01:44:59 2016] [error] [client 90.199.142.58] php fatal error: ob_get_clean() [ref.outcontrol]: cannot use output buffering in output buffering display handlers in /home/ambcom/public_html/staging/beanbags/app/tygh/ajax.php on line 131, referer: /admin.php?dispatch=cart.cart_list [mon feb 08 01:44:59 2016] [error] [client 90.199.142.58] php fatal error: unsupported operand types in /home/ambcom/public_html/staging/beanbags/app/tygh/database.php on line 632, referer: /admin.php?dispatch=cart.cart_list [mon feb 08 01:44:59 2016] [error] [client 90.199.142.58] php notice: unserialize() [function.unserialize]: error @ offset 23 of 2060 bytes in /home/ambcom/public_html/staging/beanbags/app/addons/abandoned_cart_extended/controllers/backend/ac.php on line 24, referer: /admin.php?dispatch=cart.cart_list

i think error in console , first 2 in log can ignore if im not mistaken, focus on

notice: unserialize() [function.unserialize]: error @ offset 23 of 2060 bytes in /home/ambcom/public_html/staging/beanbags/app/addons/abandoned_cart_extended/controllers/backend/ac.php on line 24, referer: /admin.php?dispatch=cart.cart_list

this line:

$products = unserialize($productsget); 

now seem pulling cart cart data query ok.... not liking @ unserialize part , loop.... im new php think done ok far need direction on possible.

the data returned query in database on column "cart" maybe php trying handle wrong? a:1 part...


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -