Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.


  • Content count

  • Joined

  • Last visited

  1. xplorer4d

    Master Products - MS2

    Just a quick addition It is better if the table products_to_master is MyISAM table (As in the original Galen's contrib), which supports concurrent SELECT and INSERT statements: CREATE TABLE `products_to_master` ( `slave_id` int(11) NOT NULL default '0', `master_id` int(11) NOT NULL default '0' ) TYPE=MyISAM;
  2. xplorer4d

    Master Products - MS2

    Hello Matti et all Good news, :lol: The N to N master slave relationship (aka Master products version 2) is one step closer. THis means you can assign a slave to many masters. Not easy, but possible. I need some expert help to make it work, but here is where we are so far in combining Johnson's contrib with Galen's contrib. The additions need to be used with Master product 1.1.5 files. Please read all post before proceeding with changes. The imperfect way it works now is explained at the end. Thank you. Step 1- Insert a new table to hold the M-S relationships SQL query using PHPMY Admin: CREATE TABLE `products_to_master` ( `slave_id` int(11) NOT NULL default '0', `master_id` int(11) NOT NULL default '0' ); 2. in catalog/includes/modules/master_products.php replace $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_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 . "'"; WITH $master_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, pm.master_id, pm.slave_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_MASTER . " pm, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and p.products_id=pm.slave_id and pm.master_id=" . $_GET['products_id'] ; Step 3 Corection to add to cart in catalog/includes/application_top.php FIND // customer adds a product from the products page case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; After above INSERT/OR REPLACE if case 'add_slave' exists: //Master Products ENDLICH ?BERHOLT!! Ren? Reineke 06.12.03 // customer adds multiple products from the master_listing page case 'add_slave' : foreach ($HTTP_POST_VARS as $keyA => $valueA) { if (substr($keyA,0,11) == "Qty_ProdId_") { $prodId = substr($keyA,11); if ($valueA <= 0 ) continue; $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $HTTP_POST_VARS['id']))+($valueA), $HTTP_POST_VARS['id']); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; //Master Products EOF HOW IT WORKS NOW: a) Assign a product as a master and assign one slave to it using Johnson's contrib. (If you remove or do not add this slave, the following will not work any more) B) Using PhPMYAdmin add the master slave relationships you want in the products_to_master table. c) YOur master product will list all the slaves that you added to the products_to_master table. The Add to cart button will add all of them to the cart. THINGS WE NEED HELP WITH: 1. a work around issue a). If there is a relationship in the products_to_master table it should be listed even if we did not assign a slave using Johnson's contrib or if we remove that slave 2. A user-friendly admin page where we can assign the slave master relationships in the products_to_master table. It would be excellent if we can assign more slaves/masters at once. 3. A friendly admin page where we can change the status of a product from master to slave and from slave to master. That's all. I would say with your help this can be functional and friendly in a few days. Read you soon, Xena - Xploring 4d ONE :rolleyes:
  3. xplorer4d

    Master Products - MS2

    Hello Matti and other wizards of the MP2 contribution. Is it possible to combine your wisdom with Galen's wisdom - (Galen's Master Products)? :D This way you can create the 1 slave to N masters relationship and make people happy with the Master Products 2.0 :lol: Have a good day.
  4. xplorer4d

    Master Products - MS2

    Thank you very much. This is an AWESOME contribution. CONGRATULATIONS for the beautiful mind(s) behind it. SUPER NICE QUESTIONS (3) for who has an answer: 1. There are 20 slave products each month (meals) - to preorder (they change each month) There are 20 masters - 20 working days How can we list all 20 slaves in each master? :unsure: Translation: IF product is master LIST all slaves in db(for that month) August 1 - master - Soup - slave - lasagna - slave - chicken - slave ... ... ... August 2 - master - Soup - slave - lasagna - slave - chicken - slave ... ... ... 2. How can we check the total no of meals ordered for 1 day? :o Client should not be able to add to cart if total no of meals is <4 or >12. 3. How can we automatically add a hidden field :ph34r: to each slave so we know for what day it is ordered? Thank you very much Xen