Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Guest

Master Products - MS2

Recommended Posts

Hi,

 

I have searched and tried and seached more and tried again, but there´s no chance to get Mater Products with QPBPP (Quantity Price Break Per Product) work.

I wanns put the Price Breaks Table instead of the regular price in the slave tables. I don´t need Price Breaks for Master Products.

Please, can anybody help me to inplement these things?

 

Thanks a lot

 

Phil

Share this post


Link to post
Share on other sites

Image enlargement on slave product

 

Has anyone been able to add a "pop-up" enlargement to the image for a slave product in the list of slave products and if so can you give me any idea as to where is the right place.

 

Thanks

Share this post


Link to post
Share on other sites

Hey guys,

 

I'm a bit confused. I am trying to figure out why I don't see my product options next to my slave products on the product_info.php page. I believe the issue is in the includes/modules/master_listing.php file, but I can't seem to figure out what the issue is. I do have a print command that is showing me everything for each slave except for the options :blink:

 

You can see the page at tcdataweb dot com/MMHTest/gentle-birth-formula-p-128.html

 

I have options showing on my category page (only one product currently has options which is the Gentle Birth Formula, so you have to scroll down to see it - sorry) here: tcdataweb dot com/MMHTest/womens-health-pregnancy-c-1_17.html Unfortunately, if you click the buy now button it just takes you to the product_info page (above) and you can't select the option there. :(

 

It doesn't show up on the shopping cart page either. Any ideas? Is the master_listing.php file the file I should be trying to find the problem in? I do have SPPC and STS (amongst many others) installed.

 

here is my master_listing.php code:

<?php
/*
 $Id: master_listing.php

 adapted for Separate Pricing Per Customer v4.1x, Hide products and categories from groups 2006/05/28

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Master Products MS2  - JOHNSON - 05/07/2003 matti@suomedia.com

 Copyright (c) 2003 Suomedia - Dynamic Content Management

 Released under the GNU General Public License
*/

 $listing_split = new splitPageResults($master_sql, MAX_DISPLAY_SEARCH_RESULTS, 'products_master');

 if ( ($listing_split->number_of_rows > 0) && ( (MASTER_PREV_NEXT_BAR_LOCATION == '1') || (MASTER_PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }

 $list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
switch ($column_list[$col]) {
  case 'MASTER_LIST_MODEL':
	$lc_text = TABLE_HEADING_MODEL;
	$lc_align = '';
	break;
  case 'MASTER_LIST_NAME':
	$lc_text = TABLE_HEADING_PRODUCTS;
	$lc_align = '';
	break;
  case 'MASTER_LIST_DESCRIPTION':
	$lc_text = TABLE_HEADING_DESCRIPTION;
	$lc_align = 'center';
	break;
  case 'MASTER_LIST_QUANTITY':
	$lc_text = TABLE_HEADING_QUANTITY;
	$lc_align = 'right';
	break;
  case 'MASTER_LIST_PRICE':
	$lc_text = TABLE_HEADING_PRICE;
	$lc_align = 'right';
	break;
  case 'MASTER_LIST_ATTRIBUTES':
	$lc_text = TABLE_HEADING_ATTRIBUTES;
	$lc_align = 'center';
	break;				
  case 'MASTER_LIST_MANUFACTURER':
	$lc_text = TABLE_HEADING_MANUFACTURER;
	$lc_align = '';
	break;
  case 'MASTER_LIST_WEIGHT':
	$lc_text = TABLE_HEADING_WEIGHT;
	$lc_align = 'right';
	break;
  case 'MASTER_LIST_IMAGE':
	$lc_text = TABLE_HEADING_IMAGE;
	$lc_align = 'center';
	break;
  case 'MASTER_LIST_BUY_NOW':
	$lc_text = TABLE_HEADING_BUY_NOW;
	$lc_align = 'center';
	break;
  case 'PRODUCT_SORT_ORDER':
	$lc_text = TABLE_HEADING_PRODUCT_SORT;
	$lc_align = 'center';
	break;
  case 'MASTER_LIST_OPTIONS':
	$lc_text = TABLE_HEADING_OPTIONS;
	$lc_align = 'align="center"';
	break;
}

if ( ($column_list[$col] != 'MASTER_LIST_BUY_NOW') && ($column_list[$col] != 'MASTER_LIST_IMAGE') && ($column_list[$col] != 'MASTER_LIST_MULTIPLE') && ($column_list[$col] != 'MASTER_LIST_DESCRIPTION') && ($column_list[$col] != 'MASTER_LIST_OPTIONS') ) {
  $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
}

$list_box_contents[0][] = array('align' => $lc_align,
								'params' => 'class="productListing-heading"',
								'text' => ' ' . $lc_text . ' ');
 }

 if ($listing_split->number_of_rows > 0) {

$rows = 0;
$master_query = tep_db_query($listing_split->sql_query);
// BOF Separate Pricing per Customer
 $no_of_listings = tep_db_num_rows($master_query);
  global $sppc_customer_group_id;
// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
$customer_group_id = $sppc_customer_group_id;
}

while ($_listing = tep_db_fetch_array($master_query)) {
// let's start with default settings, you never know
$_new_listing = array_merge((array)$_listing , (array)$default_settings);
$listing[] = $_new_listing;
$list_of_prdct_ids[] = $_listing['products_id'];
}
// next part is a debug feature, when uncommented it will print the info that this module receives

 echo '<pre>';
print_r($listing);
echo '</pre>'; 

$select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
if ($no_of_listings > 1) {
for ($n = 1; $n < count($list_of_prdct_ids); $n++) {
$select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";
}
}
// BOF SPPC Hide products and categories from groups
 $master_sql .= " and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 ";
 $master_sql .= " and find_in_set('".$customer_group_id."', c.categories_hide_from_groups) = 0 ";
// EOF SPPC Hide products and categories from groups

// get all product prices for products with the particular customer_group_id
// however not necessary for customer_group_id = 0
if ($customer_group_id != '0') {
$pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."' ");
//   $no_of_pg_products = tep_db_num_rows($pg_query);
 while ($pg_array = tep_db_fetch_array($pg_query)) {
 $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '', 'final_price' => $pg_array['price']);
 }
