Peper Posted January 30, 2020 Posted January 30, 2020 This small things that pulling my hair Please can someone help with this $bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM products p LEFT JOIN products_bundles pb ON (pb.bundle_id=p.products_id) LEFT JOIN products_description pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = '1'"); while ($bundle_info = tep_db_fetch_array($bundle_query)) { if (tep_not_null($bundle_info)) { $bundle_info = $bundleContents; $bundleContents = '<br /><em style="font-size:12px;"> ' . $bundle['subproduct_qty'] . ' x ' . $bundle['products_name'] . '</em>'; } else { $bundleContents = ' '; } } and then later to echo $bundleContents So if contents is in bundle echo this, else echo nothing. I tried many ways to do this but not close. Want to use this in the email order confirmation mail to display the bundle purchased Getting the Phoenix off the ground
ruden Posted January 30, 2020 Posted January 30, 2020 $bundleContents = ''; $bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM products p LEFT JOIN products_bundles pb ON (pb.bundle_id=p.products_id) LEFT JOIN products_description pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = '1'"); while ($bundle_info = tep_db_fetch_array($bundle_query)) { $bundleContents .= '<br /><em style="font-size:12px;"> ' . $bundle_info['subproduct_qty'] . ' x ' . $bundle_info['products_name'] . '</em>'; }
♥ecartz Posted January 30, 2020 Posted January 30, 2020 $seen_bundles = []; $bundleContents = ''; $bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM products p INNER JOIN products_bundles pb ON (pb.bundle_id=p.products_id) INNER JOIN products_description pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = 1"); while ($bundle_info = tep_db_fetch_array($bundle_query)) { if (!in_array($bundle_info['subproduct_id'], $seen_bundles)) { $seen_bundles[] = $bundle_info['subproduct_id']; $bundleContents .= '<br /><em style="font-size:12px;"> ' . $bundle_info['subproduct_qty'] . ' x ' . $bundle_info['products_name'] . '</em>'; } } I'm not sure I'm clear on what you are trying to do. If this isn't it, perhaps explain more about what the data holds and what you want to see? Always back up before making changes.
Peper Posted January 30, 2020 Author Posted January 30, 2020 @ruden @ecartz Thanks, i tried both, not showing product bundle Some items are made up of more than on product. I wanted to display the product items included in the bundle example for my admin/invoice.php this is working perfect $bundleContents = ''; $bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM " . TABLE_PRODUCTS . " p LEFT JOIN products_bundles pb ON (pb.bundle_id=p.products_id) LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = '1'"); while ($bundle = tep_db_fetch_array($bundle_query)) { echo "<br> <i>" . $bundle['subproduct_qty'] . " x " . $bundle['products_name'] . "</i>"; } My last attempt i tried both normal product or bundle results into "none" $bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM products p LEFT JOIN products_bundles pb ON (pb.bundle_id=p.products_id) LEFT JOIN products_description pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = '1'"); if (!tep_db_num_rows($bundle_query) ) { $bundleContents = 'none'; } else { $bundle = tep_db_fetch_array($bundle_query); $bundleContents = '<br /><em style="font-size:12px;"> ' . $bundle['subproduct_qty'] . ' x ' . $bundle['products_name'] . '</em>'; } Getting the Phoenix off the ground
hungryfrank Posted January 30, 2020 Posted January 30, 2020 1 hour ago, Peper said: $order->products[$i]['model'] is there an order. where you try to use this? you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal
Peper Posted January 30, 2020 Author Posted January 30, 2020 @hungryfrank yes, there is one This is a html email confirmation i'm working on for checkout_process I see though to get model number unrelated from bundle = <td valign="top" align="center"><font face="verdana" style="font-size:14px;">'.$order->products[$i]['qty'].'</font></td> So that one in bundles? getting model number for bundles? Getting the Phoenix off the ground
Peper Posted January 30, 2020 Author Posted January 30, 2020 Check for needle first? Is this useable $bundle_query = tep_db_query('select pb.subproduct_id, pb.subproduct_qty, p.products_bundle, p.products_quantity from products_bundles pb, products p where p.products_id = pb.subproduct_id and bundle_id = ' . (int)tep_get_prid($bundle_id)); while ($bundle_info = tep_db_fetch_array($bundle_query)) { if ($bundle_info['products_bundle'] == 'yes') { Getting the Phoenix off the ground
hungryfrank Posted January 30, 2020 Posted January 30, 2020 27 minutes ago, Peper said: @hungryfrank yes, there is one This is a html email confirmation i'm working on for checkout_process I see though to get model number unrelated from bundle = <td valign="top" align="center"><font face="verdana" style="font-size:14px;">'.$order->products[$i]['qty'].'</font></td> So that one in bundles? getting model number for bundles? I think you have to use your original code right before the attributes are found for each product. you want to check to see if there is a bundle for each product. it is the same as attributes.you should put your code in the same loop you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal
♥14steve14 Posted January 30, 2020 Posted January 30, 2020 Gary released a products bundle module in one of his latest 28days of code. Could be worth asking him about that. REMEMBER BACKUP, BACKUP AND BACKUP
Peper Posted January 30, 2020 Author Posted January 30, 2020 @14steve14 I do have that module from Gary, I did give it a try a while ago, there were few things but one was the bundle display layout was not working for me. This is not a train smash, i will still pursue a solution for this as it would been great showing in the email confirmation the bundled products instead of just the bundle product name. If you change the bundle after customer purchased a bundle, what products was part of the original bundle? Getting the Phoenix off the ground
Recommended Posts
Archived
This topic is now archived and is closed to further replies.