Jump to content
Johnson

Master Products - MS2

Recommended Posts

If I set it to 1, then I get a QTY drop down box when viewing the article + the slaves under neith?!?

Share this post


Link to post
Share on other sites

Ryan - thanks for the effort you are putting into this - if you like, pm me and we can go through the files together and try and get this working :)

 

Matti


Matti Ressler

 

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

_____

Share this post


Link to post
Share on other sites

nelson - set the price of your master product to 0.


Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Share this post


Link to post
Share on other sites
Hello everybody

 

I would like to know how Is it possible to have a master product in slave and a slave product in master in the same time for an OSC2.2MS2FR

 

For example:

I have a master product digital camera with slave an USB cable and a Stands.

It work well

 

But now

when I go to the Stand I would like to have the digital camera in slave.

 

I want to know what,where and wich files can I modify in order order to have a link to my product in the Slave Box Product

 

Best Regards

You are better to use the Family Products contribution.

 

Matti


Matti Ressler

 

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

_____

Share this post


Link to post
Share on other sites

Can some please tell me how to add attributes to my slave products. I have added them but they don't show up on the page. Thanks.

Share this post


Link to post
Share on other sites
Can some please tell me how to add attributes to my slave products. I have added them but they don't show up on the page. Thanks.

Master Products does not support this at the moment - if you read the last few pages of this thread you will see it is being worked on :)

 

Matti


Matti Ressler

 

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

_____

Share this post


Link to post
Share on other sites

I know that this has been posted before - but I have not seen an answer yet.

 

Does anyobody have any idea how to make it so that when doing a search for a slave - results will bring you to the master item?

 

Or for that matter ... I'd like it so that when I click on a slave items link anywhere in the catalog, it brings me to the master item. This way I could sort my slaves out into different categories that are related - but it would always bring you back to the master. <_<

Share this post


Link to post
Share on other sites

I have been searching high and low for an answer to this question.

 

How do I limit the selection in the drop down box for quantity to purchase on a slave product? Currently, I have 250 tickets to a particular event. I want to limit one ticket per purchase, so the drop down should only allow for '0' and '1'. Currently, the slave product will allow for 0 to 20 to be purchased.

 

Any idea where I would change that in the code? I would image it is in the product_info.php.

 

Thanks!

 

Mark Bianchi

Dayon, OH

Share this post


Link to post
Share on other sites
How do I limit the selection in the drop down box  for quantity to purchase on a slave product?  Currently, I have 250 tickets to a particular event.  I want to limit one ticket per purchase, so the drop down should only allow for '0' and '1'.  Currently, the slave product will allow for 0 to 20 to be purchased. 
Around lines 170 and 179 of includes/modules/master_listing.php, change code that looks like
            $lc_text = tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $qty_array);

to something that looks like

            $lc_text = tep_draw_checkbox_field('Qty_ProdId_' . $listing['products_id'], '1');

This will change it to a checkbox instead of a pull down menu. Checked means purchasing 1. You could also replace the 20s in the code with 1s and get a drop down menu like you describe.

 

Hth,

Matt


Always back up before making changes.

Share this post


Link to post
Share on other sites
I know that this has been posted before - but I have not seen an answer yet.

 

Does anyobody have any idea how to make it so that when doing a search for a slave - results will bring you to the master item?

The SQL changes posted by ecartz a couple of pages back in this thread worked for me. The only exception being certain price based searches (also described earlier in the thread), which I can live with.

Share this post


Link to post
Share on other sites

One other issue:

 

Using Master Products, I order one of my slave products. I am already logged in as a customer. I place an item in the cart and click on the CHECKOUT button. I am then directed back to the login.php page. The system somewhere lost track of the fact that I was already logged in.

 

Any idea why this might be?

 

Thanks!

 

 

Mark Bianchi

Dayton, OH

Share this post


Link to post
Share on other sites

Also, once I login, it says my shopping cart is empty. Vicious cycle!

 

Thanks for any help.

 

Mark

Edited by mbianchi

Share this post


Link to post
Share on other sites
Also, once I login, it says my shopping cart is empty. Vicious cycle!

Doh! Nevermind. This is a brand new cart that I put together and I had an errror in the cookie settings in the config.php file. I have a separate secure server from my catalog server and I was not pointing the the secure server for my secure cookies. Will getcha everytime! :rolleyes:

 

 

Mark

Share this post


Link to post
Share on other sites

Hi all.

 

I've successfully implemented attributes into this Master Products contrib.

 

Before I get into the code I would like to point out that I haven't included language support for the column heading or an admin option to control sort order for this column. These are trivial things which can easily be added once all wrinkles are ironed out.

 

Add to catalog/includes/modules/master_products.php at the top where the $slave_list array is being built (note the sort order is currently hard coded, as mention above):

'MASTER_LIST_OPTIONS' => 8,

 

Add to catalog/includes/modules/master_listing.php in the switch statement for the column heading:

      case 'MASTER_LIST_OPTIONS':
       $lc_text = 'Options';
       $lc_align = 'align="center"';
       break;

 

