Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Master Products - MS2


Guest

Recommended Posts

I was also wondering about the search engine, is there anyway to make it so that slaves won't be displayed in the search engine, but only the master itself.

 

For example if the master item was called rims

and the slaves was rim 17", rim 18", rim 19" blue

 

So when you do a search for "rims", "rims blue" "rims 19" u would see "rims" (The master link) only?

 

Thanks.

I was also wondering the same.

Link to comment
Share on other sites

I was also wondering about the search engine, is there anyway to make it so that slaves won't be displayed in the search engine, but only the master itself.

 

For example if the master item was called rims

and the slaves was rim 17", rim 18", rim 19" blue

 

So when you do a search for "rims", "rims blue" "rims 19" u would see "rims" (The master link) only?

 

Thanks.

In catalog/advanced_search_result.php change:

 

  $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 

to:

 

  $where_str = " where p.products_status = '1' and p.products_master = '0' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 

This only works if the Master has the search term - a better solution is to have the result return the Master if the search term is found within the Slave - something I shall get around to I am sure.

 

Matti

Link to comment
Share on other sites

I was also wondering about the search engine, is there anyway to make it so that slaves won't be displayed in the search engine, but only the master itself.

 

For example if the master item was called rims

and the slaves was rim 17", rim 18", rim 19" blue

 

So when you do a search for "rims", "rims blue" "rims 19" u would see "rims" (The master link) only?

 

Thanks.

In catalog/advanced_search_result.php change:

 

 ?$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 

to:

 

 ?$where_str = " where p.products_status = '1' and p.products_master = '0' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 

This only works if the Master has the search term - a better solution is to have the result return the Master if the search term is found within the Slave - something I shall get around to I am sure.

 

Matti

Works great! it even searches for keywords that are in the slave and only shows the master!!!

 

Excuse my languaged but damn i love this contribution, now the only thing I wish it could also do is input a seperate product description in the master product or products that aren't linked to master products. Such as how maxidvd did it on his site

 

MaxiDvd's Site

 

Thanks!

Link to comment
Share on other sites

Excuse my languaged but damn i love this contribution, now the only thing I wish it could also do is input a seperate product description in the master product or products that aren't linked to master products. Such as how maxidvd did it on his site

 

MaxiDvd's Site

 

Thanks!

There is a separate contribution or two for descriptions in product listing - this functionality will be included in the next release, but you *can* do it now :P

 

Matti

Link to comment
Share on other sites

I had Master Products working a couple of weeks ago but since then I had to reinstall a bunch a new contributions and now I'm having problems. Everything looks fines and all MasterProducts stuff shows up. However, when I go to place a order and I click "add to cart" the cart is not updated. See for yourself here:

 

Problems at VintageLand

 

Where (files) should I start looking in order to troubleshoot this problem?

 

Here's what my product_info.php file looks like:

 

 <?php
/*
?$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

?osCommerce, Open Source E-Commerce Solutions
?[URL=http://www.oscommerce.com]http://www.oscommerce.com[/URL]
?
?Copyright ? 2003 osCommerce
?
?Master Products - JOHNSON - 05/07/2003 [email protected]

?Copyright ? 2003 Suomedia - Dynamic Content Management

?Released under the GNU General Public License
*/

?require('includes/application_top.php');

?require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

