Guest Posted August 14, 2004 Share Posted August 14, 2004 Hi there, can't get this to work at all after 3 installs, I am getting a error on the product_info pages as described earlier in the thread with no answers given. The query that is causing problems is: SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price FROM products p INNER JOIN products_description pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id =and language_id = '1' The script is making this: pb.bundle_id = " . tep_get_prid($products_id) . " I would appreciate any help on this as I cannot figure it out, the General.php says that tep_get_prid is used for Attributed products ID?? Kindest regards Quote Link to comment Share on other sites More sharing options...
david_lovesit Posted August 28, 2004 Share Posted August 28, 2004 Hi... May I have a simple question here. Bundled products work great for me. However, one feature I don't like is when I click on one of the bundled items, popup image shows up, rather than its product_info page like that of Amazon.com. Would anybody please help me how to do modify the code? Your help would be greatly appreciated. Thanks, David Quote Link to comment Share on other sites More sharing options...
Monk Posted September 10, 2004 Share Posted September 10, 2004 Here is an answer to the Adding / Modifying / Deleting either exisiting bundles or turning existing products into a new bundle: if ($action == 'insert_product') { $insert_sql_data = array('products_date_added' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); tep_db_perform(TABLE_PRODUCTS, $sql_data_array); $products_id = tep_db_insert_id(); // update bundle contents if ($HTTP_POST_VARS['products_bundle'] == "yes") { // original was: if ($HTTP_POST_VARS['products_bundle'] = "yes") tep_db_query("DELETE FROM products_bundles WHERE bundle_id = " . $products_id . ""); for ($i=0; $i<6; $i++) { if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) { tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES (" . $products_id . ", " . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . ", " . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . ")"); } } } //exit; ////END update bundle contents } elseif ($action == 'update_product') { $update_sql_data = array('products_last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'"); //delete categories saved in the tables tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '". $products_id . "'"); // update bundle contents if ($HTTP_POST_VARS['products_bundle'] == "yes") { // original was: if ($HTTP_POST_VARS['products_bundle'] = "yes") tep_db_query("DELETE FROM products_bundles WHERE bundle_id = " . $products_id . ""); for ($i=0; $i<6; $i++) { if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) { tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES (" . $products_id . ", " . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . ", " . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . ")"); } } } ////END update bundle contents Its amazing when a careful inspection turns up a small mistake..... Quote Link to comment Share on other sites More sharing options...
CC Posted September 10, 2004 Share Posted September 10, 2004 Hi Thanks for the fix, I actually gave up on this mod a long time ago. I tested your fix, but the only thing I dont see a need for was this bit of code: //delete categories saved in the tables tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '". $products_id . "'"); Why do you have this in there? All it seems to do is delete the product completely when you try to edit it... Without that line the mod works perfectly now. Just wondered why you added it? Thnx again CC. Quote Link to comment Share on other sites More sharing options...
greensky Posted September 22, 2004 Share Posted September 22, 2004 This contrib isn't working for me on downloadable products or when I edit a bundled product. Otherwise it works well. If I get it working I'll post back any updates I made. Quote Link to comment Share on other sites More sharing options...
whaou Posted September 29, 2004 Share Posted September 29, 2004 Sorry, But where do you do the corrections (about the fix of Monk) ? in which file ? Quote Link to comment Share on other sites More sharing options...
whaou Posted October 8, 2004 Share Posted October 8, 2004 ??? Quote Link to comment Share on other sites More sharing options...
nesincg Posted November 5, 2004 Share Posted November 5, 2004 (edited) I've have bundles installed and working, even with master products. I have no idea how I even did it. When I delete an order, the products are not restocked that are in a bundle. Is this an error in my code or a known "feature". Before I go are write something, has anyone fixed this problem already? Edited November 5, 2004 by nesincg Quote Link to comment Share on other sites More sharing options...
whaou Posted November 10, 2004 Share Posted November 10, 2004 excuse me, why anybody forward a new contributions of Bundle (ex Bundle 1.1 WITH ALL FIXES) on this url: OSC/Contributions ? Because, the fixes are not easy to apply for a newbie :blush: Quote Link to comment Share on other sites More sharing options...
amspo Posted November 22, 2004 Share Posted November 22, 2004 @ burtsmith Hi there, can't get this to work at all after 3 installs, I am getting a error on the product_info pages as described earlier in the thread with no answers given. The query that is causing problems is: SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price FROM products p INNER JOIN products_description pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id =and language_id = '1' The script is making this: pb.bundle_id = " . tep_get_prid($products_id) . " I would appreciate any help on this as I cannot figure it out, the General.php says that tep_get_prid is used for Attributed products ID?? Kindest regards <{POST_SNAPBACK}> Hallo, have you fixed this problem ? I have the same error - can you help me? Regards Rainer Quote Link to comment Share on other sites More sharing options...
Guest Posted November 26, 2004 Share Posted November 26, 2004 Hello world, I have been working on this issue and have at least found out what is not working. For the above error messages that we all seem to be getting on the query as follows: SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price FROM products p INNER JOIN products_description pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id =and language_id = '1' THere is a call in the product_info.php file as follows: <!-- start bundle --> <?php if ($product_info['products_bundle'] == "yes") { $products_bundle = $product_info['products_bundle']; echo "This product contains the following items: "; $bundle_query = tep_db_query(" SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price FROM products p INNER JOIN products_description pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id = " . tep_get_prid($products_id) . " and language_id = '" . (int)$languages_id . "'"); This is the query producing the acatual error. The issue is this, the function in the WHERE statement at the end is NOT returning the proper bundle ID. In fact, it does not reurn the ID at all as evidenced by the following in the above error. SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price FROM products p INNER JOIN products_description pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id =and language_id = '1' Note that the language_id has a value of '1', but the bundle_id has no returned value at all. WHERE pb.bundle_id = it is this missing return from the function tep_get_prid($product_id) I have proven this by taking this function out and replacing it with an actual value of a known bundle, then it works fine. I have also had to implement the code from 'Monk' posted Sep 9, 2004 to even get my system to write the bundle to the database. This may be related but I have NOT yet figgered that one out. This post is just an update of where I am now, I will indeed keep working on this to figure out why this function is not returning a value, once I do I believe that this mod will work for me. With the exception of the attributes issue I have yet to tackle. I will keep this thread updated if I find anything new on this mod. If anyone else can look into this specific function it would be helpfull. Please feel free to contact me with any questions. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 27, 2004 Share Posted November 27, 2004 OK, I got this figured out for me at least. To get this error out of the way replace the following function in the product_info.php file. seach for: WHERE pb.bundle_id = " . tep_get_prid($products_id) . " and language_id = '" . (int)$languages_id . "'"); and replace with: WHERE pb.bundle_id = " . (int)$HTTP_GET_VARS['products_id'] . " and language_id = '" . (int)$languages_id . "'"); This fixed this issue for me. I hope it helps you too! Quote Link to comment Share on other sites More sharing options...
Guest Posted November 27, 2004 Share Posted November 27, 2004 Sorry for the double post. Could not edit previous post. OK, I got this figured out for me at least. To get this error out of the way replace the following function in the product_info.php file. seach for: WHERE pb.bundle_id = " . tep_get_prid($products_id) . " and language_id = '" . (int)$languages_id . "'"); and replace with: WHERE pb.bundle_id = " . (int)$HTTP_GET_VARS['products_id'] . " and language_id = '" . (int)$languages_id . "'"); additionaly I implemented Monks code with a slight change, otherwise the tables never get updated correctly. A missing right bracket was the culprit as mentioned earlier in this thread. In admin/catagories.php Find this code... // update bundle contents if ($HTTP_POST_VARS['products_bundle'] = "yes") { tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . $products_id . "'"); for ($i=0, $n=6; $i<$n; $i++) { if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) { tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . $products_id . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . "')"); } } } and replace with this: // update bundle contents } if ($HTTP_POST_VARS['products_bundle'] == "yes") { // original was: if ($HTTP_POST_VARS['products_bundle'] = "yes") tep_db_query("DELETE FROM products_bundles WHERE bundle_id = " . $products_id . ""); for ($i=0; $i<6; $i++) { if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) { tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES (" . $products_id . ", " . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . ", " . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . ")"); } } } //exit; ////END update bundle contents } elseif ($action == 'update_product') { $update_sql_data = array('products_last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'"); //delete categories saved in the tables tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '". $products_id . "'"); // update bundle contents if ($HTTP_POST_VARS['products_bundle'] == "yes") { // original was: if ($HTTP_POST_VARS['products_bundle'] = "yes") tep_db_query("DELETE FROM products_bundles WHERE bundle_id = " . $products_id . ""); for ($i=0; $i<6; $i++) { if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) { tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES (" . $products_id . ", " . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . ", " . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . ")"); } } } ////END update bundle contents This fixed this issue for me. I hope it helps you too! Feel free to contact me if you need help with this. Quote Link to comment Share on other sites More sharing options...
amspo Posted November 28, 2004 Share Posted November 28, 2004 hi, thanks for good mod. best regards rainer Quote Link to comment Share on other sites More sharing options...
amspo Posted November 28, 2004 Share Posted November 28, 2004 (edited) I would like the Bundle article as Url to call to explain and the price inclusive Tax wheel behind it to represent... Can that be done? who can form the code for me? best regards rainer Edited January 9, 2005 by Johnson Quote Link to comment Share on other sites More sharing options...
keithxtreme Posted November 29, 2004 Share Posted November 29, 2004 Anyword on an Update? I have it working, but only for new products created since installing mod...I cannot get it to work with all of my products previous to the install.... Quote Link to comment Share on other sites More sharing options...
keithxtreme Posted November 29, 2004 Share Posted November 29, 2004 //exit; ////END update bundle contents } elseif ($action == 'update_product') { I am getting a this error for this part of the code...Parse error: parse error, unexpected T_ELSEIF Quote Link to comment Share on other sites More sharing options...
keithxtreme Posted November 29, 2004 Share Posted November 29, 2004 I am getting a this error for this part of the code...Parse error: parse error, unexpected T_ELSEIF <{POST_SNAPBACK}> Well I thought I had made progress...I added the changes that DS_Sultan posted and all appeared to work. But then I noticed that new products or bundles where not showing up in admin to edit....But they do show up in database. And also only the bundle name shows in check out...Maybe I will start over... This would be very cool if it would work! Quote Link to comment Share on other sites More sharing options...
Guest Posted November 29, 2004 Share Posted November 29, 2004 Figures that my fix does not help ev Quote Link to comment Share on other sites More sharing options...
Guest Posted November 29, 2004 Share Posted November 29, 2004 Figures that my fix does no Quote Link to comment Share on other sites More sharing options...
Guest Posted November 29, 2004 Share Posted November 29, 2004 Figures that my fix does not help everyone. My site is heavily mod'ed and I take carefull measures when applying another one. My site works perfectly with the exception of attributes, even existing items can become a bundle master. If they do not work for you, then it is likely you missed something during the install. The unexpected T_ELSEIF is ussually due to a missing bracket, so be sure you check your installation instructions and go thru each step in detail. If you need help you can PM me and I will see what I can do to help get this workin for you. Quote Link to comment Share on other sites More sharing options...
keithxtreme Posted November 29, 2004 Share Posted November 29, 2004 I got all of your code to work except I get this error...Parse error: parse error, unexpected T_VARIABLE in /home/httpd/vhosts/xtremecrawlers.com/httpdocs/catalog/product_info.php on line 244 If I comment it out it all works....this is the code: The line getting the error is in Red...I still have to work on the new products not showing up in Admin... <!-- start bundle --><?php if ($product_info['products_bundle'] == "yes") { $products_bundle = $product_info['products_bundle']; echo TEXT_BUNDLE_CONTENTS . "<br><table>"; $bundle_query = tep_db_query("SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price FROM products p INNER JOIN products_description pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id = " . (int)$HTTP_GET_VARS['products_id'] . " and language_id = '" . (int)$languages_id . "'"); while ($bundle_data = tep_db_fetch_array($bundle_query)) { if ($bundle_data['products_bundle'] == "yes") { // uncomment the following line to display subproduct qty // echo "<br>» <b>" . $bundle_data['subproduct_qty'] . " x " . $bundle_data['products_name'] . "</b>"; //echo "<br>» <b> " . $bundle_data['products_name'] . "</b>"; echo '<tr><td valign="top" class="main">» <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $bundle_data['products_id']) . '"><b><u>' . $bundle_data['products_name'] . '</u></b></a></td></tr>'; $bundle_query_nested = tep_db_query("SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price FROM products p INNER JOIN products_description pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id = " . $bundle_data['products_id'] . " and language_id = '" . (int)$languages_id . "'"); while ($bundle_data_nested = tep_db_fetch_array($bundle_query_nested)) { // uncomment the following line to display subproduct qty // echo "<br><i> " . $bundle_data_nested['subproduct_qty'] . " x " . $bundle_data_nested['products_name'] . "</i>"; //echo "<br><i> " . $bundle_data_nested['products_name'] . "</i>"; echo '<tr><td valign="top" class="main"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $bundle_data_nested['products_id']) . '"><i><u>' . $bundle_data_nested['products_name'] . '</u></i></a></td></tr>'; // CB use special price if available if ($new_price = tep_get_products_special_price($bundle_data_nested['products_id'])) { $bundle_sum += $new_price*$bundle_data_nested['subproduct_qty']; } else { $bundle_sum += $bundle_data_nested['products_price']*$bundle_data_nested['subproduct_qty']; } // endof CB mod } } else { // uncomment the following line to display subproduct qty // echo "<br>» <b>" . $bundle_data['subproduct_qty'] . " x " . $bundle_data['products_name'] . "</b>"; //echo "<br>» <b> " . $bundle_data['products_name'] . "</b>"; echo '<tr><td valign="top" class="main">» <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $bundle_data['products_id']) . '"><b><u>' . $bundle_data['products_name'] . '</u></b></a></td></tr>'; // CB use special price if available if ($new_price = tep_get_products_special_price($bundle_data_nested['products_id'])) { $bundle_sum += $new_price*$bundle_data['subproduct_qty']; } else { $bundle_sum += $bundle_data['products_price']*$bundle_data['subproduct_qty']; } // endof CB mod } } // CB use special bundle price if available if ($new_price = tep_get_products_special_price($product_info['products_id'])) { $bundle_saving = $bundle_sum - $new_price; } else { $bundle_saving = $bundle_sum - $product_info['products_price']; } // endof CB mod $bundle_sum = $currencies->display_price($bundle_sum, tep_get_tax_rate($product_info['products_tax_class_id'])); $bundle_saving =?$currencies->display_price($bundle_saving, tep_get_tax_rate($product_info['products_tax_class_id'])); // comment out the following line to hide the "saving" text echo '</table><p><table><tr><td class="main" align="right">' . TEXT_BUNDLE_SUM . '</td><td? class="main"><span class="productPrice">' . $bundle_sum . '</span></td></tr><tr><td class="main" align="right">' . TEXT_BUNDLE_SAVINGS . '</td><td? class="main"><span class="productSpecialPrice">' . $bundle_saving . '</span></td></tr></table>'; } ?> <!-- end bundle --> Quote Link to comment Share on other sites More sharing options...
Guest Posted November 29, 2004 Share Posted November 29, 2004 I got all of your code to work except I get this error...Parse error: parse error, unexpected T_VARIABLE in /home/httpd/vhosts/xtremecrawlers.com/httpdocs/catalog/product_info.php on line 244 If I comment it out it all works....this is the code: The line getting the error is in Red...I still have to work on the new products not showing up in Admin... <{POST_SNAPBACK}> I have tried your code in place of mine and it works fine on my site. I think there must either be a part of the insstall you missed or another mod that is involved. Perhaps we need to go a bit deeper into your other files... Quote Link to comment Share on other sites More sharing options...
keithxtreme Posted November 30, 2004 Share Posted November 30, 2004 I have tried your code in place of mine and it works fine on my site. I think there must either be a part of the insstall you missed or another mod that is involved. Perhaps we need to go a bit deeper into your other files... <{POST_SNAPBACK}> I have More pics 6 installed and I went back through the code and noticed that some of the bundle code fell in the middle of more pics. So I am going to go back to fresh copies and pay attention as to what is before and after the spots to put the bundle code and make sure I do not split it up... Quote Link to comment Share on other sites More sharing options...
MLu Posted November 30, 2004 Share Posted November 30, 2004 I have successfully installed this contribution, but I get this error when saving updates to products: 1062 - Duplicate entry '41-24' for key 1 The new subproducts are stored o.k. in table products_bundles, but any other changes to standard osc fields are not stored. I have seen that others have encoutered the same problem, but have not been able to locate a solution. Below is an extract from my /admin/categories.php where I think the error might be: tep_db_perform(TABLE_PRODUCTS, $sql_data_array); $products_id = tep_db_insert_id(); } // update bundle contents if ($HTTP_POST_VARS['products_bundle'] = "yes") { tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . $products_id . "'"); for ($i=0, $n=6; $i<$n; $i++) { if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && $HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) { tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . $products_id . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_id'] . "', '" . $HTTP_POST_VARS['subproduct_' . $i . '_qty'] . "')"); } } tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')"); } elseif ($action == 'update_product') { $update_sql_data = array('products_last_modified' => 'now()'); 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.