for ($x = 0; $x < $no_of_listings; $x++) {
// replace products prices with those from customers_group table
 if(!empty($new_prices)) {
	for ($i = 0; $i < count($new_prices); $i++) {
	if( $listing[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
	$listing[$x]['products_price'] = $new_prices[$i]['products_price'];
	$listing[$x]['final_price'] = $new_prices[$i]['final_price'];
	}
	}

} // end if(!empty($new_prices)
$listing[$x]['specials_new_products_price'] = ''; // makes sure that a retail specials price doesn't carry over to another customer group
$listing[$x]['final_price'] = $listing[$x]['products_price']; // final price should not be the retail special price
  } // end for ($x = 0; $x < $no_of_listings; $x++)
} // end if ($customer_group_id != '0')

// an extra query is needed for all the specials

$specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id. "'");
while ($specials_array = tep_db_fetch_array($specials_query)) {
$new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']);
}

// add the correct specials_new_products_price and replace final_price
for ($x = 0; $x < $no_of_listings; $x++) {
  if(!empty($new_s_prices)) {
  for ($i = 0; $i < count($new_s_prices); $i++) {
if( $listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
  $listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price'];
  $listing[$x]['final_price'] = $new_s_prices[$i]['final_price'];
}
  }
 } // end if(!empty($new_s_prices)
} // end for ($x = 0; $x < $no_of_listings; $x++)

//	while ($listing = tep_db_fetch_array($listing_query)) { (was original code)
for ($x = 0; $x < $no_of_listings; $x++) {
  $rows++;

  if (($rows/2) == floor($rows/2)) {
	$list_box_contents[] = array('params' => 'class="productListing-even"');
  } else {
	$list_box_contents[] = array('params' => 'class="productListing-odd"');
  }

  $cur_row = sizeof($list_box_contents) - 1;

  for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
	$lc_align = '';
	$lc_params = '';

	switch ($column_list[$col]) {
	  case 'MASTER_LIST_MODEL':
		$lc_align = '';
		$lc_text = ' ' . $listing[$x]['products_model'] . ' ';
		break;
	  case 'MASTER_LIST_NAME':
		$lc_align = '';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>';
		} else {
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing[$x]['products_id']) .'">' . $listing[$x]['products_name'] . '</a> ';
		}
		break;
	  case 'MASTER_LIST_DESCRIPTION':
		$lc_align = '';
		$lc_text = ' ' . osc_trunc_string(strip_tags($listing[$x]['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), MASTER_LIST_DESCRIPTION_LENGTH) . ' ';

		break; 
	  case 'MASTER_LIST_QUANTITY':
		$lc_align = 'right';
		$lc_text = ' ' . $listing[$x]['products_quantity'] . ' ';
		break;
	  case 'MASTER_LIST_PRICE':
		$lc_align = 'right';
		if (tep_not_null($listing[$x]['specials_new_products_price'])) {
		  $lc_text = ' <s>' .  $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span> ';
		} else {
		  $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';
		}
		break; 			
	  case 'MASTER_LIST_MANUFACTURER':
		$lc_align = '';
		$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing[$x]['manufacturers_id']) . '">' . $listing[$x]['manufacturers_name'] . '</a> ';
		break;
	  case 'MASTER_LIST_WEIGHT':
		$lc_align = 'right';
		$lc_text = ' ' . $listing[$x]['products_weight'] . ' ';
		break;
	  case 'MASTER_LIST_IMAGE':
		$lc_align = 'center';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
		} else {
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
		}
		break;  
	  case 'MASTER_LIST_BUY_NOW': 
		$lc_align = 'center'; 
		$lc_valign = 'top';
		if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing[$x]['products_id']) < 1)) { 
		$lc_text = TEXT_STOCK;
	  } elseif ((STOCK_CHECK == 'false')&&(tep_get_products_stock($listing[$x]['products_id']) < 1)) {
		$qty_array = array();
		for ($i=0; $ns = 20, $i <= $ns; $i++) {
		$qty_array[] = array('id' => $i, 'text' => $i);

		$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing[$x]['products_id'], '', 'size="4"');

		}
	  } else {
		$quantity = tep_get_products_stock($listing[$x]['products_id']);  
		$qty_array = array();
		for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++) {
		$qty_array[] = array('id' => $i, 'text' => $i);

		$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing[$x]['products_id'], '', 'size="4"');

	  }
  }
	   break;
	 case 'PRODUCT_SORT_ORDER';
	   $lc_align = 'center';
	   $lc_text = ' ' . $listing[$x]['products_sort_order'] . ' ';
	   break;
	 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 from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "' ORDER by products_options_id");
			  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)$listing[$x]['products_id'] . "' and pa.options_id = '" . (int)$products_options_name_values['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_pull_down_menu('id_'.$listing[$x]['products_id'].'[' . $products_options_name_values['products_options_id'] . ']', $products_options_array);
				$lc_text .= '<br />';
			  }
			  if($opt_count==0) {
				$lc_text = MASTER_TEXT_NONE;
			  }
			  // EOF: attribute options
			 break;
	}
	$list_box_contents[$cur_row][] = array('align' => $lc_align,
										   'valign' => $lc_valign,
										   'params' => 'class="productListing-data"',
										   'text'  => $lc_text);
}
 }

new productListingBox($list_box_contents);
 } else {
$list_box_contents = array();

$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
							   'text' => TEXT_NO_PRODUCTS);

new productListingBox($list_box_contents);
 }
?>
 <table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
 </table>