?$product_check_query = tep_db_query("select count(*) as total 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 . "'");
?$product_check = tep_db_fetch_array($product_check_query);
//Master Products
?$product_master_status_query = tep_db_query ("select products_master_status from " . TABLE_PRODUCTS . " where products_id = ?'" . (int)$HTTP_GET_VARS['products_id'] . "'");
?$product_master_result = tep_db_fetch_array($product_master_status_query);
?$product_master = $product_master_result['products_master_status'];
//Master Products EOF ?
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
?window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
?<tr>
? ?<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
? ?</table></td>
<!-- body_text //-->
<!-- Master Products //-->
? ?<td width="100%" valign="top"><?php if ($product_master['product_master_status']!= 1) { ?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">
<!-- Master Products EOF //-->
<?php
?if ($product_check['total'] < 1) {
?>
? ? ?<tr>
? ? ? ?<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
? ? ? ? ?<tr class="infoBoxContents">
? ? ? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ? ?<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ?</tr>
? ? ? ? ? ?</table></td>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>
<?php
?} else {
//Master Products ? ?
? ?$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_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 . "'");
//Master Products EOF
? ?$product_info = tep_db_fetch_array($product_info_query);

? ?tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

? ?if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
? ? ?$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
? ?} else {
? ? ?$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
? ?}

? ?if (tep_not_null($product_info['products_model'])) {
? ? ?$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
? ?} else {
? ? ?$products_name = $product_info['products_name'];
? ?}
?>
? ? ?<tr>
? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
? ? ? ? ?<tr>
? ? ? ? ? ?<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
<!-- Master Products //--> ? ? ? ? ? ?
? ? ? ? ? ?<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
<!-- ?Master Products EOF //--> 
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td class="main">
<?php
? ?if (tep_not_null($product_info['products_image'])) {
?>
? ? ? ? ?<table border="0" cellspacing="0" cellpadding="2" align="right">
? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td align="center" class="smallText">
? ? ? ? ? ? ?</td>
? ? ? ? ? ?</tr>
? ? ? ? ?</table>
<?php
? ?}
?>
? ? ? ? ?<p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
? ?$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
? ?$products_attributes = tep_db_fetch_array($products_attributes_query);
? ?if ($products_attributes['total'] > 0) {
?>
? ? ? ? ?<table border="0" cellspacing="0" cellpadding="2">
? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
? ? ? ? ? ?</tr>
<?php
? ? ?$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
? ? ?while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
? ? ? ?$products_options_array = array();
? ? ? ?$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
? ? ? ?while ($products_options = tep_db_fetch_array($products_options_query)) {
? ? ? ? ?$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
? ? ? ? ?if ($products_options['options_values_price'] != '0') {
? ? ? ? ? ?$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
? ? ? ? ?}
? ? ? ?}

? ? ? ?if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
? ? ? ? ?$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
? ? ? ?} else {
? ? ? ? ?$selected_attribute = false;
? ? ? ?}
?>
? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
? ? ? ? ? ? ?<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
? ? ? ? ? ?</tr>
<?php
? ? ?}
?>
? ? ? ? ?</table>
<?php
? ?}
?>
? ? ? ?</td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
<?php
? ?$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
? ?$reviews = tep_db_fetch_array($reviews_query);
? ?if ($reviews['count'] > 0) {
?>
? ? ?<tr>
? ? ? ?<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
<?php
? ?}

? ?if (tep_not_null($product_info['products_url'])) {
?>
? ? ?<tr>
? ? ? ?<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
<?php
? ?}

? ?if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
? ? ?<tr>
? ? ? ?<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
? ? ?</tr>
<?php
? ?} else {
?>
? ? ?<tr>
? ? ? ?<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
? ? ?</tr>
<?php
? ?}
?>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
? ? ? ? ?<tr class="infoBoxContents">
? ? ? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ? ?<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
<!-- Master Products //--> ? ? ?
<?php if ($product_master['product_master_status']!= 1) { ?> 
? ? ? ? ? ? ? ?<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td></form>
<?php
}
?> 
? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ?</tr>
? ? ? ? ? ?</table></td>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>
? ? ?
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>


<?php

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master = ?'" . (int)$HTTP_GET_VARS['products_id'] . "'");
$results = tep_db_fetch_array($master_query);
if ($results['products_id'] != null) { ?>

? <tr>
? ?<td align="left" class="main"> <?php echo TEXT_SLAVE_PRODUCTS; ?></td>
? </tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr> ? 
? <tr>
? ?<td><?php include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS); ?></td>
? </tr>
? 
<?php ? ?
?} ? ? 
?>
<!-- Master Products EOF //--> ? ? ? 
? ? ?<tr>
? ? ? ?<td>
<?php
? ?if ((USE_CACHE == 'true') && empty($SID)) {
? ? ?echo tep_cache_also_purchased(3600);
? ?} else {
? ? ?include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
? ?}
?}
?>
? ? ? ?</td>
? ? ?</tr>
? ?</table></td>
<!-- body_text_eof //-->
? ?<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
? ?</table></td>
?</tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Edited by vintageland
Link to comment
Share on other sites

:D :) B) :P :D :P Yippeee!!!

 

This is a great contribution!! It works as advertised!!

 

Any chance that some one could explain to me how I might make a mod that would require that a minimum quantity of slave items be selected before checkout is allowed? I would like to sell assortments where each slave has a special price, but the stipulation is that you must purchase, for example, 36 items in whatever assortment you choose to get the "assortment price".

 

More about this contribution.......

 

