Guest Posted December 8, 2003 Posted December 8, 2003 (edited) I think that it is enough to replace the $lc_text line in the buy_now case in includes/modules/master_listing.php This works nicely if you add p.products_quantity to the $master_sql query in master_products.php: ? ? ?$master_sql = "select ?" . $select_column_list . " p.products_id, ?p.manufacturers_id, p.products_tax_class_id, s.specials_new_products_price, s.status, p.products_quantity, p.products_price from ". TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = pd.products_id and p.products_master = '" . $thisquery['products_master'] . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "'"; For those who didn't quite get that, the '20' in Matt's code is the upper limit the drop menu will display - change to the desired setting. Good one :D Edited December 8, 2003 by Johnson Quote
ReneRe Posted December 8, 2003 Posted December 8, 2003 Add this in shopping_cart.php to link back to the master product instead of a slave! ## after $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'])); ##add this // Ren? Reineke -- link back to master product on shopping cart $master_prod = tep_db_query("select products_master, products_master_status from " . TABLE_PRODUCTS . " where products_id = '" . $products[$i]['id'] . "'"); $master_prod_values = tep_db_fetch_array($master_prod); if (($master_prod_values['products_master_status'] == 0) && ($master_prod_values['products_master'] != 0)) { $products[$i]['id'] = $master_prod_values['products_master']; } // Ren? Reineke MaSTER Mod end creates an extra query. I'm sure it can be optimized but no time now. Quote
Guest Posted December 9, 2003 Posted December 9, 2003 This works nicely if you add p.products_quantity to the $master_sql query in master_products.php:The other change to includes/modules/master_products.php that I forgot to mention was that I commented out (around line 58): // $select_column_list .= 'p.products_quantity, '; Hth, Matt Quote
ringman57 Posted December 10, 2003 Posted December 10, 2003 Any plans to allow a slave to belong to multiple masters? Like if you have a series of gift baskets that use differnt products mostly, but may have some products in common... Quote
pixellated Posted December 10, 2003 Posted December 10, 2003 I made a minor modification of the script to allow me to view which products in the categories.php (/catalog/admin/categories.php) page were designated as "Master" and which were "Slave." Because I entered all my slave products with the same name(s) as the masters, it was impossible to tell with a simple glance at the list. Here are my mods, if anyone's interested: In the master products queries (around line 1420 in my copy) I simply added 'p.products_master_status' to each query: //Master Products $products_count = 0; if (isset($HTTP_GET_VARS['search'])) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_master_status, p.products_listing_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name"); } else { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_master_status, p.products_listing_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name"); } And then changed the table display based on $products['products_master_status'] down around lines 1455 (in my copy - your mileage may vary): <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id'] . '&action=new_product_preview&read=only') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> '; if ($products['products_master_status'] == "1") { echo '<span style="color: #00f;">' . $products['products_name'] . ' (Master)</span></td>'; } else { echo $products['products_name'] . '</td>'; } ?> Now, my products list displays as: Black Leather Studded Belt - Master Black Leather Studded Belt Black Leather Studded Belt (Mind you - if I had just entered all my content with a slightly different name for the slave items, I wouldn't have needed to go to this trouble. But I didn't, so I did. So there. :) ) HOWEVER... Something odd has happened that I don't believe is related to the code I changed. Now, when I click on a product for a quick overview in the box to the right of the list, I get two sets of "Edit/Delete/Move/Copy To" buttons. The top set of buttons appears to relate to the master item - the "Edit" button, for example - while the bottom buttons appear to relate to a standard (slave) item. (See image below:) I really have no idea what's going on. I removed my edits above from the script and the extra buttons were still there. Any ideas? Quote
Guest Posted December 11, 2003 Posted December 11, 2003 Any plans to allow a slave to belong to multiple masters? Like if you have a series of gift baskets that use differnt products mostly, but may have some products in common... This simplest way to do this is to use the 'copy' button - then assign another Master to the copied product. Matti Quote
ringman57 Posted December 12, 2003 Posted December 12, 2003 Any plans to allow a slave to belong to multiple masters? Like if you have a series of gift baskets that use differnt products mostly, but may have some products in common... This simplest way to do this is to use the 'copy' button - then assign another Master to the copied product. Matti Managing stock becomes an issue then... Quote
Guest Posted December 12, 2003 Posted December 12, 2003 To have a slave associated with multiple masters, you would have to add a new database table (slaves_to_masters?) which would map between the two. Under the current system, you only have one field in which to store a master's ID. Look at the products_to_categories table for an example of how this would have to work. Hth, Matt Quote
madyson3 Posted December 13, 2003 Posted December 13, 2003 Hi guys. I'm still wondering if anyone can help me with my problem. I can't use the Master Slave contribution until I fix the problem, and boy have I been trying. Okay, here is the problem again: I have a master product with 3 slaves. When I select how many of a slave I want, the program only adds the master product and not the slave. Additionally, it only adds 1 master, no matter what quantity I select on the slave. The only way I can add a slave is to click on the slave image, thus opening it's own product page, and then adding to the cart from there. Also, my slave products are showing up in the "New products" box even though they are set no to show in the listing. Please help if you can. --Kristy Quote See you on the dark side, Kristy I'm just a girl living in captivity Your rules of thumb makes me worrisome
Guest Posted December 13, 2003 Posted December 13, 2003 (edited) Version 1 only has the option to hide Slave products in the categories/ product_listing display. To hide products elsewhere that have 'Hide Product' selected in admin: For the new products box, in catalog/includes/modules/new_products.php change the $new_products_query to: //Products_master ?if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { ? ?$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_listing_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); ?} else { ? ?$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_listing_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); ?} //Products_master EOF To hide them in the 'What's New' box, in catalog/includes/boxes/whats_new.php change the $random_product query to: //Products_master ?if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' and products_listing_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) { //Products_master EOF To hide them on the catalog/products_new.php page, update $products_new_query_raw to: //Products_master ?$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_master, p.products_master_status, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_listing_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; //Products_master EOF (Products do not need a Master to be hidden with the above) The next version of Master Products will probably have a series of check boxes for selecting which pages the individual Slave products will show, including specials, which are not covered above - some users will wish to show Slaves in new products, but not product listing etc. I highly recommend using a program such as Beyond Compare for tracking installation issues. HTH Matti Edited December 13, 2003 by Johnson Quote
rufiogsr Posted December 13, 2003 Posted December 13, 2003 Ok i figured i would give Master Products a try since it has exactly what i was looking for. I uploaded it to my server and it seemed to cause a bunch of problems. I'm a newbie at PHP so I know its me and not your scripts. But if you guys could help me get back it running correctly I would appreciate it. First problem: When i go into my Admin Settings. I get this: 1054 - Unknown column 'p.products_listing_status' in 'field list' select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_listing_status from products p, products_description pd, products_to_categories p2c where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = '0' order by pd.products_name [TEP STOP] It's not allowing me to add or modify products or anything along those lines. :o Second Problem: on == true) { if ( (tep_session_is_registered('customer_id') == false) || ($id != $customer_id) ) { return 0; } } $addresses_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$id . "'"); $addresses = tep_db_fetch_array($addresses_query); return $addresses['total']; } // nl2br() prior PHP 4.2.0 did not convert linefeeds on all OSs (it only converted \n) function tep_convert_linefeeds($from, $to, $string) { if ((PHP_VERSION < "4.0.5") && is_array($from)) { return ereg_replace('(' . implode('|', $from) . ')', $to, $string); } else { return str_replace($from, $to, $string); } } // //Master Products // grabs a length from a string, but goes back to the last space if it cut into // the middle of a string. If the string is longer than that, cut, then add '...' // to the end of the string, if the $more == 1 function osc_trunc_string($str="",$len=150,$more=1) { if ($str=="") return $str; if (is_array($str)) return $str; $str = trim($str); // if it's less than the size given, then return it if (strlen($str) <= $len) return $str; // else get that size of text $str = substr($str,0,$len); // backtrack to the end of a word if ($str != "") { // check to see if there are any spaces left if (!substr_count($str," ")) { if ($more) $str .= "..."; return $str; } // backtrack while(strlen($str) && ($str[strlen($str)-1] != " ")) { $str = substr($str,0,-1); } $str = substr($str,0,-1); if ($more) $str .= "..."; } return $str; } //Master Products EOF ?>Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/janwdesi/public_html/catalog/includes/functions/general.php:1266) in /home/janwdesi/public_html/catalog/includes/functions/sessions.php on line 67 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/janwdesi/public_html/catalog/includes/functions/general.php:1266) in /home/janwdesi/public_html/catalog/includes/functions/sessions.php on line 67 On all of my pages on my website this code comes up on the top of it. Quote
rufiogsr Posted December 13, 2003 Posted December 13, 2003 (edited) Ok i re-uploaded all the files and the only error i get now is in the admin section. The error doesnt show up on my actual webpage untill i go and click on a product. Edited December 13, 2003 by rufiogsr Quote
rufiogsr Posted December 14, 2003 Posted December 14, 2003 Any one know how to fix the 1054 - ERROR? Quote
Guest Posted December 14, 2003 Posted December 14, 2003 Any one know how to fix the 1054 - ERROR? You must run the master.sql file included in the download on your database - please backup. Matti Quote
Guest Posted December 14, 2003 Posted December 14, 2003 Any plans to allow a slave to belong to multiple masters? Like if you have a series of gift baskets that use differnt products mostly, but may have some products in common... This simplest way to do this is to use the 'copy' button - then assign another Master to the copied product. Matti Managing stock becomes an issue then... Ok - I can see this would be a very useful feature - I shall include it in the next release. I have commenced work on version 2, so any further input is much appreciated. Matti Quote
rufiogsr Posted December 14, 2003 Posted December 14, 2003 Any one know how to fix the 1054 - ERROR? You must run the master.sql file included in the download on your database - please backup. Matti This is defiantly where I messed up. How do I go about running this file on my database? Do I just upload it to any directory and then open the URL to it? Sorry I'm in the learning stages. If someone could please explain further i would appreciate it. Quote
Guest Posted December 14, 2003 Posted December 14, 2003 Any one know how to fix the 1054 - ERROR? You must run the master.sql file included in the download on your database - please backup. Matti This is defiantly where I messed up. How do I go about running this file on my database? Do I just upload it to any directory and then open the URL to it? Sorry I'm in the learning stages. If someone could please explain further i would appreciate it. Use phpmyadmin - if you have cPanel on your hosting account, go to MySQL databases - there should be a link there to phpmyadmin (down the bottom of the page) - click on this - this usually will open a new window> select your database>depending on your phpmyadmin version, either click on the SQL tab, or simply scroll down the page to the SQL queries dialog>use the browse button to browse to the master.sql file on your local hard drive>click 'go' :D Please backup always before making changes to your database :blink: Matti Quote
rufiogsr Posted December 14, 2003 Posted December 14, 2003 Thanks! I got it up and running. I'm sure i'll have more questions soon. :rolleyes: Quote
madyson3 Posted December 14, 2003 Posted December 14, 2003 :rolleyes: Yes, It's me again. I've been working on my website all day (thanks to the help of many people ....Matti you rock). I thought I had it all good and stable about an hour ago, then I did a smoke test for funtionality. Whoops, I have lost the ability to HIDE a slave product. I still have the option to select hide, but it won't save. The only thing (I think) I have done since it was working was change the length of the Product model name in the database. It was 12 before and now it is 20. I don't see how that would effect it though. Any thoughts or suggestions? Thanks, Kristy Quote See you on the dark side, Kristy I'm just a girl living in captivity Your rules of thumb makes me worrisome
Guest Posted December 14, 2003 Posted December 14, 2003 (edited) I still have the option to select hide, but it won't save. Did you actually check the products table in the database to confirm that products_listing_status is not updating? The radio buttons will show if it is updating - if you click edit again after changing it should be selected on the option you chose.... :D Be sure to click the 'update' button after 'preview' :P Matti Edited December 14, 2003 by Johnson Quote
madyson3 Posted December 14, 2003 Posted December 14, 2003 Okay here's the deal: When I go to edit a slave product, it defaulting to Previously I had a master assigned to it and the Hide radio button selected. If I look in the database it shows it correctly (set to 0 for hide.) So if I edit a different field and do not update the Master and Hide fields, then the slave product is reset to "show". If I update it along with my other edits then it will correctly hide, but when I open it to edit again, the same default as the image appears. Quote See you on the dark side, Kristy I'm just a girl living in captivity Your rules of thumb makes me worrisome
Guest Posted December 14, 2003 Posted December 14, 2003 If I update it along with my other edits then it will correctly hide, but when I open it to edit again, the same default as the image appears. I cannot duplicate this - are you using an admin/categories.php from the download, or did you copy changes over? Matti Quote
madyson3 Posted December 14, 2003 Posted December 14, 2003 I already had a contribution (Ulta Pics). It was easier to copy the ulta pics code into the download file rater then vice versa. --Kristy Quote See you on the dark side, Kristy I'm just a girl living in captivity Your rules of thumb makes me worrisome
Guest Posted December 14, 2003 Posted December 14, 2003 I already had a contribution (Ulta Pics). It was easier to copy the ulta pics code into the download file rater then vice versa. --Kristy Ok - make sure that products_master and products_master_status are in the $product_query HTH Matti Quote
madyson3 Posted December 14, 2003 Posted December 14, 2003 Yes it is. Here is the line: $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id, p.products_master, products_master_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'"); Kristy Quote See you on the dark side, Kristy I'm just a girl living in captivity Your rules of thumb makes me worrisome
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.