<?php
 if ( ($listing_split->number_of_rows > 0) && ((MASTER_PREV_NEXT_BAR_LOCATION == '2') || (MASTER_PREV_NEXT_BAR_LOCATION == '3')) ) {
?>	 
 <table border="0" width="100%" cellspacing="0" cellpadding="2">		  
 <tr>
	<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
	<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>


~Tracy
 

Share this post


Link to post
Share on other sites
Hey guys,

 

I'm a bit confused. I am trying to figure out why I don't see my product options next to my slave products on the product_info.php page. I believe the issue is in the includes/modules/master_listing.php file, but I can't seem to figure out what the issue is. I do have a print command that is showing me everything for each slave except for the options :blink:

 

You can see the page at tcdataweb dot com/MMHTest/gentle-birth-formula-p-128.html

 

Hey, Tracy what did you do to get all this displaying on the page????

 

Array

(Array

(

[0] => Array

(

[products_model] => G1032

[products_description] => One 2 oz Bottle

[products_name] => Gentle Birth Formula - 2oz

[products_id] => 128

[manufacturers_id] => 0

[products_tax_class_id] => 0

[specials_new_products_price] =>

[products_price] => 19.9700

[products_sort_order] => 1

)

 

[1] => Array

(

[products_model] => G1034

[products_description] => One 4 oz Bottle

[products_name] => Gentle Birth Formula - 4oz

[products_id] => 129

[manufacturers_id] => 0

[products_tax_class_id] => 0

[specials_new_products_price] =>

[products_price] => 34.9700

[products_sort_order] => 2

)

 

[2] => Array

(

[products_model] => G 1032R

[products_description] => One 2 oz Bottle

[products_name] => Gentle Birth Formula w/o Red Raspberry - 2 oz

[products_id] => 399

[manufacturers_id] => 0

[products_tax_class_id] => 0

[specials_new_products_price] =>

[products_price] => 19.9700

[products_sort_order] => 5

)

 

[3] => Array

(

[products_model] => G 1034R

[products_description] => One 4 oz Bottle

[products_name] => Gentle Birth Formula w/o Red Raspberry - 4 oz

[products_id] => 401

[manufacturers_id] => 0

[products_tax_class_id] => 0

[specials_new_products_price] =>

[products_price] => 34.9700

[products_sort_order] => 6

)

 

[4] => Array

(

[products_model] => G1032B

[products_description] => One 2oz Bottle

[products_name] => Gentle Birth Formula w/o Blue Cohosh - 2oz

[products_id] => 432

[manufacturers_id] => 0

[products_tax_class_id] => 0

[specials_new_products_price] =>

[products_price] => 19.9700

[products_sort_order] => 9

)

 

[5] => Array

(

[products_model] => G1034B

[products_description] => One 4oz Bottle

[products_name] => Gentle Birth Formula w/o Blue Cohosh - 4oz

[products_id] => 433

[manufacturers_id] => 0

[products_tax_class_id] => 0

[specials_new_products_price] =>

[products_price] => 34.9700

[products_sort_order] => 10

)

 

)

I think I solved the problem with attributes awhile back, but checked my customers and none are using M/S with options. I'll set up a couple of products on my test site and see what happens. I know I at least had 1 attribute available, not sure about an array of attributes.

 

George


GEOTEX from Houston, TX

 

(George)

Share this post


Link to post
Share on other sites
Hey guys,

 

I'm a bit confused. I am trying to figure out why I don't see my product options next to my slave products on the product_info.php page. I believe the issue is in the includes/modules/master_listing.php file, but I can't seem to figure out what the issue is. I do have a print command that is showing me everything for each slave except for the options :blink:

 

Here's a link showing the results of what I am using. Ignore spacing, as this is NOT normally a slave or an item with options, but the code was broken on my test site, so had to use one of our new production sites.

 

http://www.pawprintsink.com/bumper-stickers-p-413.html

 

If the seo link drops, just use pawprintsink dot com.

I am using a slightly modified includes/modules/master_listing.php. Nowhere near as modified as so much of yours is, but below is my file, you can see it working at the above link, at least until Wed. night, at which time I must restore this product back to the original status.

 

HTH

 

George

 

 

<?php
/*
 $Id: master_listing.php GWS

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Maseter products, modified Copyright 2007 George Snell www.ameriwebs.net

 Additional Copyrights (c) osCommerce & Suomedia - Dynamic Content Management

 Released under the GNU General Public License

*/

 $listing_split = new splitPageResults($master_sql, MAX_DISPLAY_SEARCH_RESULTS, 'products_master');



 if ( ($listing_split->number_of_rows > 0) && ( (MASTER_PREV_NEXT_BAR_LOCATION == '1') || (MASTER_PREV_NEXT_BAR_LOCATION == '3') ) ) {


?>


<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }



 $list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
switch ($column_list[$col]) {
  case 'MASTER_LIST_MODEL':
	$lc_text = TABLE_HEADING_MODEL;
	$lc_align = '';
	break;
  case 'MASTER_LIST_NAME':
	$lc_text = TABLE_HEADING_PRODUCTS;
	$lc_align = '';
	break;
  case 'MASTER_LIST_DESCRIPTION':
	$lc_text = TABLE_HEADING_DESCRIPTION;
	$lc_align = 'center';
	break;
  case 'MASTER_LIST_ATTRIBUTES':
	$lc_text = TABLE_HEADING_ATTRIBUTES;
	$lc_align = 'center';
	break;				
  case 'MASTER_LIST_MANUFACTURER':
	$lc_text = TABLE_HEADING_MANUFACTURER;
	$lc_align = '';
	break;
  case 'MASTER_LIST_PRICE':
	$lc_text = TABLE_HEADING_PRICE;
	$lc_align = 'right';
	break;
  case 'MASTER_LIST_QUANTITY':
	$lc_text = TABLE_HEADING_QUANTITY;
	$lc_align = 'right';
	break;
  case 'MASTER_LIST_WEIGHT':
	$lc_text = TABLE_HEADING_WEIGHT;
	$lc_align = 'right';
	break;
  case 'MASTER_LIST_IMAGE':
	$lc_text = TABLE_HEADING_IMAGE;
	$lc_align = 'center';
	break;
  case 'MASTER_LIST_BUY_NOW':
	$lc_text = TABLE_HEADING_BUY_NOW;
	$lc_align = 'center';
	break;
	case 'MASTER_LIST_OPTIONS':
	  $lc_text = TABLE_HEADING_OPTIONS;
	  $lc_align = 'align="center"';
	  break;
}

if ( ($column_list[$col] != 'MASTER_LIST_BUY_NOW') && ($column_list[$col] != 'MASTER_LIST_IMAGE') && ($column_list[$col] != 'MASTER_LIST_MULTIPLE') && ($column_list[$col] != 'MASTER_LIST_DESCRIPTION') && ($column_list[$col] != 'MASTER_LIST_OPTIONS') ) {
  $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
}

$list_box_contents[0][] = array('align' => $lc_align,
								'params' => 'class="productListing-heading"',
								'text' => ' ' . $lc_text . ' ');
 }

 if ($listing_split->number_of_rows > 0) {
$rows = 0;
$master_query = tep_db_query($listing_split->sql_query);
while ($listing = tep_db_fetch_array($master_query)) {
	if ($listing['products_id'] != $listing['products_master']) {
// Separate Price Per Customer
if ($new_price = tep_get_products_special_price($listing['products_id'], $customer_group_id)) {
	$products_group_price = tep_get_products_price($listing['products_id'], $customer_group_id);
		  if (tep_not_null($products_group_price)) {
			$listing['products_price'] = $products_group_price;
		  }
  $products_price = '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
} else {
   $products_group_price = tep_get_products_price($listing['products_id'], $customer_group_id);
		  if (tep_not_null($products_group_price)) {
			$listing['products_price'] = $products_group_price;
		  }
 $products_price = $currencies->display_price($listing['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));				
	}		
// Separate Price per Customer_eof		  
// Special out-of-stock routine
if ($listing['seasons_id'] > 0 ) { // If $product_info['seasons_id'] == 0 this entire routine is not run.
						$ship = tep_get_seasons($listing['seasons_id']);
						switch ($ship) {
						case 0:
							$products_price = 'sold out';
							break;
						case 1:

							break; 
						}
}
// Special out-of-stock routine_eof
  $rows++;

  if (($rows/2) == floor($rows/2)) {
	$list_box_contents[] = array('params' => 'class="productListing-even"');
  } else {
	$list_box_contents[] = array('params' => 'class="productListing-odd"');
  }

  $cur_row = sizeof($list_box_contents) - 1;

  for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
	$lc_align = '';
	$lc_params = '';

	switch ($column_list[$col]) {
	  case 'MASTER_LIST_MODEL':
		$lc_align = '';
		$lc_text = '<a href="java script:popupWindowProduct(\'' . tep_href_link(FILENAME_POPUP_PRODUCT, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '\')">' . $listing['products_model'] . '</a>';
		break;
	  case 'MASTER_LIST_NAME':
		$lc_align = '';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="java script:popupWindowProduct(\'' . tep_href_link(FILENAME_POPUP_PRODUCT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '\')">' . $listing['products_name'] . '</a>';
		} else {
		  $lc_text = '<a href="java script:popupWindowProduct(\'' . tep_href_link(FILENAME_POPUP_PRODUCT, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '\')">' . $listing['products_name'] . '</a>';
		}
		break;
	  case 'MASTER_LIST_DESCRIPTION':
		$lc_align = '';
		$lc_text = ' ' . osc_trunc_string(strip_tags($listing['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), MASTER_LIST_DESCRIPTION_LENGTH) . ' ';

		break;			
	  case 'MASTER_LIST_MANUFACTURER':
		$lc_align = '';
		$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
		break;
	  case 'MASTER_LIST_PRICE':
		$lc_align = 'right';
/*			if (tep_not_null($listing['specials_new_products_price'])) {
		  $lc_text = ' <s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
		} else {
		  $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
		} */
					$lc_text = ' ' . $products_price . ' ';
		break; 
	  case 'MASTER_LIST_QUANTITY':
		$lc_align = 'center';
		$lc_text = ' ' . $listing['products_quantity'] . ' ';
		break;
	  case 'MASTER_LIST_WEIGHT':
		$lc_align = 'right';
		$lc_text = ' ' . $listing['products_weight'] . ' ';
		break;
	  case 'MASTER_LIST_IMAGE':
		$lc_align = 'center';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="java script:popupWindowProduct(\'' . tep_href_link(FILENAME_POPUP_PRODUCT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '\')">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
		} else {

		  $lc_text = '<a href="java script:popupWindowProduct(\'' . tep_href_link(FILENAME_POPUP_PRODUCT, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '\')">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
		}
		break;

	  case 'MASTER_LIST_BUY_NOW': 

		$lc_align = 'center'; 
		$lc_valign = 'top';
		if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) { 
		$lc_text = TEXT_STOCK;
	  } elseif ((STOCK_CHECK == 'false')&&(tep_get_products_stock($listing['products_id']) < 1)) {
		$qty_array = array();
		for ($i=0; $ns = 20, $i <= $ns; $i++) {
				$qty_array[] = array('id' => $i, 'text' => $i);

							$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '0', 'size="4"');

		}
	  } else {
		$quantity = tep_get_products_stock($listing['products_id']);  
		$qty_array = array();
		for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++) {
				$qty_array[] = array('id' => $i, 'text' => $i);

							$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '0', 'size="4"');

		} 
   		}
				if ($products_price == 'sold out') {
	   $lc_text = '0';
				}

	   break;
		   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 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 products_options_id");
			  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)$listing['products_id'] . "' and pa.options_id = '" . (int)$products_options_name_values['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_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 = MASTER_TEXT_NONE;
			  }
			  // EOF: attribute options
			  ///////////////////////////////////////////////////////////////////////////

			 break;
	}
	$list_box_contents[$cur_row][] = array('align' => $lc_align,
										   'valign' => $lc_valign,
										   'params' => 'class="productListing-data"',
										   'text'  => $lc_text);
  }
}
	}
new productListingBox($list_box_contents);
 } else {
$list_box_contents = array();

$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
							   'text' => TEXT_NO_PRODUCTS);

new productListingBox($list_box_contents);
 }