Add to catalog/includes/modules/master_listing.php in the switch statement for the slave details:

          case 'MASTER_LIST_OPTIONS':

           $lc_align = 'align="center"';
	 $lc_text = '';
           ///////////////////////////////////////////////////////////////////////////
           // BOF: attribute options
           $opt_count=0;
           $products_options_name = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'" . " order by popt.products_options_sort_order");
           while ($products_options_name_values = tep_db_fetch_array($products_options_name)) {
             $opt_count++;
             $selected = 0;
             $products_options_array = array();
             $lc_text .= '<b>' . $products_options_name_values['products_options_name'] . '</b><br />' . "\n";
           // BOF: WebMakers.com Added: Attributes Copy and Sort
             if ( PRODUCTS_OPTIONS_SORT_BY_PRICE !='1' ) {
               $products_options = tep_db_query("select pa.products_options_sort_order, pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_stock from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing['products_id'] . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'" . " order by pa.products_options_sort_order, pov.products_options_values_name");
             } else {
               $products_options = tep_db_query("select pa.products_options_sort_order, pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_stock from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing['products_id'] . "' and pa.options_id = '" . $products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'" . " order by pa.products_options_sort_order, pa.options_values_price");
             }
           // EOF: WebMakers.com Added: Attributes Copy and Sort
             while ($products_options_values = tep_db_fetch_array($products_options)) {
               if(STOCK_CHECK == 'false' || $products_options_values['products_stock']>0) {
                 $products_options_array[] = array('id' => $products_options_values['products_options_values_id'], 'text' => $products_options_values['products_options_values_name'], 'style' => '');
               } else {
                 $products_options_array[] = array('id' => $products_options_values['products_options_values_id'], 'text' => $products_options_values['products_options_values_name'], 'style' => 'style="color: red"');
                 $product_info['products_quantity'] = 0;
               }
               if ($products_options_values['options_values_price'] != '0') {
                 $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options_values['price_prefix'] . $currencies->display_price($products_options_values['options_values_price'], tep_get_tax_rate($product_info_values['products_tax_class_id'])) .') ';
               }
             }
             $lc_text .= tep_draw_attrib_pull_down_menu('id_'.$listing['products_id'].'[' . $products_options_name_values['products_options_id'] . ']', $products_options_array);
             $lc_text .= '<br />';
           }
           if($opt_count==0) {
             $lc_text = 'None';
           }
           // EOF: attribute options
           ///////////////////////////////////////////////////////////////////////////

           break;

Note: My store uses the attribute sort contrib which adds a "sort" field to TABLE_PRODUCTS_ATTRIBUTES. This is basically a tweeked version of what exists in product_info.php

 

And finally replace the 'add_slave' branch of the switch statement in catalog/includes/application.php with:

      //Master Products
     // customer adds multiple products from the master_listing page
     case 'add_slave' :
                             while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {
                               if (substr($key,0,11) == "Qty_ProdId_") {
                                 $prodId = substr($key,11);
                                 $qty = $val;
                                 if(isset($_POST["id_$prodId"]) && is_array($_POST["id_$prodId"])) {
                                   // We have attributes
                                   $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$_POST["id_$prodId"]))+$qty, $_POST["id_$prodId"]);
                                 } else {
                                   // No attributes
                                   $cart->add_cart($prodId, $cart->get_quantity($prodId)+$qty);
                                 }
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
     //Master Products EOF

 

I have tested this on my store and it appears pretty solid and has now been added to my live store. Brave or what?

 

Regards,

Brian.

Share this post


Link to post
Share on other sites
I know that this has been posted before - but I have not seen an answer yet.

 

Does anyobody have any idea how to make it so that when doing a search for a slave - results will bring you to the master item?

The SQL changes posted by ecartz a couple of pages back in this thread worked for me. The only exception being certain price based searches (also described earlier in the thread), which I can live with.

Thanks Matt... since I don't have price based searches from my search box that shouldn't be much of a problem for me. I musta missed that post as I was scanning through all 64 pages of this thread :) I'll check it out. Thanks for your reply!

 

Baj3171 ... that should be increadibly useful for a ton of people... excellent work!

Share this post


Link to post
Share on other sites

Brian, nice work on the slave attributes. I am currently trying to get it to work the way I want it to and have run into a problem. I need to also have a text attribute where the customer will enter the ring size. I can get the text box to show up and the name of the text box to show in the cart but I can't get the value of the text box. here is the code that adds the text box so far:

 

case 'MASTER_LIST_SIZE':
$lc_align = 'center';
$lc_text = '';

$products_options_name = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_length from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and popt.products_options_name = 'Ring Size' and patrib.options_id = popt.products_options_id and popt.language_id = 1");

$products_options_name_values = tep_db_fetch_array($products_options_name); 

$lc_text = '<input type="text" name="id_' . $listing['products_id'] . '[' . $products_options_name_values['products_options_id'] . ']" size="' . $products_options_name_values['products_options_length'] .'" maxlength="' . $products_options_name_values['products_options_length'] . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .'">';