I've been working with osCommerce and PHP for about 3 weeks. I had added price breaks by quantity and a few smaller contributions, so when I looked at this one, I thought. There is no way that I'll ever get this to work!!

 

I got it installed and working tonight in about 2.5 hours. Two things made a mod of this size possible. First, and most important, clearly marked modifications to the code. Second, the Beyond Compare tool. It is simply foolhardy to install any contribution without using beyond compare to see what needs to change.

 

If you see a line that's different in Beyond Compare, and Matt hasn't marked it, don't change it. It's not part of the contribution. [There are unmarked lines in admin/categories.php - discussed in this thread - Matti]

Edited by Johnson
Link to comment
Share on other sites

Hi,

 

this contrib looks like it could be used for graduated pricing? Do the slave products have definable weights, or do they inherit from the master? Apologies if I'm being dumb and I've missed the glaringly obvious :unsure:

 

 

Thanks,

Lee.

You can define individual weights to Slaves - they are just regular products with a Master assigned to them :P

 

Matti

Link to comment
Share on other sites

having a heck of a time of making sure the slave products only show on the master pages and i'm using easy populate:

 

using 2 easy_populate sheets to upload data: 1 master and 1 slave.

 

here's a stripped down version of each:

 

master easy populate sheet:

v_products_model v_products_name_1 v_products_master v_products_master_status v_products_listing_status

model1 Type A Printer 0 1 1

 

slave easy populate sheet:

v_products_model v_products_name_1 v_products_master v_products_master_status v_products_listing_status

part-1 Type A Printer 1 0 0

part-2 Type A Printer 1 0 0

part-3 Type A Printer 1 0 0

part-4 Type A Printer 1 0 0

 

i've sliced and diced all possible options to try and ensure that the slaves do not show on the Manufacturer page for Type A Printer, but to no avail. The slaves do show on the master page in my desired format.

 

any help on how to limit the slaves' display to only the masters' pages, would be great.

 

best,

Link to comment
Share on other sites

Hiya,

 

I've seen a similar question asked before, but I was wondering if anyone has come up with a usable solution:

 

Regadring search results - as it is now all slaves are shown and are linked to the slave products instead of to the master. At my page I sell lingerie, so let's say someone searches for "red super nice".. it then returns

 

"red super nice bra" (master), "red super nice bra size 1", "red super nice bra size 2" and "red super nice bra size 3".

 

In that case I would like it to show only the master product.

 

However, if someone searches for either "red super nice bra size 2" or for example the specific model number the size 2 bra has, it would have to show the slave product - but linking to the master product in the results.

 

Am I making any sense with this ? :)

 

Thanks :)

 

- Jesper

Link to comment
Share on other sites

This mod is awesome, after looking over it a second time, i noticed a few things to fix, but am stuck on a couple.

 

Shopping Cart Box on the top left:

Does anyone know how to make the slave products link back to the master product instead of its own?

 

For example if master product id = 28, when adding slave product id 29 to your shopping cart, the shopping cart box displays product id = 29, while if you look at the actual shopping cart when u click on cart contents it shows product id = 28.

 

Manufactuers Select Box:

 

When selecting on a manufactuer such as Matrox, and product is a slave and is shown in the product listing display, the thumbnail and product name links show the slave id while the buy now shows the master id. Anyone know how to make the thumbnail and text show master id instead of slave id?

 

For example slave product id = 30 and master id = 28 it'll show

 

Thumbnail = 30, product name = 30, buy now = 28

 

Thanks.

Link to comment
Share on other sites

This mod is awesome, after looking over it a second time, i noticed a few things to fix, but am stuck on a couple.

 

Shopping Cart Box on the top left:

Does anyone know how to make the slave products link back to the master product instead of its own?

 

For example if master product id = 28, when adding slave product id 29 to your shopping cart, the shopping cart box displays product id = 29, while if you look at the actual shopping cart when u click on cart contents it shows product id = 28.

 

Manufactuers Select Box:

 

When selecting on a manufactuer such as Matrox, and product is a slave and is shown in the product listing display, the thumbnail and product name links show the slave id while the buy now shows the master id. Anyone know how to make the thumbnail and text show master id instead of slave id?

 

For example slave product id = 30 and master id = 28 it'll show

 

Thumbnail = 30, product name = 30, buy now = 28

 

Thanks.

The simplest way to do this is from the product_info page, checking whether or not the product has a Master, and if it has then to display that - replacement catalog/product_info.php:

 