?>
 <table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
 </table>
<?php
 if ( ($listing_split->number_of_rows > 0) && ((MASTER_PREV_NEXT_BAR_LOCATION == '2') || (MASTER_PREV_NEXT_BAR_LOCATION == '3')) ) {
?>	 
 <table border="0" width="100%" cellspacing="0" cellpadding="2">		  
 <tr>
	<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS) . ', Group ID = ' . $customer_group_id; ?></td>
	<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

<?php
 }
?>
<!--<a href="popup_product.php" onclick="popupWindow()" target="_blank"><img src="images/imagex_3.jpg" /></a> //-->


GEOTEX from Houston, TX

 

(George)

Share this post


Link to post
Share on other sites

Has anybody ever managed to get the Master Product and one or multiple slave products into the shopping cart. I need to be able to do this. Any ideas would really be appreciated.

 

 

Thanks..


Converge

Share this post


Link to post
Share on other sites

I have a bit of a code on that page to print out what $listing is getting for an array - usually it is commented out but during testing it can be handy - it's just:

  echo '<pre>';
print_r($listing);
echo '</pre>';

 

Right now it's telling me that I'm not pulling the options information for each of the products in the array - everything else is getting pulled, but not the options.

 

Hey, Tracy what did you do to get all this displaying on the page????

 

