Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Master Products - MS2


Guest

Recommended Posts

I understand that Master Products can prevent a Master from appearing in What's New, Categories, All Products, etc. But how do I keep Slave products from showing up in these places. In other words, I only want my Master to show up. Any way of doing that?

 

Thanks!

 

Mark Bianchi

Dayton, OH

Link to comment
Share on other sites

includes/modules/new_products.php

 

products_listing_status='1' is inserted into the 2 lines below.

 

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

// BoF Master Products 1.1.5

$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_listing_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

// EoF Master Products 1.1.5

} else {

// BoF Master Products 1.1.5

$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);

// EoF Master Products 1.1.5

}

Link to comment
Share on other sites

Hello, I'm having a problem with some broken buttons that I suspect is Master Products related:

 

My 'Buy Now' buttons do not carry the product id in their link, resulting in a 'product not found' when you click Buy Now. This happens ONLY on search results and 'list by manufacturer' results.

 

Also, my Add to Cart buttons seem to be broken on everything, in the sense that the item is not added to the cart, but you will be taken to the cart when you click it.

 

Please help, I have to go live with this thing soon!

 

thanks,

 

Greg.

Link to comment
Share on other sites

includes/modules/new_products.php

 

products_listing_status='1' is inserted into the 2 lines below.

 

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

// BoF Master Products 1.1.5

$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_listing_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

// EoF Master Products 1.1.5

} else {

// BoF Master Products 1.1.5

$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);

// EoF Master Products 1.1.5

}

Hey Talon.

 

Thanks! Your example was quite helpful! I put the code into products_new.php and it did the trick. Here is all I added to the following line: p.products_listing_status = '1' (see below)

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, 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";

 

Thanks for your help!

 

Mark Bianchi

Dayton, Ohio

Link to comment
Share on other sites

I can't get the slave products to display in the shopping cart. I've installed 1.1.5 and have overwritten all the files and executed the master.sql and yet, everytime I add a product it says shopping cart empty.

 

A time, I added a slave product but quantity didn't go through and it displayed the master product, not the slave in the shopping cart.

 

Any ideas? As I said, I overwrote all files and havn't changed anything in OSC.

 

Yurik

Link to comment
Share on other sites

Hi all,

 

I have installed master products and it looks great, good work guys.

 

I have just one question that I have failed to find the answer to in all 70+ pages which surpises me.

 

I want the Master to have a price but not be available to buy. I know that if I set the price to 0 then the Add to Cart option is removed then no price display on the product listing page. (I want the slaves hidden).

 

The actual situation is that I to sell plates with different patterns. Hence I want a 6" Plate (priced say ?5) as a master product and the slaves would be Blue, Green, Red, but all at the same price so it would be good if this price was listed as the Master Price.

 

I guess I could do this with the standard OS attribute system but then I cannot have an image of each plate pattern and I cannot have a Qty select box.

 

Any ideas? Apologies if this has been covered, I have tried my damndest to find it (about 3 days looking!)

 

Cheers,

 

Richard.

Only Dead Fish Go With The Flow......

Link to comment
Share on other sites

I want the Master to have a price but not be available to buy.

The simplest way is to leave the product price at zero and put a price in the product description :)

 

Matti

Link to comment
Share on other sites

I can't get the slave products to display in the shopping cart. I've installed 1.1.5 and have overwritten all the files and executed the master.sql and yet, everytime I add a product it says shopping cart empty.

 

A time, I added a slave product but quantity didn't go through and it displayed the master product, not the slave in the shopping cart.

 

Any ideas? As I said, I overwrote all files and havn't changed anything in OSC.

 

Yurik

There is a solution to this a few pages back :P

 

Matti

Link to comment
Share on other sites

Cheers for the reply Matti,

 

You are absolutley right this is the quickest and easiest method and I will use it.

 

Now one final quick question before I implement it on my live site - I now have drop down boxes for quantities on all my product_info pages! (I want them for my new slaves but do not want them for all my originally entered non master/slave products).

 

Is this due to a correct installation of master products and intentional on your part or have I goofed somewhere along the line?

 

Cheers again, this really is a great mod and just what I was looking for.

 

Richard.

Only Dead Fish Go With The Flow......

Link to comment
Share on other sites

Cheers for the reply Matti,

 

You are absolutley right this is the quickest and easiest method and I will use it.

 