<?php
/*
?$Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

?osCommerce, Open Source E-Commerce Solutions
?http://www.oscommerce.com
?
?Copyright (c) 2003 osCommerce
?
?Master Products - JOHNSON - 22/02/2003 [email protected]

?Copyright (c) 2003 Suomedia - Dynamic Content Management

?Released under the GNU General Public License
*/

?require('includes/application_top.php');

?require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
?
//Master Products
$products_id == (int)$HTTP_GET_VARS['products_id'];
?$slave_check_query = tep_db_query ("select products_master from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
?$slave_check = tep_db_fetch_array($slave_check_query);
?if ($slave_check['products_master'] > 0) {
?$products_id = $slave_check['products_master'];
?} else {
?$products_id = (int)$HTTP_GET_VARS['products_id']; 
} 
?$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
?$product_check = tep_db_fetch_array($product_check_query);
//Master Products EOF ?
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
?window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
?<tr>
? ?<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
? ?</table></td>
<!-- body_text //-->
<!-- Master Products //-->
? ?<td width="100%" valign="top"><?php if ($product_master != 1) { ?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">
<!-- Master Products EOF //-->
<?php
?if ($product_check['total'] < 1) {
?>
? ? ?<tr>
? ? ? ?<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
? ? ? ? ?<tr class="infoBoxContents">
? ? ? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ? ?<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ?</tr>
? ? ? ? ? ?</table></td>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>
<?php
?} else {
//Master Products 

? ?$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, 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 = '" . $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
//Master Products EOF
? ?$product_info = tep_db_fetch_array($product_info_query);

? ?tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . $products_id . "' and language_id = '" . (int)$languages_id . "'");

? ?if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
? ? ?$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
? ?} else {
? ? ?$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
? ?}

? ?if (tep_not_null($product_info['products_model'])) {
? ? ?$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
? ?} else {
? ? ?$products_name = $product_info['products_name'];
? ?}
?>
? ? ?<tr>
? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
? ? ? ? ?<tr>
? ? ? ? ? ?<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
? ? ? ? ? ?<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td class="main">
<?php
? ?if (tep_not_null($product_info['products_image'])) {
?>
? ? ? ? ?<table border="0" cellspacing="0" cellpadding="2" align="right">
? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
? ? ? ? ? ? ?</td>
? ? ? ? ? ?</tr>
? ? ? ? ?</table>
<?php
? ?}
?>
? ? ? ? ?<p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
? ?$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $products_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
? ?$products_attributes = tep_db_fetch_array($products_attributes_query);
? ?if ($products_attributes['total'] > 0) {
?>
? ? ? ? ?<table border="0" cellspacing="0" cellpadding="2">
? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
? ? ? ? ? ?</tr>
<?php
? ? ?$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $products_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
? ? ?while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
? ? ? ?$products_options_array = array();
? ? ? ?$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $products_id . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
? ? ? ?while ($products_options = tep_db_fetch_array($products_options_query)) {
? ? ? ? ?$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
? ? ? ? ?if ($products_options['options_values_price'] != '0') {
? ? ? ? ? ?$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
? ? ? ? ?}
? ? ? ?}

? ? ? ?if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
? ? ? ? ?$selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
? ? ? ?} else {
? ? ? ? ?$selected_attribute = false;
? ? ? ?}
?>
? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
? ? ? ? ? ? ?<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
? ? ? ? ? ?</tr>
<?php
? ? ?}
?>
? ? ? ? ?</table>
<?php
? ?}
?>
? ? ? ?</td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
<?php
? ?$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . $products_id . "'");
? ?$reviews = tep_db_fetch_array($reviews_query);
? ?if ($reviews['count'] > 0) {
?>
? ? ?<tr>
? ? ? ?<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
<?php
? ?}

? ?if (tep_not_null($product_info['products_url'])) {
?>
? ? ?<tr>
? ? ? ?<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
<?php
? ?}

? ?if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
? ? ?<tr>
? ? ? ?<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
? ? ?</tr>
<?php
? ?} else {
?>
? ? ?<tr>
? ? ? ?<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
? ? ?</tr>
<?php
? ?}
?>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
? ? ? ? ?<tr class="infoBoxContents">
? ? ? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ? ?<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
<!-- Master Products //--> ? ? ?
<?php if ($product_master['product_master_status']!= 1) { ?> 
? ? ? ? ? ? ? ?<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td></form>
<?php
}
?> 
? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ?</tr>
? ? ? ? ? ?</table></td>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>
? ? ?
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>