I think I solved the problem with attributes awhile back, but checked my customers and none are using M/S with options. I'll set up a couple of products on my test site and see what happens. I know I at least had 1 attribute available, not sure about an array of attributes.

 

George


~Tracy
 

Share this post


Link to post
Share on other sites

Thanks George,

 

I see it working on your site, but for some reason it doesn't work for mine :huh:

I'm wondering if it might have to do with my includes/modules/sts_inc/product_info.php file maybe?

Are you using STS? If so, does your sts_inc/product_info.php file options code look like this:

<?php
/*
 $Id: product_info.php,v 4.3SP1 2006/11/15 23:55:58 rigadin Exp $
 adapted for Separate Pricing Per Customer v4.1.x, Hide products and categories from groups 2006/05/28

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2006 osCommerce

 Released under the GNU General Public License
Based on: Simple Template System (STS) - Copyright (c) 2004 Brian Gallagher - brian@diamondsea.com
STS v4.3SP1 by Rigadin (rigadin@osc-help.net)
*/

$products_id=intval($HTTP_GET_VARS['products_id']);
// Create variables for product ID, added in v4.0.6	
//$template_pinfo['productid'] = $products_id; // Deprecated in STS4.3SP1
$template_pinfo['productsid'] = $products_id; // Just for consistende with osC names

// Start the "Add to Cart" form
$template_pinfo['startform'] = tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_slave'));
// Add the hidden form variable for the Product_ID
$template_pinfo['startform'] .= tep_draw_hidden_field('products_id', $products_id);
$template_pinfo['endform'] = "</form>";

// BOF Separate Price per Customer
 // global variable (session) $sppc_customer_group_id -> local variable customer_group_id

 if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
 } else {
$customer_group_id = $sppc_customer_group_id;
 }

// Get product information from products_id parameter
$product_info_query = tep_db_query("select p.products_master_status, 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 left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) 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 . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0");
$product_info = tep_db_fetch_array($product_info_query);

// START Master Products
$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master = '" . (int)$HTTP_GET_VARS['products_id'] . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0");
   $results = tep_db_fetch_array($master_query);
// EOF Separate Pricing Per Customer, Hide products and categories from groups

// BOF Separate Price per Customer

 $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' and customers_group_id = '" . $customer_group_id . "'");
 if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
 	$product_info['products_price']= $scustomer_group_price['customers_group_price'];

// EOF Separate Price per Customer
$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 {

// BOF Separate Price per Customer
 $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' and customers_group_id = '" . $customer_group_id . "'");
 if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
 	$product_info['products_price']= $scustomer_group_price['customers_group_price'];
 }
// EOF Separate Price per Customer


 $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
 }

 if ($product_info['products_price']>0) {
  $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);
  }
 if (($product_info['products_quantity'] > 0) || (STOCK_CHECK == 'false')) {
  $template_pinfo['qtyproducts']= TEXT_QUANTITY . '  ' . tep_draw_input_field('Qty_ProdId_' . $product_info['products_id'], '', 'size="4"');
 } else {
  $template_pinfo['qtyproducts']= TEXT_STOCK;
 }
}

$template_pinfo['slaveproducts']='';
if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) {
	$sts->start_capture();
		echo ' ';
	include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS);
		echo ' ';
	$sts->stop_capture ('slaveproducts', 'box');
	$template_pinfo['slaveproducts']= $sts->template['slaveproducts'];
}
// END Master Products

$template_pinfo['regularprice'] = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $template_pinfo['regularpricestrike'] = "<s>" . $template_pinfo['regularprice'] . "</s>";
  $template_pinfo['specialprice'] = $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
} else {
  $template_pinfo['specialprice'] = '';
  $template_pinfo['regularpricestrike'] = $template_pinfo['regularprice'];
}

$template_pinfo['productname'] = $product_info['products_name'];
$template_pinfo['productmodel'] =  $product_info['products_model'];

if (tep_not_null($product_info['products_image'])) {
 $template_pinfo['imagesmall'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"');
 $template_pinfo['imagelarge'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), '','','');
 $template_pinfo['product_popup']= '<script language="javascript"><!--'."\n".
							   'document.write(\'<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . (int)$products_id) . '\\\')">' . $template_pinfo['imagesmall'] . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>\');'."\n".
							   '//--></script>'."\n".
							   '<noscript>'."\n".
							   '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">'.$template_pinfo['imagesmall'] . '<br>' . TEXT_CLICK_TO_ENLARGE .'</a>'."\n".
							   '</noscript>'."\n";
} else {
 $template_pinfo['imagesmall'] ='';
 $template_pinfo['imagelarge'] ='';
 $template_pinfo['product_popup']='';	
}

$template_pinfo['productdesc'] = stripslashes($product_info['products_description']); 

// Get the number of product attributes (the select list options)
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $template_pinfo['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 there are attributes (options), then...
if ($products_attributes['total'] > 0) {
 // Print the options header
 $template_pinfo['optionheader'] = TEXT_PRODUCT_OPTIONS;

 // Select the list of attribute (option) names
 $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='" . $template_pinfo['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 = '" . $template_pinfo['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 . "'");

// For each option name, get the individual attribute (option) choices
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 the attribute (option) has a price modifier, include it
  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 we should select a default attribute (option), do it here
if (isset($cart->contents[$_GET['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;
}

$template_pinfo['optionnames'] .= $products_options_name['products_options_name'] . ':<br>'; 
$template_pinfo['optionchoices'] .=  tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . "<br>"; 
 }
} else {
 // No options, blank out the template variables for them
 $template_pinfo['optionheader'] = '';
 $template_pinfo['optionnames'] = '';
 $template_pinfo['optionchoices'] = '';
}
/*
// See if there are any reviews
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$_GET['products_id'] . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 ");
$reviews = tep_db_fetch_array($reviews_query);
if ($reviews['count'] > 0) {
 $template_pinfo['reviews'] = TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; 
} else {
 $template_pinfo['reviews'] = '';
}
*/
// See if there is a product URL
if (tep_not_null($product_info['products_url'])) {
 $template_pinfo['moreinfolabel'] = TEXT_MORE_INFORMATION;
 $template_pinfo['moreinfourl'] = tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false); 
} else {
 $template_pinfo['moreinfolabel'] = '';
 $template_pinfo['moreinfourl'] = '';
}

$template_pinfo['moreinfolabel'] = str_replace('%s', $template_pinfo['moreinfourl'], $template_pinfo['moreinfolabel']);

// See if product is not yet available
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
 $template_pinfo['productdatelabel'] = sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); // Modified in v4.5
 $template_pinfo['productdate'] = tep_date_long($product_info['products_date_available']);
} else {
 $template_pinfo['productdatelabel'] = sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added']) ); // Modified in v4.5
 $template_pinfo['productdate'] = tep_date_long($product_info['products_date_added']); 
}