Now one final quick question before I implement it on my live site - I now have drop down boxes for quantities on all my product_info pages! (I want them for my new slaves but do not want them for all my originally entered non master/slave products).

 

Is this due to a correct installation of master products and intentional on your part or have I goofed somewhere along the line?

 

Cheers again, this really is a great mod and just what I was looking for.

 

Richard.

It was intentional :)

 

Matti

Link to comment
Share on other sites

Matti,

 

Thanks again for the quick reply,

 

I know your a busy guy and working hard on the next release but is there any quick and easy fix to remove this dropdown quantity box for the product_info pages?

 

I know that plenty of people want master products to do everything under the sun but in my case it is perfect apart from having changed my product_info pages!!

 

If it aint easy dont worry, I am sure I will be able to bludgeon a crude fix myself, just might take a bit of time, and I can see from this monster thread how much time you have already put into this mod and I dont want to distract your present plans, thanks again for your work,

 

Cheers,

Richard.

Only Dead Fish Go With The Flow......

Link to comment
Share on other sites

I know your a busy guy and working hard on the next release but is there any quick and easy fix to remove this dropdown quantity box for the product_info pages?

Yes, I am :P

 

Removing it has a problem - you would either have the Master added to the cart each time something is added to the cart, or the Master could not be added at all.

 

The only other option is to make it an input field (I don't like this, but many do):

 

 ? ? ?<tr>
? ? ? ?<td align="right" class="main"><?php if ($product_info['products_quantity'] > 0) {
? ? ?echo TEXT_QUANTITY . '  ' . tep_draw_input_field('Qty_ProdId_' . $product_info['products_id'], '', 'size="3" maxlength="10"'); 
? ? ?} elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) {
? ? ?	$qty_array = array();
? ? ? ? ? ?for ($i=0; $ns = 20, $i <= $ns; $i++) {
? ? ? ? ? ?$qty_array[] = array('id' => $i, 'text' => $i); 
? ? ? ?} ? ? 
? ? ?echo TEXT_QUANTITY . '  ' . tep_draw_input_field('Qty_ProdId_' . $product_info['products_id'], '', 'size="3" maxlength="10"');
? ? ?} else {
? ? ?echo TEXT_STOCK;
}
echo tep_draw_separator('pixel_trans.gif', '30', '10');
?>
? ? ? ?</td>
? ? ?</tr>

 

Matti

Edited by Johnson
Link to comment
Share on other sites

Matti,

 

Your a goddamn superstar! Don't know if this is really going to suit me but I sincerely appreciate your reply all the same.

 

After playing with things this afternoon I was coming to the same realisation,

 

Removing it has a problem - you would either have the Master added to the cart each time something is added to the cart, or the Master could not be added at all.

 

I just thought I must have been missing something.

 

Given that this is the case I will try your new suggestion (tomorrow!).

 

I know Master Products will work for me, just gotta bend it the right way.

 

Again, I thank you not just for your replies today, but all the work you have done to date,

 

Cheers,

Richard

Only Dead Fish Go With The Flow......

Link to comment
Share on other sites

OK,

 

Forgive me, its been along day...

 

you would either have the Master added to the cart each time something is added to the cart, or the Master could not be added at all.

 

I have just realised, that the Master not being added at all is exactly what I am after!!

 

Is this easily implemented? If so, how?

 

Cheers,

Richard.

Only Dead Fish Go With The Flow......

Link to comment
Share on other sites

OK,

 

Forgive me, its been along day...

 

you would either have the Master added to the cart each time something is added to the cart, or the Master could not be added at all.

 

I have just realised, that the Master not being added at all is exactly what I am after!!

 

Is this easily implemented? If so, how?

 

Cheers,

Richard.

If you give the Master Product a zero dollar value the drop menu will not appear, so it cannot be added to the cart - if you need to display a price, put it in the product description :)

 

Matti

Link to comment
Share on other sites

Sorry Matti,

 

Maybe I am not being too clear.

 

I understand about the zero price on the master product and that works great. It is on all my previously added products that I have the problem.

 

On my current live setup I just have the add to cart button with no quantity drop down box. Now that I have added Master Products ALL my products have the drop down box and that is what I dont want.

 

