Jump to content
Johnson

Master Products - MS2

Recommended Posts

Thanks so much, That did it for the What's New InfoBox.

 

Can it also be done for products_new.php, search results, and.....(are there other places this might happen)?

 

Thanks again.

 

 

Yes - the only thing added to the query is:

 

and products_master_status = '1'

 

Matti


Matti Ressler

 

We were all once expert at...... nothing

_____

Share this post


Link to post
Share on other sites

anyone know how i would sort the fields in an options drop down?

 

sizes for clothes seem to come up all over the place, eg: 6,10,16,12

Share this post


Link to post
Share on other sites

Tip for getting the Specials box to function with Master Products:

 

I use Master Products v1.1.5 and the Add-On Rev 4.

The way I use it, the Master Products price is set to "0" and the slaves are where the actual price is set. Using it this way, the file /catalog/includes/boxes/specials.php needs to be just slightly modified to work. If not modified, no special prices will be shown in the specials box.

 

Change this row in /catalog/includes/boxes/specials.php:

 

if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {

 

to this:

 

if ($random_product = tep_random_select("select
 p.products_id,
 pd.products_name,
 p.products_price,
 p.products_tax_class_id,
 p.products_image,
 s.specials_new_products_price
 from " . TABLE_PRODUCTS . " p,
 " . TABLE_PRODUCTS_DESCRIPTION . " pd,
 " . TABLE_SPECIALS . " s
 where p.products_status = '1'
 and p.products_id = s.products_id
 and p.products_price != '0'
 and pd.products_id = s.products_id
 and pd.language_id = '" . (int)$languages_id . "'
 and s.status = '1'
 order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {

 

The only thing that has change, is that and p.products_price != '0'

is added at the end of the query.

 

This is not within the fixes for MP as for what I have seen. If my thinking is wrong here, please feel free to correct me. I am not a MySQL-pro... :-"

 

/Inkan

Share this post


Link to post
Share on other sites
Tip for getting the Specials box to function with Master Products:

 

I use Master Products v1.1.5 and the Add-On Rev 4.

The way I use it, the Master Products price is set to "0" and the slaves are where the actual price is set. Using it this way, the file /catalog/includes/boxes/specials.php needs to be just slightly modified to work. If not modified, no special prices will be shown in the specials box.

 

Change this row in /catalog/includes/boxes/specials.php:

 

if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {

 

to this:

 

if ($random_product = tep_random_select("select
?p.products_id,
?pd.products_name,
?p.products_price,
?p.products_tax_class_id,
?p.products_image,
?s.specials_new_products_price
?from " . TABLE_PRODUCTS . " p,
?" . TABLE_PRODUCTS_DESCRIPTION . " pd,
?" . TABLE_SPECIALS . " s
?where p.products_status = '1'
?and p.products_id = s.products_id
?and p.products_price != '0'
?and pd.products_id = s.products_id
?and pd.language_id = '" . (int)$languages_id . "'
?and s.status = '1'
?order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {

 

The only thing that has change, is that and p.products_price != '0'

is added at the end of the query.

 

This is not within the fixes for MP as for what I have seen. If my thinking is wrong here, please feel free to correct me. I am not a MySQL-pro... :-"

 

/Inkan

 

 

I had a thought about this and my own post yesterday - I think that this would be better:

 

and p.products_master !> 0

 

Matti


Matti Ressler

 

We were all once expert at...... nothing

_____

Share this post


Link to post
Share on other sites

Hi Matti, and thanks for replying!

 

Sorry, but I forgot to mention in my previous post that in my case, besides using products with master-slave relationships, there are also "normal" products that only comes in one version, and is nor a master or a slave. The "normal" products price are set at usual.

 

Using your query would not catch the special products price for the "normal" products, only the slaves, right?

 

To clarify the product structure, here is an example:

 

Product #1 ---------------------

Master #1: Face Tonic, Product description, no price

Slave #1: Face Tonic, 118 ml bottle, Price 1

Slave #2: Face Tonic, 118 ml spray bottle, Price 2

Slave #3: Face Tonic, 118 ml spray bottle, Price 3

 

Product #2 ---------------------

Night cream, product description, 118 ml can, price

 

/Inkan

Share this post


Link to post
Share on other sites
Hi all

 

I?m new here in this forum but have been doing some osCommerce in Sweden for a year.

I have used MP for a time and now i have added the latest contrib that makes it possible to have one slave to several masters.

But... It doesn?t work properly  :(

 

I can connect several masters in admin and the product id is stored in the db but the slave only shows in one of the defined master products in the shop.

 

Anyone here that have had the same problem and a sollution?

 

Thanks in advance

 

Borje

Hi Borje,

 

I have the exact same problem but so far have not got a fix. Can anyone help?

 

Cheers,

Rushy

Share this post


Link to post
Share on other sites

Yes I have the same problem , assign to one it works fine, assign to two it stops working for both. If this gets sorted this will be the perfect contrib for me, I have lots of products where people can add the same items to them, therefore multiple masters to slaves would make my whole site work!


Hey its free!

Share this post


Link to post
Share on other sites

OK sorted this, the documentation by eddy is missing one thing, you need to make a change to the product_info.php file.

 

in the file you should see that there is line

 

 

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . "where products_master = '" . (int) $HTTP_GET_VARS['products_id'] . "'");

 

needs to be:

 

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . "where products_master LIKE '%" . (int) $HTTP_GET_VARS['products_id'] . "%'");


Hey its free!

Share this post


Link to post
Share on other sites

I have been trying to remove the description column from the slave products table, but have been unsuccesfull so far. Can anyone tell me how to do this?

 

From this:

Model Description Options Name+ Select Price

 

To this:

Model Options Name+ Select Price

 

Thanks,

Mark

Share this post


Link to post
Share on other sites
I have been trying to remove the description column from the slave products table, but have been unsuccesfull so far. Can anyone tell me how to do this?

 

From this:

Model    Description    Options    Name+    Select    Price

 

To this:

Model    Options    Name+    Select    Price

 

Thanks,

Mark

 

admin area

 

Go to Configuration - Slave Products

 

ChangeDisplay slave product description to 0


Hey its free!

Share this post


Link to post
Share on other sites

I would really like to download this contribution and get it up and running but which one do I download?? Most of them are updates and it's hard to tell which is a "full" package to grab. Point me in the right direction??

 

I am hoping I don't need to go to the first one then rebuild it from each update. :'(

 

:thumbsup:


:)

Share this post


Link to post
Share on other sites

Hi!

I added version 1.1.15 and after that installed rev 4 found above and "Master Product Slave Attributes". Depending on your needs, you might not need all addons for Master Products.

 

Good Luck!!!

 

/Inkan

Share this post


Link to post
Share on other sites
admin area

Go to Configuration - Slave Products

ChangeDisplay slave product description to 0

Oh man, do I feel dumb. I've been so busy editing code, I forgot completely about Admin.

 

However, now that I've been to the Slave Products section of Admin, I noticed that each item is listed twice, i.e.:

Display Slave Product Name 5

Display Slave Product Name 5

Display Slave Product Model 1

Display Slave Product Model 1

etc......

 

It seems to work OK, but I'd still like to fix it, if someone knows how.

Share this post


Link to post
Share on other sites

Hello. I installed this contribute and the attritbutes to go with it. The only problem I have now is that, earlier I had added another contribute--I can't recall the name of it-- but it's for options. On my master and normal products the options still show up like they're suppose to--radio buttons, text, checkbox--but slave products just show up as select.

 

What can I do to have them have the same type of options?

 

Also, I don't know if anyone knows how to do this, but is there a way to change the slaves according to something they choose on the master? Ideally, my "friend" wants her site to look like this one:::

Neiman Marcus

After working months with her, she just told me this last week, so I'm trying to get it as close as possible.

 

Thank you in advance for all your help.

 

Rat Marie

Share this post


Link to post
Share on other sites

:-" Anyone have this working with option type features?

 

If so, how did u do it?


:)

Share this post


Link to post
Share on other sites
:-"? Anyone have this working with option type features?

 

If so, how did u do it?

 

I had a lot of trouble with this. I was able to get the radio buttons and check boxes to work with out a hitch, but the text and text area would not work. So, I have done a "work-around" that allows the Option Type features to work with stand alone products. Any Master/Slave products work as originally intended with just the pull down menus.

---

Dorothy

Edited by Johnson

Share this post


Link to post
Share on other sites

I am running sts with mp, and have recently changed my main product template, the slave products are now contained inside a table however it appears that the slave prouct listing is fixed in its width somehow, which cokcs up my tables? any ideas?


Hey its free!

Share this post


Link to post
Share on other sites

For those looking for a possible solution for having Master Products and Option Type working together, I did some modifications as shown below. I am not a programmer, and these mods are "Use at your Own Risk", but maybe someone else might be able to clean things up a bit.

 

Okay, this is what I did, since I needed the Master Product to keep the price displayed, I altered the original if statement (step 4) and that's why I added the extra field in the database (step 1). I kept the "Option Type" modifications the same as the original contribution (some suggestions in the "Master Products" forum were to change them, but I found out that we need to keep them intact).

 

 

Step 1:

 

ALTER TABLE products ADD master_list_qty_box INT( 5 ) DEFAULT '1' NOT NULL;

 

(this allows for the if statement to work)

 

Step 2:

 

Change this code:

    <td width="100%" valign="top"><?php  echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">'; ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

 

to:

 

if ($product_info['master_list_qty_box']==0) {
?>	
<td width="100%" valign="top"><?php  echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">'; ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
}
else {
?>
<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
}
?>

 

Step 3:

 

Update the sql statement from this:

 

    $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_master_status, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

to add in the "master_list_qty_box":

 

    $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity,  pd.products_url, p.products_price, p.products_master_status, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.master_list_qty_box from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

Step 4:

 

change this:

    if ($product_info['products_price']>0) {

 

to this:

 

    if ($product_info['master_list_qty_box']>0) {

 

I also changed the pull down quantity to an input field

 

step 5:

 

change this (I think there are two of these to change):

     echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);

 

to:

 

     echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"');

 

 

Step 6:

 

We need to add in the end of the form. So, change this:

 

    </table></td>
<!-- Master Products EOF //-->    
<!-- body_text_eof //-->

 

to this:

 

    </table></form></td>
<!-- Master Products EOF //-->    
<!-- body_text_eof //-->

 

 

 

That should be all the changes. Now, when you add a Master Product, you change the "master_list_qty_box" to a zero and the slaves will add correctly, even if you have options within the slaves. If you have "master_list_qty_box" as a 1, then the option types will work. To see this in action check out my website.

 

For the text input boxes (no slaves):

Custom Belt

 

For a Master with Slaves:

Hapkido Uniform

 

And, a Master with Slaves and the slaves have options:

Graphite Bo

 

 

Hope this helps :D

---

Dorothy

Share this post


Link to post
Share on other sites

Can anyone tell me why each item in the Slave Products area of Admin is listed twice?

 

Like this:

Display Slave Product Name 5

Display Slave Product Name 5

Display Slave Product Model 1

Display Slave Product Model 1

etc......

 

All assistance is appreciated.

Mark

Share this post


Link to post
Share on other sites
Can anyone tell me why each item in the Slave Products area of Admin is listed twice?

 

Mark,

it is only listed once for me. Look into your code if someting is inserted twice in product_info.php

 

- or if you inserted something new without commenting away the old code.

 

/Inkan

Share this post


Link to post
Share on other sites
Can anyone tell me why each item in the Slave Products area of Admin is listed twice?

Perhaps you ran master.sql twice by accident? Then in the table configuration you would find them back twice (all with the configuration_group_id of "Slave Product Listing - Configuration options" (16?) found in configuration_group).

Share this post


Link to post
Share on other sites
Mark,

it is only listed once for me. Look into your code if someting is inserted twice in product_info.php

 

- or if you inserted something new without commenting away the old code.

 

/Inkan

I tried to find the problem myself but could not. I think it is in admin/configuration.php, but I'm not enough of a programmer to figure it out. Here's the code I suspect:

<?php
 $configuration_query = tep_db_query("select configuration_id, configuration_title, configuration_value, use_function from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . (int)$gID . "' order by sort_order");
 while ($configuration = tep_db_fetch_array($configuration_query)) {
   if (tep_not_null($configuration['use_function'])) {
     $use_function = $configuration['use_function'];
     if (ereg('->', $use_function)) {
       $class_method = explode('->', $use_function);
       if (!is_object(${$class_method[0]})) {
         include(DIR_WS_CLASSES . $class_method[0] . '.php');
         ${$class_method[0]} = new $class_method[0]();
       }
       $cfgValue = tep_call_function($class_method[1], $configuration['configuration_value'], ${$class_method[0]});
     } else {
       $cfgValue = tep_call_function($use_function, $configuration['configuration_value']);
     }
   } else {
     $cfgValue = $configuration['configuration_value'];
   }

   if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $configuration['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
     $cfg_extra_query = tep_db_query("select configuration_key, configuration_description, date_added, last_modified, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_id = '" . (int)$configuration['configuration_id'] . "'");
     $cfg_extra = tep_db_fetch_array($cfg_extra_query);

     $cInfo_array = array_merge($configuration, $cfg_extra);
     $cInfo = new objectInfo($cInfo_array);
   }

   if ( (isset($cInfo) && is_object($cInfo)) && ($configuration['configuration_id'] == $cInfo->configuration_id) ) {
     echo '                  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . '\'">' . "\n";
   } else {
     echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $configuration['configuration_id']) . '\'">' . "\n";
   }
?>
---------------------------------------------------------------------------
               <td class="dataTableContent"><?php echo $configuration['configuration_title']; ?></td>
               <td class="dataTableContent"><?php echo htmlspecialchars($cfgValue); ?></td>
               <td class="dataTableContent" align="right"><?php if ( (isset($cInfo) && is_object($cInfo)) && ($configuration['configuration_id'] == $cInfo->configuration_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $configuration['configuration_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
---------------------------------------------------------------------------
             </tr>
<?php
 }
?>

The code between the dashed lines appears to write the lines in question. So why does it write them twice? I thought it might have something to do with the 'while' statement at the top, but I don't really know how to interpret it. I also thought it could by in my database, but I'm not sure what to look for there, either.

 

It might help if I knew what I was doing :-) If you think it is in product_info.php, can you tell me where?

 

Thanks again.

Share this post


Link to post
Share on other sites
Perhaps you ran master.sql twice by accident? Then in the table configuration you would find them back twice (all with the configuration_group_id of "Slave Product Listing - Configuration options" (16?) found in configuration_group).

I did think the problem might be in the database (as I said in the post below). I checked the 'configuration' db and found what appear to be duplicate records. There are 11 of them. I guess I can just delete them? I'm a little scared.

Share this post


Link to post
Share on other sites
There are 11 of them. I guess I can just delete them? I'm a little scared.

That is the right number. Yes, you can delete them. If you are uncertain, first backup your database in the admin section. If you run into trouble you can always restore your db back to that point (not a bad idea to do that whenever you make changes in the structure or manual changes).

Share this post


Link to post
Share on other sites
That is the right number. Yes, you can delete them. If you are uncertain, first backup your database in the admin section. If you run into trouble you can always restore your db back to that point (not a bad idea to do that whenever you make changes in the structure or manual changes).

That worked. Thanks so much for your help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×