// Strip out %s values
//$template_pinfo['productdatelabel'] = str_replace('%s.', '', $template['productdatelabel']); // Removed in v4.5
/* Not using Reviews
// See if any product reviews
$template_pinfo['reviewsurl'] = tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params());
$template_pinfo['reviewsbutton'] = tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS);
*/
$template_pinfo['addtocartbutton'] = tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);

// See if any "Also Purchased" items. Feature added in v4.0.6
$sts->start_capture();
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
$sts->stop_capture ('alsopurchased'); // Get the result to the main array
$template_pinfo['alsopurchased']= $sts->template['alsopurchased']; // Put it in the product info
?>

 

 

Here's a link showing the results of what I am using. Ignore spacing, as this is NOT normally a slave or an item with options, but the code was broken on my test site, so had to use one of our new production sites.

 

http://www.pawprintsink.com/bumper-stickers-p-413.html

 

If the seo link drops, just use pawprintsink dot com.

I am using a slightly modified includes/modules/master_listing.php. Nowhere near as modified as so much of yours is, but below is my file, you can see it working at the above link, at least until Wed. night, at which time I must restore this product back to the original status.

 

HTH

 

George


~Tracy
 

Share this post


Link to post
Share on other sites
Thanks George,

 

I see it working on your site, but for some reason it doesn't work for mine :huh:

I'm wondering if it might have to do with my includes/modules/sts_inc/product_info.php file maybe?

Are you using STS? If so, does your sts_inc/product_info.php file options code look like this:

 

No, I have it installed, but not using it. I use a simple® template setup. Basically a default setup with if file_exists() calls for custom headers, footers, left/right column, etc. with a lot of css changes. Also, since we are doing so much with custom product displays, a lot of ajax-java and dhtml changes in product_info.php.

 

I put the code you posted in my editor. Will get back tomorrow if I see anything that might help. While you are looking for a solution, check the calls to includes/modules/master_products.php and it's call to includes/modules/master_listing.php to be sure you have the attributes properly defined and included in the arrays you pass to these functions, keeping in mind that attributes will probably be an array itself, so your calls in the sts templates must be able to build an array of arrays so the needed variables are available to the master_... modules.

 

George


GEOTEX from Houston, TX

 

(George)

Share this post


Link to post
Share on other sites

Found the problem, I had forgotten the

								  'MASTER_LIST_OPTIONS' => MASTER_LIST_OPTIONS,

at the beginning of master_products.php

 

Now I have an error coming from the Xsell contribution in xsell_cart.php due to this query:

$xsell_master_query = tep_db_query("SELECT products_master FROM " . TABLE_PRODUCTS . " WHERE products_id = " . $product_id_in_cart['id'] . "");
$xsell_master = tep_db_fetch_array($xsell_master_query);

 

It is causing errors trying to locate the products id.

Error is:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{4}29' at line 1

 

SELECT products_master FROM products WHERE products_id = 128{4}29

 

Any thoughts on how to better write this query?

 

No, I have it installed, but not using it. I use a simple® template setup. Basically a default setup with if file_exists() calls for custom headers, footers, left/right column, etc. with a lot of css changes. Also, since we are doing so much with custom product displays, a lot of ajax-java and dhtml changes in product_info.php.

 

I put the code you posted in my editor. Will get back tomorrow if I see anything that might help. While you are looking for a solution, check the calls to includes/modules/master_products.php and it's call to includes/modules/master_listing.php to be sure you have the attributes properly defined and included in the arrays you pass to these functions, keeping in mind that attributes will probably be an array itself, so your calls in the sts templates must be able to build an array of arrays so the needed variables are available to the master_... modules.

 

George


~Tracy
 

Share this post


Link to post
Share on other sites

fixed it !!

 

changed $product_id_in_cart['id'] to (int)$product_id_in_cart['id']

 

Woohoo!! Now to figure out how to make "Buy Now" botton grab option info instead of just the "Add to Cart" button :)

 

Found the problem, I had forgotten the
								  'MASTER_LIST_OPTIONS' => MASTER_LIST_OPTIONS,

at the beginning of master_products.php

 

Now I have an error coming from the Xsell contribution in xsell_cart.php due to this query:

$xsell_master_query = tep_db_query("SELECT products_master FROM " . TABLE_PRODUCTS . " WHERE products_id = " . $product_id_in_cart['id'] . "");
$xsell_master = tep_db_fetch_array($xsell_master_query);

 

It is causing errors trying to locate the products id.

Error is:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{4}29' at line 1

 

SELECT products_master FROM products WHERE products_id = 128{4}29

 

Any thoughts on how to better write this query?


~Tracy
 

Share this post


Link to post
Share on other sites
fixed it !!

 

changed $product_id_in_cart['id'] to (int)$product_id_in_cart['id']

 

Woohoo!! Now to figure out how to make "Buy Now" botton grab option info instead of just the "Add to Cart" button :)

 

Did you figure this out yet? This was an add-on you did for M/S. I assume you did it in modules/master_listing.php. Can you post the code here or PM the file to me to look at?

 

George


GEOTEX from Houston, TX

 

(George)

Share this post


Link to post
Share on other sites

The query change was done in xsell_cart.php for the Xsell contribution (Cross Sell Products). It is called in the shopping_cart.php page and was causing the error. This didn't need any changes in master_products.php or master_listing.php.

 

I ended up changing from having "Buy Now" to having a quantity box and "Add to Cart" so that I could have options added to the cart from my highly modified category pages. I couldn't figure out how to get the "Buy Now" to add the options. I have very modified category and subcategory pages. Top category pages show the top 10 products in that category, and their slaves, and allow you to purchase right from that page. Subcategory pages show all the products in their subcategory, and their slaves, and allow you to purchase from that page. Both category and subcategory pages allow you to click to the product_info.php page for more detailed info on a product as well.

 

Which file would you like to see? I'm happy to post or PM it, as long as I know which one you want :)

 

 