<?php

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master = ?'" . $product_info['products_id'] . "'");
$results = tep_db_fetch_array($master_query);
if ($results['products_id'] != 0) { ?>

? <tr>
? ?<td align="left" class="main"> <?php echo TEXT_SLAVE_PRODUCTS; ?></td>
? </tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr> ? 
? <tr>
? ?<td><?php include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS); ?></td>
? </tr>
? 
<?php ? ?
?} 
? 
?>
<!-- Master Products EOF //--> ? ? ? 
? ? ?<tr>
? ? ? ?<td>
<?php
? ?if ((USE_CACHE == 'true') && empty($SID)) {
? ? ?echo tep_cache_also_purchased(3600);
? ?} else {
? ? ?include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
? ?}
?}
?>
? ? ? ?</td>
? ? ?</tr>
? ?</table></td>
<!-- body_text_eof //-->
? ?<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
? ?</table></td>
?</tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

In cataglog/includes/modules/master_products.php change:

 

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

 

to:

 

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

 

Matti

Edited by Johnson
Link to comment
Share on other sites

Thanks for the reply Johnson, i tried your product_info file along with the master_products modifications on a brand new oscommerce v2.2 MS2 with master products 1.1.2 and the outcome is still the same

 

When you click on cart contents,

 

the slave product shows thumbnail = 30 name = 30 and buy now = 28 (Master PRoduct)

 

Also the same goes for the shopping cart box on the top right

 

the slave product added shows products_id = 28.

 

Thanks again, hope I can get this fixed soon, cause my slave products are only 10 word descriptions, and the master product has all the description.

Link to comment
Share on other sites

Thanks for the reply Johnson, i tried your product_info file along with the master_products modifications on a brand new oscommerce v2.2 MS2 with master products 1.1.2 and the outcome is still the same

 

When you click on cart contents,

 

the slave product shows thumbnail = 30 name = 30 and buy now = 28 (Master PRoduct)

 

Also the same goes for the shopping cart box on the top right

 

the slave product added shows products_id = 28.

 

Thanks again, hope I can get this fixed soon, cause my slave products are only 10 word descriptions, and the master product has all the description.

Yes, that is their correct product_id - but did you try clicking on them? The page will open at the Master Product :D

 

Matti

Link to comment
Share on other sites

Matti,

 

I need to make a Master_Product Like a catagorie with dozens of individual products under it. And I need it to show in the catagorie box in a tree. Is this possible????? Is it possible to only show master_products and not slaves in the New Products for February Box???

 

Thanks

Link to comment
Share on other sites

Thanks for the reply Johnson, i tried your product_info file along with the master_products modifications on a brand new oscommerce v2.2 MS2 with master products 1.1.2 and the outcome is still the same

 

When you click on cart contents,

 

the slave product shows thumbnail = 30 name = 30 and buy now = 28 (Master PRoduct)

 

Also the same goes for the shopping cart box on the top right

 

the slave product added shows products_id = 28.

 

Thanks again, hope I can get this fixed soon, cause my slave products are only 10 word descriptions, and the master product has all the description.

Yes, that is their correct product_id - but did you try clicking on them? The page will open at the Master Product :D

 

Matti

Ok, this rocks! I think I have everything fixed now!

Link to comment
Share on other sites

Matti,

 

I need to make a Master_Product Like a catagorie with dozens of individual products under it. And I need it to show in the catagorie box in a tree. Is this possible????? Is it possible to only show master_products and not slaves in the New Products for February Box???

 

Thanks

theres a way, i posted a msg a few pages ago where other volunteers had fixed this problem, and I have tested it and it works, as long as you put your slave products as hidden.

Link to comment
Share on other sites

I am not clear on this 'HIDDEN' thing. Will they or will they not show up when you choose the product_master???

There are radio select buttons on the admin->product edit page - these will flag the slave as to whether or not to show it.

 

Matti

Link to comment
Share on other sites

Can anyone help????

What would it take to add a check box to master products so you could turn on or off displaying in catalog/includes/modules/new_products.php.

 

I suppose this is unclear. This is what I am trying to accomplish..

 

New Products for (month) box: No Catagories, No Master Products, just products and slave products...

 

And Master products listed in Catagories Box...

Link to comment
Share on other sites

Mike, around lines 20-4 of includes/modules/new_products.php, try changing

  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 products_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' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

to

  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 products_status = '1' and p.products_master_status = '0' 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_master_status = '0' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

this should make only non-master products display IIRC.

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...