To clarify, if a product is a master product with slaves, I do not want the master to be purchasable and I do want the slaves to have the drop down quantity boxes, so your above suggestion of no master product price is perfect.

 

However, if I have a stand alone product, ie it is not a master and has no slaves, like all my products prior to using the master product mod, I would like it just to have the Add To Cart button with no quantity select. Just as it is on a clean OS install.

 

Sorry if this is getting difficult to explain, I still believe there must be a simple solution - I just want the master products mod to apply to the products I choose.

 

Cheers,

Richard

 

(I am still wondering if I have installed correctly? If a product is not a master or a slave should it still aquire this drop down quantity box?)

Only Dead Fish Go With The Flow......

Link to comment
Share on other sites

(I am still wondering if I have installed correctly?? If a product is not a master or a slave should it still aquire this drop down quantity box?)

Yes - it sounds like you have it working as it should.

 

This should do what you want:

 

<?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 - 05/07/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);

?$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);
?>
<!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 //-->
<?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) { ?>
?> ? ?	
? ?<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
}
// Master Products EOF
?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_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 . "'");
//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>
? ? ? ? ? ?<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='" . (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
? ?}
//Master Products ? ?
? ?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
? ?} ? ?
?>
? ? ?</tr>
? ? ? <tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr> ? ? 
<?php
? if (($product_info['products_price'] > 0) && ($product_info['products_master_status']== '1')) {
?
? $qty_array = array();
?
? for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {
? 
? $qty_array[] = array('id' => $i, 'text' => $i); 
}
?>
? ? <tr>
? ? ? <td align="right" class="main"><?php if ($product_info['products_quantity'] > 0) {
? ? echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array); 
? ? } elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) {
? ? ?$qty_array = array();
? ? ? ? ? for ($i=0; $ns = 20, $i <= $ns; $i++) {
? ? ? ? ? $qty_array[] = array('id' => $i, 'text' => $i); 
? ? ? } ? ? 
? ? echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);
? ? } else {
? ? echo TEXT_STOCK;
}
echo tep_draw_separator('pixel_trans.gif', '30', '10');
?>
? ? ? </td>
? ? </tr>
<?php
}
?> ?
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></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 ($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>
<?php

if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) { ?>

? <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 ? ?
?} 
}
?>
? ? ?<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>
<?php ?if ($reviews['count'] > 0) { ?> ? ? ? ? ? ? ? 
? ? ? ? ? ? ? ?<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>
<?php
}
?> ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ?<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>
? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
? ? ? ? ? ? ?</tr>
? ? ? ? ? ?</table></td>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>
? ? ?<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>
<!-- Master Products EOF //--> ? ?
<!-- 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'); ?>

 

*edit* - posted the wrong file - this one's ok

 

Matti

Edited by Johnson
Link to comment
Share on other sites

Matti,

 

You are the greatest!

 

That works a treat and does exactly what I want it to.

 

To be honest, I am very surpised this has not been covered already - still, I guess everyones needs are slightly different.

 

Cheers again for your help. (I will let you get back to work now) :P

 

Richard.

Only Dead Fish Go With The Flow......

Link to comment
Share on other sites

hello

i just install the Master Products - MS2 v1. Great Job Mr. Johnson. how i can assign a product as a slave to master product?.

thanks

pj

'Johnson' is my forum handle - from 'Dick Johnson' a famous Australian touring car driver (I am a fan :P ) - so its 'Mr Ressler' :D

 

To assign Slaves to a Master you must first create a Master - then a drop menu will appear on the product edit page in admin from which you can select the Master for the product you wish to be a Slave.

 

Matti

Link to comment
Share on other sites

Hi again,

 

I asked this a couple of pages back, but no one picked up on it, so I persist :).

 

A small piece of MP code is breaking my buy it now and add to cart buttons. The problem is in product_listing.php and looks like this:

 

//Master Products

if ($listing['products_master_status'] != '1' && $listing['products_master'] == '0') {

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

} elseif ($listing['products_master'] != '0') {

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_master']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

} else {

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

}

//Master Products EOF

 

whereas the original part is just this line:

 

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

 

In my store, that modification to the product listing causes my buy it nows to not build their links properly. The links are there, but they cut off at "...products_id=", and I can only guess that something similar happens to my add to carts. I've gone through every MP file with Beyond Compare, and know I made all the necessary changes for the install. Why would this part be messing me up?

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...