Did you figure this out yet? This was an add-on you did for M/S. I assume you did it in modules/master_listing.php. Can you post the code here or PM the file to me to look at?

 

George


~Tracy
 

Share this post


Link to post
Share on other sites
The query change was done in xsell_cart.php for the Xsell contribution (Cross Sell Products). It is called in the shopping_cart.php page and was causing the error. This didn't need any changes in master_products.php or master_listing.php.

 

I ended up changing from having "Buy Now" to having a quantity box and "Add to Cart" so that I could have options added to the cart from my highly modified category pages. I couldn't figure out how to get the "Buy Now" to add the options. I have very modified category and subcategory pages. Top category pages show the top 10 products in that category, and their slaves, and allow you to purchase right from that page. Subcategory pages show all the products in their subcategory, and their slaves, and allow you to purchase from that page. Both category and subcategory pages allow you to click to the product_info.php page for more detailed info on a product as well.

 

Which file would you like to see? I'm happy to post or PM it, as long as I know which one you want :)

 

I thought you had a buy-now button on each item in the slave list. Guess I was wrong on that. That is one thing we have seen requests for in this 104 page posting over and over again.

 

George


GEOTEX from Houston, TX

 

(George)

Share this post


Link to post
Share on other sites

Wow that seems to be a complicated mod...

 

I read alot of pages of that thread ... i was wondering one thing

 

I sell physical cds and want to offer the same cd in download.... or one track at a time.

 

Is this THE contrib i should use in order to do this ? Do someone here have an example of a digital store using that contrib.

 

thanks alot !

Share this post


Link to post
Share on other sites
Wow that seems to be a complicated mod...

 

I read alot of pages of that thread ... i was wondering one thing

 

I sell physical cds and want to offer the same cd in download.... or one track at a time.

 

Is this THE contrib i should use in order to do this ? Do someone here have an example of a digital store using that contrib.

 

thanks alot !

 

I don't know if it is THE mod you should use. There's more than one way to skin a cat. :-)

 

1st step would be to install a download manager contribution if you have not already done so. I have used this one for some customers.

 

then, give Master/Slave a try. If you are very careful with the installation instructions, and are not trying to install it on the latest osCommerce release, it should work. Remember that this contribution was written for the ms2.2 release, not the RC's. If you have a server with PHP5 and/or mySQL 5, you will need to do database call modifications.

 

hth

 

George


GEOTEX from Houston, TX

 

(George)

Share this post


Link to post
Share on other sites

I do have buy now on slaves on my live shop - but it will be changing to Add to Cart so the option gets added as well without having to first view the product page to choose an option.

 

Live site is www.mountainmeadowherbs.com

 

I have a "box" that I use to pull the products on category and subcategory pages. So, in my template for a subcategory page (for example) I call the $ProdInfo box I created, (includes/boxes/prodinfo.php) which has this code:

<?php
global $current_category_id, $languages_id;

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

// BOF Separate Price per Customer, hide products and categories from groups
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
$customer_group_id = $sppc_customer_group_id;
} // end if(!tep_session_is_registered('sppc_customer_group_id'))

$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) left join " . TABLE_PRODUCTS_DESCRIPTION . " pd using(products_id) where p.products_status = 1 AND p2c.categories_id = '" . (int)$current_category_id . "' AND p.products_master = 0 and pd.language_id = '" . (int)$languages_id . "' AND find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 AND find_in_set('".$customer_group_id."', categories_hide_from_groups) = 0");
$product_check = tep_db_fetch_array($product_check_query);

if ($product_check['total'] < 1) {
//BOF Separate Pricing Per Customer, Hide products and categories for groups
$hide_product = true; // needed for column_right
// EOF Separate Pricing Per Customer, Hide products and categories for groups
?>
<table border="0" width = "100%" cellspacing="3" cellpadding="3">
<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 align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
</tr>
</table>	
<?php
} else {

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, pd.products_short_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd using(products_id) left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id), " . TABLE_CATEGORIES . " c where p2c.categories_id = '" . (int)$current_category_id . "' AND c.categories_id = p2c.categories_id AND p.products_status = '1' and p.products_master_status = 1 and p.products_master = 0 and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('".$customer_group_id."', categories_hide_from_groups) = 0 ORDER BY p.products_sort_order ASC"); 
while ($product_info = tep_db_fetch_array($product_info_query) ) {

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'];
} // end if (tep_not_null($product_info['products_model']))
?>
<table border="0" width = "100%" cellspacing="3" cellpadding="3">
<tr><td colspan="2"><hr></td></tr>
<?php	
		if (tep_not_null($product_info['products_image'])) {
?>
<tr>
	<td width="18%" rowspan="2" align="left" class="smallText">
<?php			
			 echo ' ' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"'); ?>
		</td>
		<?php
	} else {
	?>
<table border="0" width = "100%" cellspacing="3" cellpadding="3">
<tr>
	<td width="18%" rowspan="2" align="left" class="smallText">		
		<p align="center">No Image Available</p></td>
	<?php
	} // end if (tep_not_null($product_info['products_image']))
	?>
	<td width="82%" class="pageHeading"><?php echo $products_name; ?> </td>
</tr>
<tr>
	<td><?php 
			if ($product_info['products_short_description'] != NULL) {
				echo substr(embedded_href_replace($product_info['products_short_description']), 0, 350);
			} else {
				echo substr(embedded_href_replace($product_info['products_description']), 0, 350);
			} ?></td>
</tr>
<tr>
	<td> </td>
	<td><p><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id']) .'">Click Here for more detailed information and suggested use</a>'; ?></p></td>
</tr>
<tr>
	<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>	
	<tr>
	<td colspan=2><table border="0" width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td><table width="100%" border="1" cellspacing="0" cellpadding="0" class="productListing">
						<tr>
							<td align="center" valign="top" class="productListing-heading"><strong>Item #</strong></td>
							<td align="center" valign="top" class="productListing-heading"><strong>Name</strong></td>
							<td align="center" valign="top" class="productListing-heading"><strong>Description</strong></td>
							<td align="center" valign="top" class="productListing-heading"><strong>Price</strong></td>
							<td class="productListing-heading"> </td>
						</tr>