break;

 

Got any ideas?


If I was crafty, this would be a funny signature.

Share this post


Link to post
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 matti@suomedia.com

?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

When i try this. The "add to shopingcart"-picture are listed two times.

 

Anyone who know what to do?

Share this post


Link to post
Share on other sites

Brian, excellent work!

Note: My store uses the attribute sort contrib which adds a "sort" field to TABLE_PRODUCTS_ATTRIBUTES. This is basically a tweeked version of what exists in product_info.php

If I don't have this sort contrib installed will your mod work? Or must I

a) install the sort mod.

B) it would suffice to add the "sort" field.

 

joe

Share this post


Link to post
Share on other sites

It turned out to really simple to use the master product as a way of buying the complete set (no attributes). I didn't use bundles in the end

 

With the latest version it is possible to buy the master product.

I changed the stock update so that it updates the stock of the slaves instead of the master (very minor change).

Another small change was to show the saving when buying the complete set (in a similar way to Specials)

 

* Still to do *

new button that clearly says 'Buy the Set'

Stock check in shopping cart

Share this post


Link to post
Share on other sites
Brian, nice work on the slave attributes.  I am currently trying to get it to work the way I want it to and have run into a problem.  I need to also have a text attribute where the customer will enter the ring size.  I can get the text box to show up and the name of the text box to show in the cart but I can't get the value of the text box.  here is the code that adds the text box so far:

 

case 'MASTER_LIST_SIZE':
$lc_align = 'center';
$lc_text = '';

$products_options_name = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_length from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and popt.products_options_name = 'Ring Size' and patrib.options_id = popt.products_options_id and popt.language_id = 1");

$products_options_name_values = tep_db_fetch_array($products_options_name); 

$lc_text = '<input type="text" name="id_' . $listing['products_id'] . '[' . $products_options_name_values['products_options_id'] . ']" size="' . $products_options_name_values['products_options_length'] .'" maxlength="' . $products_options_name_values['products_options_length'] . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .'">';

break;

 

Got any ideas?

Ryan

 

Try replacing

$cart->contents[$HTTP_GET_VARS['products_id']]

With

$cart->contents[$listing['products_id']]

 

Brian.

Share this post


Link to post
Share on other sites
Brian, excellent work!
Note: My store uses the attribute sort contrib which adds a "sort" field to TABLE_PRODUCTS_ATTRIBUTES. This is basically a tweeked version of what exists in product_info.php

If I don't have this sort contrib installed will your mod work? Or must I

a) install the sort mod.

B) it would suffice to add the "sort" field.

 

joe

Joe

 

You could but you would have to alter some of your admin scripts to cater for the extra field. I believe replacing step 3 with the following will work with a stock OSC ms2 build:

         case 'MASTER_LIST_OPTIONS':

          $lc_align = 'align="center"';
 $lc_text = '';
          ///////////////////////////////////////////////////////////////////////////
          // BOF: attribute options
          $opt_count=0;
          $products_options_name = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'" . " order by popt.products_options_sort_order");
          while ($products_options_name_values = tep_db_fetch_array($products_options_name)) {
            $opt_count++;
            $products_options_array = array();
            $lc_text .= '<b>' . $products_options_name_values['products_options_name'] . '</b><br />' . "\n";
               $products_options = 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_values = tep_db_fetch_array($products_options)) {
               $products_options_array[] = array('id' => $products_options_values['products_options_values_id'], 'text' => $products_options_values['products_options_values_name'], 'style' => '');
               if ($products_options_values['options_values_price'] != '0') {
                 $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options_values['price_prefix'] . $currencies->display_price($products_options_values['options_values_price'], tep_get_tax_rate($product_info_values['products_tax_class_id'])) .') ';
               }
             }
            $lc_text .= tep_draw_attrib_pull_down_menu('id_'.$listing['products_id'].'[' . $products_options_name_values['products_options_id'] . ']', $products_options_array);
            $lc_text .= '<br />';
          }
          if($opt_count==0) {
            $lc_text = 'None';
          }
          // EOF: attribute options
          ///////////////////////////////////////////////////////////////////////////

          break;

Brian.

Share this post


Link to post
Share on other sites

Brian that didn't work either, in my shopping cart I dont get either the number entered or the attribute name, though I do get the - that says something is supposed to be there. This is what I get for the html source code:

<input type="text" name="id_206[3]" size="4" maxlength="4" value="">

 

Thanks


If I was crafty, this would be a funny signature.

Share this post


Link to post
Share on other sites
Brian that didn't work either, in my shopping cart I dont get either the number entered or the attribute name, though I do get the - that says something is supposed to be there.  This is what I get for the html source code:

<input type="text" name="id_206[3]" size="4" maxlength="4" value="">

 

Thanks

Ryan

 

Looking at the code in catalog/include/classes/shopping_cart.php it uses key

['attributes']

not

['attributes_values']

to store attribute data. So if you change it from

$cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values']

to

$cart->contents[$listing['products_id']]['attributes']

Brian.

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

×