<?php
$master_query = tep_db_query("select p.products_id, p.products_master, p.products_model, pd.products_name, pd.products_description, m.manufacturers_name, p.products_quantity, p.products_image, p.products_weight, p.products_sort_order, p.manufacturers_id, p.products_price, p.products_tax_class_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_PRODUCTS_DESCRIPTION . " pd using(products_id) left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id where p.products_master = '" . $product_info['products_id'] . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('".$customer_group_id."', categories_hide_from_groups) = 0 ORDER BY p.products_sort_order ASC");
while ($slaves = tep_db_fetch_array($master_query)) {

if ($new_price = tep_get_products_special_price($slaves['products_id'])) {
	//BOF Separate Pricing per Customer
	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $slaves['products_id'] . "' and customers_group_id = '" . $customer_group_id . "'");
	if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
		$slaves['products_price'] = $scustomer_group_price['customers_group_price'];
	}
	//EOF Separate Pricing per Customer
	$products_price = '<s>' . $currencies->display_price($slaves['products_price'], tep_get_tax_rate($slaves['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($slaves['products_tax_class_id'])) . '</span>';
} else {
	//BOF Separate Pricing per Customer
	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $slaves['products_id'] . "' and customers_group_id = '" . $customer_group_id . "'");
	if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
		$slaves['products_price'] = $scustomer_group_price['customers_group_price'];
	}
	// EOF Separate Pricing per Customer
	$products_price = $currencies->display_price($slaves['products_price'], tep_get_tax_rate($slaves['products_tax_class_id']));
}

?>
					  <tr>
						<td align="center" valign="top"><?php echo $slaves['products_model']; ?></td>
						<td align="center" valign="top"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $slaves['products_id']) .'">' . $slaves['products_name'] . '</a>'; ?></td>
						<td align="center" valign="top"><?php echo $slaves['products_description']; ?></td>
						<td align="center" valign="top"><?php echo $products_price; ?></td>
						<td valign="top"><?php echo '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $slaves['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>'; ?></td>
					  </tr>
	<?php
		} // end while $slaves = tep_db_fetch_array($master_query); 
	?>
					</table>
				</td>
			</tr>
		</table>		
	</td>
</tr>
<tr>
	<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
} // end while ($product_info = tep_db_fetch_array($product_info_query) ) 
} // end if ($product_check['total'] < 1) 
?>
</table>

 

My application top buy now button code is:

case 'buy_now' :		if (isset($HTTP_GET_VARS['products_id'])) {
							if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
							} else {
							  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;

 

Does this help?

 

I thought you had a buy-now button on each item in the slave list. Guess I was wrong on that. That is one thing we have seen requests for in this 104 page posting over and over again.

 

George


~Tracy
 

Share this post


Link to post
Share on other sites

Hi, Tracy

 

This is a standard setup for a product list with buy-now buttons. it simply picks up the product ID and price, then tests in application top to see if there are attributes.

 

When you use the bottom add-to-cart, your action is different so the case 'buy-now' doesn't get called. However, I suspect one could quickly get into some spaghetti code to add attributes to the inline buy-now.

 

My keyboard is getting a lot of rf interference today from somewhere, causing tons of missed characters. I think I caught them all.


GEOTEX from Houston, TX

 

(George)

Share this post


Link to post
Share on other sites

hi, is there a way to add this module to the shopping_cart.php page instead of product_info.php ? i mean, when you are already to buy a product it should appear other options to add, anyone knows how to do it?

Share this post


Link to post
Share on other sites

Hi,

I am selling kits which include 30 products, I am also selling the products that go into the kits - individually. If I sell a kit I want the stock levels of each individual product in the kit to decrement by 1.

 

I installed MS2 v1.1.5 on my STS458 site - and set the kit up as a Master & each product that goes into the kit as a Slave - but when I do a test buy - only the kit (the master) stock quantity goes down by 1 - not the slave products.

 

Am I missing something? If I sell a master - isn't the Slave stock level also supposed to go down by 1?

 

I suspect it may be because all my slaves appear under my master on the product_info & when I'm buying the master (which contains all the slaves) - I've left the quantities in the slave drop-downs at zero. I dont' even want the slaves to appear under the master on the product_info as the Master (kit) already contains all the slave products.

 

Any help would be greatly appreciated as I'm meant to be going live this weekend & jut had the stock linking to sort out.

 

Thanks in advance

J

Share this post


Link to post
Share on other sites
Hi,

I am selling kits which include 30 products, I am also selling the products that go into the kits - individually. If I sell a kit I want the stock levels of each individual product in the kit to decrement by 1.

 

I installed MS2 v1.1.5 on my STS458 site - and set the kit up as a Master & each product that goes into the kit as a Slave - but when I do a test buy - only the kit (the master) stock quantity goes down by 1 - not the slave products.

 

Am I missing something? If I sell a master - isn't the Slave stock level also supposed to go down by 1?

 

I suspect it may be because all my slaves appear under my master on the product_info & when I'm buying the master (which contains all the slaves) - I've left the quantities in the slave drop-downs at zero. I dont' even want the slaves to appear under the master on the product_info as the Master (kit) already contains all the slave products.

 

Any help would be greatly appreciated as I'm meant to be going live this weekend & jut had the stock linking to sort out.

 

Thanks in advance

J

 

The problem I see is that you have a conflict of purpose here. The Master product is used to round up all the (in your case) kit items to display in a logical manor. The Master Product is probably a misnomer, since it cannot be sold, only the items under it can be sold without some extensive re-coding. Therefore, no pricing or quantity should be assigned to the Master. As you found, when you price or have quantity on the master, strange things happen.

 

You can set the purchase quantity of each slave item to total the correct number needed for your Kit. You can offer a discount via a coupon or dangling carrot contribution if all items are purchased as a group.

 

The other alternative is to actually use a "kit" builder, but I can find no specific contribution. One might be able to adapt something like the Custom PC Creater (contib. 1487). edit.. newer contrib 3282

 

HTH

 

George

Edited by Geotex

GEOTEX from Houston, TX

 

(George)

Share this post


Link to post
Share on other sites
Guest

Maybe I'm missing it, but when I hit add to cart with the quantity of each slave it correctly adds the slave but also adds the master! I don't want it to add the master!!!

Share this post


Link to post
Share on other sites
i got the rc version.

 

so i forget about that contribution ?

 

I'm curious about this too. This looks like a useful contribution, but not if it won't work on 2.2 RC2a. Will it work? Or what do we need to watch for to make it work?

 

Thanks!

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

×