Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Master Products - MS2


Guest

Recommended Posts

I have been using Master Products for a long time and it has worked fine. Recently my web host updated the PHP version on my server to V5.2.6 and now I have a problem with master products:

 

Adding to the cart from the master listing does not work. i.e when you view a master product, enter quantities and add to the cart, the cart remains empty.

 

My products are still added to the cart from a normal product listing.

 

Has anyone else had this problem with a php upgrade, or does anyone know what changes in php may have caused it?

 

Thanks in advance for any help.

 

Tim

 

Found the solution. I was using an old version and needed a fix in application_top.php

reset($HTTP_POST_VARS);

Link to comment
Share on other sites

Hey guys,

 

I am trying to create something new here. I have created a file: catalog/includes/boxes/product_info2.php and I am including this file on catalog/index.php in place of the catalog/includes/modules/product_listing.php file.

 

My product_info2.php box is supposed to list all of the Master products in the current category, and also list the slave products for each master product. The concept is:

 

Master | Master Product Name

Image | Master Product Description

 

Item # | Description | Price | QTY | |

Slave Item | Slave Description | Slave $ | | Buy Now |

 

So basically the Slave info shows up in the box as it does in includes/modules/master_listing.php underneath of each Master Product's information.

 

I have got it to where it is displaying the Master Products for the current category - but I can't seem to get the slave products to display. I have the "Add to Cart" button twice at the bottom of the page currently. I need to change that to once, and see if it will be better to have a "Buy Now" button after each product quantity box, or the "Add to Cart" at the bottom of the page.

 

In the meantime - I have included the code for both includes/modules/master_products2.php and includes/modules/master_listing2.php in place of where they would normally just be listed as an include so that I can try to see what part is not working right. (I created a second version of each so that the normal catalog/product_info.php will still work properly).

 

If someone could look this over and see if they notice what the problem is I would greatly appreciate it.

 

my includes/boxes/product_info2.php

<?php
global $current_category_id, $languages_id; 

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

   // 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;
 }

 $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 ORDER BY p.products_sort_order ASC");
 $product_check = tep_db_fetch_array($product_check_query);
?>
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php

 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
?>
  <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 {
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd using(products_id) left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p2c.categories_id = '" . (int)$current_category_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");
while ($product_info = tep_db_fetch_array($product_info_query) ) {

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

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
 // BOF Separate Pricing per Customer
	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $product_info['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 Pricing per Customer
	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $product_info['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 (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" type="text/javascript"><!--
document.write('<?php echo ' ' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"'); ?>');
//--></script>
<noscript>
<?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"'); ?>
</noscript>
		  </td>
		</tr>
	  </table>
<?php
}
?>
	  <p><?php echo embedded_href_replace($product_info['products_description']); ?></p>
	</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
}
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
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);
}	
?>
<tr>
	<td align="right class="main"><?php if ($product_info['products_quantity'] > 0) {
echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);
} elseif ((STOCK_CHECK == 'false') && ($product_info['products_quantity'] < 1)) {
  $qty_array = array();
	for ($i=0; $ns = 20, $i <= $ns; $i++) {
	$qty_array[] = array('id' => $i, 'text' => $i);
}
echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);
} else {
echo TEXT_STOCK;
}
echo tep_draw_separator('pixel_trans.gif', '30', '10');
?>
	</td>
</tr>
<?php
}
}
$master_query = tep_db_query("select p.products_id, p.products_master from " . TABLE_PRODUCTS . " p where p.products_master= '" . $product_info['products_id'] . "'");
$results = tep_db_fetch_array($master_query);
if (($results['products_master'] != null) && ($results['products_master_status'] == 1)) { ?>

<tr>
	<td align="left" class="smallText">
		<?php echo TEXT_SLAVE_PRODUCTS; ?>
	</td>
</tr>
<tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
	<td><?php while ($results['products_master'] == $product_info['products_id']) {
//	 include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS2); 				   
			   $slave_list = array('MASTER_LIST_MODEL' => MASTER_LIST_MODEL,
							  'MASTER_LIST_NAME' => MASTER_LIST_NAME,
								'MASTER_LIST_DESCRIPTION' => MASTER_LIST_DESCRIPTION,
							  'MASTER_LIST_QUANTITY' => MASTER_LIST_QUANTITY,
							  'MASTER_LIST_PRICE' => MASTER_LIST_PRICE,
							  'MASTER_LIST_MANUFACTURER' => MASTER_LIST_MANUFACTURER,
							  'MASTER_LIST_WEIGHT' => MASTER_LIST_WEIGHT,
							  'MASTER_LIST_IMAGE' => MASTER_LIST_IMAGE,
							  'MASTER_LIST_BUY_NOW' => MASTER_LIST_BUY_NOW,
							  'PRODUCT_SORT_ORDER' => PRODUCT_SORT_ORDER);

asort($slave_list);

$column_list = array();
reset($slave_list);
while (list($key, $value) = each($slave_list)) {
  if ($value > 0) $column_list[] = $key;
}

$select_column_list = '';

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
  switch ($column_list[$i]) {
	case 'MASTER_LIST_MODEL':
	  $select_column_list .= 'p.products_model,';
	  break;
	case 'MASTER_LIST_NAME':
	  $select_column_list .= 'pd.products_name, ';
	  break;
	case 'MASTER_LIST_DESCRIPTION':
  $select_column_list .= 'pd.products_description, ';
	  break;		  
	case 'MASTER_LIST_MANUFACTURER':
	  $select_column_list .= 'm.manufacturers_name, ';
	  break;
	case 'MASTER_LIST_QUANTITY':
	  $select_column_list .= 'p.products_quantity, ';
	  break;
	case 'MASTER_LIST_IMAGE':
	  $select_column_list .= 'p.products_image, ';
	  break;
	case 'MASTER_LIST_WEIGHT':
	  $select_column_list .= 'p.products_weight, ';
	  break;
	case 'PRODUCT_SORT_ORDER':
	  $select_column_list .= 'p.products_sort_order, ';
	  break;
  }
}

			$master_sql = "select  " . $select_column_list . " p.products_id,  p.manufacturers_id, p.products_tax_class_id, NULL as specials_new_products_price, p.products_price, p.products_sort_order from ". TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id where p.products_id = pd.products_id and 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";


}

if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
  for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
	if ($column_list[$i] == 'MASTER_LIST_NAME') {
	  $HTTP_GET_VARS['sort'] = 'products_sort_order';
	  $master_sql .= " order by p.products_sort_order asc";
	  break;
	}
  }
} else {
  $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
  $sort_order = substr($HTTP_GET_VARS['sort'], 1);
  $master_sql .= ' order by ';
  switch ($column_list[$sort_col-1]) {
	case 'MASTER_LIST_MODEL':
	  $master_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'MASTER_LIST_NAME':
	  $master_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
	  break;
	case 'MASTER_LIST_MANUFACTURER':
	  $master_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'MASTER_LIST_QUANTITY':
	  $master_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'MASTER_LIST_IMAGE':
	  $master_sql .= "pd.products_name";
	  break;
	case 'MASTER_LIST_WEIGHT':
	  $master_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'MASTER_LIST_PRICE':
	  $master_sql .= "p.products_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_SORT_ORDER':
	  $master_sql .= "p.products_sort_order " . ($sort_order == 'd' ? "desc" : '') . ", pd.products_name";
	  break;
  }
}

//	 include(DIR_WS_MODULES . FILENAME_MASTER_LISTING2); 
 $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($_listing , $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>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>

	 ?></td>
</tr>

<?php
}
?>
  <tr><td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '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" 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>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>				
		  </tr>
		</table></td>
	  </tr>
	</table></td>
	  </tr>
</table></form></td>
  <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" 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>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table></form></td>
 </tr>
<?php
} //end while
?>
</table>

~Tracy
 

Link to comment
Share on other sites

Hey guys,

 

I am trying to create something new here. I have created a file: catalog/includes/boxes/product_info2.php and I am including this file on catalog/index.php in place of the catalog/includes/modules/product_listing.php file.

 

My product_info2.php box is supposed to list all of the Master products in the current category, and also list the slave products for each master product. The concept is:

 

Master | Master Product Name

Image | Master Product Description

 

Item # | Description | Price | QTY | |

Slave Item | Slave Description | Slave $ | | Buy Now |

 

So basically the Slave info shows up in the box as it does in includes/modules/master_listing.php underneath of each Master Product's information.

 

I have got it to where it is displaying the Master Products for the current category - but I can't seem to get the slave products to display. I have the "Add to Cart" button twice at the bottom of the page currently. I need to change that to once, and see if it will be better to have a "Buy Now" button after each product quantity box, or the "Add to Cart" at the bottom of the page.

 

I guess I have 2 basic questions: 1. If, for some reason I did want to see all your Master Products in a category, as opposed to just wanting to buy one or 2 items and go on my way, how do I get there? 2. Why would I want to look at all your master products in a category anyway? 3. What if I don't want to see all the masters and their little slaves, do I get them anyway?

 

Now, the big question: Why product_info.php? index.php displays all the products in a category in a nice little listing under the category description. Seems to me a better track is to tackle includes/modules/product_listing.php. You already have all the info you need, just add a filter to display only master products. Simple call.

 

Then, using a while loop:

 

Modify to give you a large display. If you need a guide on that, just use your basic layout on catalog/product_info.php. You can use this set up to call the slaves, using the slave modules.

 

George

 

ps. I am having trouble understanding why you need two left joins, 3 using() and 2 find_in_set() in an ascending order to get a numeric count on how many masters in a category?

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

Kind of lost you on this. Do you mean set all listed products to 0, then let the customer increase the quantity? If so, catalog/includes/modules/master_listing.php has 2 lines to change, approx 191 & 200, look for

 

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

 

change to:

 

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

 

If you mean when you change an item from 1 to 0 it is still added to the cart, look for a coding error that happened somewhere while you were installing. Probably in application_top.php.

 

Sorry it does look like a confusing post.

 

The problem is that in the product_info.php page is that when the customer goes to place an order and they have 7 slave products on the page and they only want to order 3 of the 7 products the system seems to carry the other 4 products over to the cart and adds them with a value of 1 each.

 

I've tried all the fixes not sure what the problem is.

Link to comment
Share on other sites

Thank you George,

 

To answer your questions best I can:

 

My boss wants to have all of the products in each category visible and purchasable from the category pages and use the product_info.php page as the URL for the product when they want more information. (I have the master description truncated to only 350 characters). She has seen this setup on other ecommerce sites and wants to do this on her own site. So, once you go to a category you would see the masters and their slaves whether you wanted to or not. Chances are you would want to though, as you would be going to that category to see what products we have available in that category.

 

Why did I create a second product_info.php? Because my PHP coding skills are not the best. I tried modifying the product_listing.php to get what I want - but it has a much different layout from the layout I want and I didn't know how to get it to create the tables the way I wanted them. It was only showing the Masters, and offering a Buy Now for the master, but the master is not purchasable. The page that most closely resembled how I wanted the tables setup was the product_info.php - it just needed a while loop in there to get things going correctly (or so I thought).

 

But again - my PHP skills are not the best, and I had problems getting that to work. I finally just wrote up my own code, named it product_info2.php and saved it in catalog/includes/boxes folder. This is functioning so far for showing the Master and it's slaves in the format I want. Now I am just working on the Buy Now tidbit, and getting the display correct with my templates.

 

I used the left joins thinking it was less work for the server and the find_in_set bit is to ensure that I'm not pulling any products that are hidden from the current group. If there are no products visible for the group I don't want it to have a count higher than 0.

 

What I currently have as my includes/boxes/product_info2.php file is this (I still need to add some of the code for SPPC & Hide Products for SPPC):

 

<?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 ORDER BY p.products_sort_order ASC");
$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, 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']))

		if (tep_not_null($product_info['products_image'])) {
?>
<table border="0" width = "100%" cellspacing="3" cellpadding="3">
<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 echo substr(embedded_href_replace($product_info['products_description']), 0, 350); ?></td>
</tr>
<?php if (tep_not_null($product_info['products_url'])) {
?>
<tr>
	<td> </td>
	<td><p><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></p></td>
</tr>	
<?php
} // end if (tep_not_null($product_info['products_url']))

$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 from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd using(products_id) left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id where p.products_master = '" . $product_info['products_id'] . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' ORDER BY p.products_sort_order ASC");
while ($results = tep_db_fetch_array($master_query)) {
?>
<tr>
	<td colspan=2><table border="0" width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td><?php echo TEXT_SLAVE_PRODUCTS; ?></td>
			</tr>
			<tr>
				<td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
					  <tr>
						<td><?php echo $results['products_model']; ?></td>
						<td><?php echo $results['products_description']; ?></td>
						<td><?php echo $results['products_price']; ?></td>
						<td>qty</td>
						<td>buy now</td>
					  </tr>
					</table>
				</td>
			</tr>
		</table>
	<?php
		} // end while $results = tep_db_fetch_array($master_query); 
	?>
				</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>

 

I know the code isn't anywhere near as complex as the other osC pages - but at least this is functioning so far and I understand it more as I wrote it - LOL If you see something you know should be done differently, or has an easier way to be done, it would be greatly appreciated if you let me know. My PHP is not the best, so I am constantly learning thanks to these forums :blush:

 

I guess I have 2 basic questions: 1. If, for some reason I did want to see all your Master Products in a category, as opposed to just wanting to buy one or 2 items and go on my way, how do I get there? 2. Why would I want to look at all your master products in a category anyway? 3. What if I don't want to see all the masters and their little slaves, do I get them anyway?

 

Now, the big question: Why product_info.php? index.php displays all the products in a category in a nice little listing under the category description. Seems to me a better track is to tackle includes/modules/product_listing.php. You already have all the info you need, just add a filter to display only master products. Simple call.

 

Then, using a while loop:

 

Modify to give you a large display. If you need a guide on that, just use your basic layout on catalog/product_info.php. You can use this set up to call the slaves, using the slave modules.

 

George

 

ps. I am having trouble understanding why you need two left joins, 3 using() and 2 find_in_set() in an ascending order to get a numeric count on how many masters in a category?

~Tracy
 

Link to comment
Share on other sites

Just thought i would post on here, for those that are having problems getting this to work with QPBPP or if you have a problem where one of each product (slave) is added to the cart, even if the value is set to 0, Then this is the cause, and the fix below.

 

If you follow the process of adding an item to the shopping cart.

 

case 'add_slave' :
					  //	reset($HTTP_POST_VARS);
						  while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {
							if (substr($key,0,11) == "Qty_ProdId_") {
							  $prodId = substr($key,11);
							  $qty = $val;
							  if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) {
								// We have attributes
								$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["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;

 

If you read the code you can see, Even if the Quantity is Zero, It still makes a call to add_cart - Which is where it all goes wrong and one of each product is added to the cart.

 

The reason for this is (If you look at the add_cart function

 

  function add_cart($products_id, $qty = '', $attributes = '', $notify = true) {
  global $new_products_id_in_cart, $customer_id;

  // BOF qpbpp
  $pf = new PriceFormatter;
  $pf->loadProduct($products_id);
  $qty = $pf->adjustQty($qty);
  $discount_category = $pf->get_discount_category();
	// EOF qpbpp

....

 

Remembering that even if the Quantity is 0, a call is made to this function, and the very line where it goes wrong is this line here

 

 $qty = $pf->adjustQty($qty);

 

The Quantity is set to whatever is returned by adjustQty. The adjustQty function is used for when you want to force someone to buy blocks of a product (Such as if you sell a product in packs of 12).

 

If we dig deeper and go to this adjustQty function,

 

 function adjustQty($qty, $qtyBlocks = NULL) {

...

if ($qty < 1)
  $qty = 1;

...

 

Remember once again, even if the quantity is 0, the function is called, and because the Quantiy is 0 (<1) the quantity value is set to 1.

 

As such this results in one of every product being added to the cart.

 

Now, the quick and easy fix for this is to simply not make the call to this function if the Quantity is 0 (As if were not adding anything to the cart, theres no need to make the call!).

 

Fix

 

In Application Top, Around line 395 find

 

 case 'add_slave' :
					  //	reset($HTTP_POST_VARS);
						  while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {
							if (substr($key,0,11) == "Qty_ProdId_") {
							  $prodId = substr($key,11);
							  $qty = $val;
								if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) {
								// We have attributes
								$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["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;

 

 

Replace this with the below

 

 case 'add_slave' :
					  //	reset($HTTP_POST_VARS);
						  while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {
							if (substr($key,0,11) == "Qty_ProdId_") {
							  $prodId = substr($key,11);
							  $qty = $val;
							  if($qty > 0) {
								if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) {
								// We have attributes
								$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["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;

 

All this fix does is, If the quantity is 0, Don't make the call to add_cart, which will fix the problems with adding one of everything to the cart.

Link to comment
Share on other sites

Just wondering if anyone here might be able to see what I'm doing wrong in my SQL queries :)

 

I am trying to pull the master product information for the top 10 bestsellers in a category. But I only want the master product info to show one time - even if more than one slave is in the top 10.

 

So: I am first pulling the bestsellers with this query:

	$topSellers_query = tep_db_query("select distinct p.products_id, p.products_master, c.categories_id from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd USING(products_id), " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_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_ordered desc, pd.products_name limit "  . MAX_DISPLAY_BESTSELLERS);
while ($topSellers = tep_db_fetch_array($topSellers_query) ) {

 

I am then getting the master products for the above array with this query:

	$product_info_query = tep_db_query("select distinct p.products_id, p.products_master, 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 p.products_id = '" . $topSellers['products_master'] . "' and p2c.categories_id = '" . $topSellers['categories_id'] . "' AND c.categories_id = p2c.categories_id AND p.products_status = '1' and p.products_master_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");
while ($product_info = tep_db_fetch_array($product_info_query) ) {

 

I have the "select distinct" in both cases - but when I print out the masters from the product_info_query I will get duplicates. For example, slave 1 and slave 2 both belong to Master 1. Both slave 1 and slave 2 are in the top 10 bestsellers. I only want Master 1 to show up one time - but it shows up 2 times, once for each slave.

 

I don't know if this is because I'm using "while $topSellers=tep_db_fetch_array($topSellers_query) )" or something else. If i don't use the "while" in front of that query though, the $product_info_query only pulls the info for one single result of the $topSellers query.

 

Does anyone here have an idea on where I'm going wrong, or what I can do to get a master product only one time?

TIA :blush:

~Tracy
 

Link to comment
Share on other sites

I have the "select distinct" in both cases - but when I print out the masters from the product_info_query I will get duplicates. For example, slave 1 and slave 2 both belong to Master 1. Both slave 1 and slave 2 are in the top 10 bestsellers. I only want Master 1 to show up one time - but it shows up 2 times, once for each slave.

So then MySQL is doing it's job well: you select products_id, master products id, and categories id and you want them to be different.

slave 1 id, common master products id, categories id

is different from

slave 2 id, common master products id, categories id

 

The first thing I would try is leave out p.products_id from the first query since you don't use it anyway in the next query.

Link to comment
Share on other sites

You can't sell a "master", so it should never be listed in the best sellers anyway. When you click on one of the components from your best sellers, you will bring up the master product display with all it's slaves, which is what you want to display. Therefore, in best sellers, if you added a buy now, you would only have to check to see which items are a slave so you can redirect them to your product_info.php, bringing up the master item with all slaves listed below. If you do not have a buy-now button, you need do nothing , as the display is the default action.

 

hth

 

George

 

 

 

Just wondering if anyone here might be able to see what I'm doing wrong in my SQL queries :)

 

I am trying to pull the master product information for the top 10 bestsellers in a category. But I only want the master product info to show one time - even if more than one slave is in the top 10.

 

So: I am first pulling the bestsellers with this query:

	$topSellers_query = tep_db_query("select distinct p.products_id, p.products_master, c.categories_id from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd USING(products_id), " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_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_ordered desc, pd.products_name limit "  . MAX_DISPLAY_BESTSELLERS);
while ($topSellers = tep_db_fetch_array($topSellers_query) ) {

 

I am then getting the master products for the above array with this query:

	$product_info_query = tep_db_query("select distinct p.products_id, p.products_master, 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 p.products_id = '" . $topSellers['products_master'] . "' and p2c.categories_id = '" . $topSellers['categories_id'] . "' AND c.categories_id = p2c.categories_id AND p.products_status = '1' and p.products_master_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");
while ($product_info = tep_db_fetch_array($product_info_query) ) {

 

I have the "select distinct" in both cases - but when I print out the masters from the product_info_query I will get duplicates. For example, slave 1 and slave 2 both belong to Master 1. Both slave 1 and slave 2 are in the top 10 bestsellers. I only want Master 1 to show up one time - but it shows up 2 times, once for each slave.

 

I don't know if this is because I'm using "while $topSellers=tep_db_fetch_array($topSellers_query) )" or something else. If i don't use the "while" in front of that query though, the $product_info_query only pulls the info for one single result of the $topSellers query.

 

Does anyone here have an idea on where I'm going wrong, or what I can do to get a master product only one time?

TIA :blush:

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

hi All, i just wanting some advice if you would be difficult to set "materproduct" to add or switch off slave items from the master list of items to enable a user to build their own basket of items within product_info.php before submitting to the shopping cart section of the the process so in effect it would work in a simplour type of way to the shopping cart where you can remove items! For example:

 

 

(add item)

Mater product

(Remove button) slave 1

(Remove button) slave 2

(Remove button) slave 3

 

Lets say the user wanted to switch off an item then the pack would look like the following:.

 

switch off (remove)

(add item)

Mater product

(Remove button) slave 1

(Remove button) slave 2

 

 

Add an item:

 

Mater product

(Remove button) slave 1

(Remove button) slave 2

(Remove button) slave 3

(Remove button) slave 4

 

 

 

Thanks for your time!

Link to comment
Share on other sites

Thanks to Jan and George.

 

Jan - you're a genius!! Removing p.products_id from the first query worked like a charm!

 

George - you are correct provided I were using the typical standard osC format. But this is another one of these pages where I have customized it to show the master product image, name and description, and then list the slaves underneath with their buy now buttons. So I had to get the master info for each of the slaves in the bestsellers list in order to display it properly for that format. :blush:

 

Thanks again! I'm off to see what else I can confuse myself with today - LOL :D :P

 

So then MySQL is doing it's job well: you select products_id, master products id, and categories id and you want them to be different.

slave 1 id, common master products id, categories id

is different from

slave 2 id, common master products id, categories id

 

The first thing I would try is leave out p.products_id from the first query since you don't use it anyway in the next query.

~Tracy
 

Link to comment
Share on other sites

Thanks again! I'm off to see what else I can confuse myself with today - LOL :D :P

 

Well, that didn't take long - LOL :blush:

 

I have changed things around quite a bit (as I've mentioned in other spots) so that when you arrive at a category page you get a list of all of the products in that category via:

 

Master | Master Name

Image | Master Description

Table here with purchasable slaves

 

This info repeats for each product. So far I have everything working great, but I have one product (just one) that gives me the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.keg/siteinfohere/includes/functions/database.php on line 108

 

If I check the database.php file, lines 107-109 are:

  function tep_db_fetch_array($db_query) {
return mysql_fetch_array($db_query, MYSQL_ASSOC);
 }

 

All of the info for that product shows up (on both wholesale and retail side) and the slaves are purchaseable. The error shows up in between the master product info and the slave info - and it only shows up for one product. Every other product on the same page and/or on other pages, does not generate this error. That's the part that has me baffled - it's the same script, the same queries, etc... :blink:

 

So - any thoughts on something in the database for a product that might cause that error when a query is retrieving the info? Any other ideas on why this error would show up for only one product?

 

You can see it here:

wwwDOT tcdataweb DOTcom /MMHTest/womens-health-daily-support-c-1_86.html (I don't want search engines finding this test site - so I've not posted the link clickable - sorry). You can browse through the other categories and see the products show up fine without an error everywhere else.

 

The only other thing I can think of is that the product is on "Special" in the test store - and it's the first product to show up on the page. Other products are on special though and don't generate this error - so I don't know if being first on the page while on special would do it or not.

 

Here is the php include that pulls the product info into the category pages (in case it's helpful):

<?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 ORDER BY p.products_sort_order ASC");
$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="0" cellspacing="3" cellpadding="3">
						<tr>
							<td align="center" valign="top"><strong>Item #</strong></td>
							<td align="center" valign="top"><strong>Name</strong></td>
							<td align="center" valign="top"><strong>Description</strong></td>
							<td align="center" valign="top"><strong>Price</strong></td>
							<td> </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
	$customer_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>

~Tracy
 

Link to comment
Share on other sites

I recently installed OSC using fantastico through my cPanel. I tested it everything works fine. Then I installed Master Products 1.2 on to this fresh OSC install. Now, anywhere that requires a price total calculation (shopping cart, infor box, etc) I get the following error:

 

Fatal error: Call to undefined method currencies::calculate_price() in /home/brett85/public_html/shop/includes/classes/shopping_cart.php on line 272

 

i read on another post that the currencies.php file may be the wrong version? How do I fix that?

 

I know it is something conflicting with the Master Product contribution, because I have a completely clean OSC install that works, then when i install MP, I get this error every time. I have uninstalled and installed the whole store 3 times now and still get the same issue every time.

 

Any ideas would be greatly appreciated.

Link to comment
Share on other sites

Do you have the calculate_price function in your includes/classes/currencies.php file?

If not, the function is shown here:

http://www.oscommerce.com/forums/lofiversion/i...hp?t276233.html

 

Do you know what version of osC you installed with fantastico?

 

I recently installed OSC using fantastico through my cPanel. I tested it everything works fine. Then I installed Master Products 1.2 on to this fresh OSC install. Now, anywhere that requires a price total calculation (shopping cart, infor box, etc) I get the following error:

 

 

 

i read on another post that the currencies.php file may be the wrong version? How do I fix that?

 

I know it is something conflicting with the Master Product contribution, because I have a completely clean OSC install that works, then when i install MP, I get this error every time. I have uninstalled and installed the whole store 3 times now and still get the same issue every time.

 

Any ideas would be greatly appreciated.

~Tracy
 

Link to comment
Share on other sites

Do you have the calculate_price function in your includes/classes/currencies.php file?

If not, the function is shown here:

http://www.oscommerce.com/forums/lofiversion/i...hp?t276233.html

 

Do you know what version of osC you installed with fantastico?

 

 

Thanks tracy, that did it. All I did was copy and paste that particular funtion into the currencies.php file. Why wouldnt that function be in there already, though as part of the package?

Link to comment
Share on other sites

I have one product (just one) that gives me the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.keg/siteinfohere/includes/functions/database.php on line 108

Took me quite a long time but I think the problem is that you refer to a $scustomer_group_price_query where in the previous line it is $customer_group_price_query

 

    if ($new_price = tep_get_products_special_price($slaves['products_id'])) {
        //BOF Separate Pricing per Customer
        $customer_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'];
        }

Link to comment
Share on other sites

OMG!! You are definitely a genius!! I searched and searched and never would've caught that - LOL

 

You were right - that fixed the problem!! WOOHOO!! :D

 

Took me quite a long time but I think the problem is that you refer to a $scustomer_group_price_query where in the previous line it is $customer_group_price_query

 

    if ($new_price = tep_get_products_special_price($slaves['products_id'])) {
        //BOF Separate Pricing per Customer
        $customer_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'];
        }

~Tracy
 

Link to comment
Share on other sites

hi All, i just wanting some advice if you would be difficult to set "materproduct" to add or switch off slave items from the master list of items to enable a user to build their own basket of items within product_info.php before submitting to the shopping cart section of the the process so in effect it would work in a simplour type of way to the shopping cart where you can remove items! For example:

 

 

(add item)

Mater product

(Remove button) slave 1

(Remove button) slave 2

(Remove button) slave 3

 

Lets say the user wanted to switch off an item then the pack would look like the following:.

 

switch off (remove)

(add item)

Mater product

(Remove button) slave 1

(Remove button) slave 2

 

 

Add an item:

 

Mater product

(Remove button) slave 1

(Remove button) slave 2

(Remove button) slave 3

(Remove button) slave 4

 

 

 

Thanks for your time!

 

 

iN SEARCH OF A "MASTER PRODUCT" EXPERT

Link to comment
Share on other sites

If you use a quantity box for each slave product, and a single Add to Cart button underneath - it allows you to add multiple items to your cart.

 

You still have to go to your cart to change the quantities though if you change your mind after hitting the Add to Cart button.

 

iN SEARCH OF A "MASTER PRODUCT" EXPERT

~Tracy
 

Link to comment
Share on other sites

If you use a quantity box for each slave product, and a single Add to Cart button underneath - it allows you to add multiple items to your cart.

 

You still have to go to your cart to change the quantities though if you change your mind after hitting the Add to Cart button.

Thank you for your support Tracy i'm going to give this a try this week i'll let know if it worked!

Edited by salt
Link to comment
Share on other sites

Hallo,

 

first, sorry about my bad english.

 

please help me. I just finished set everything in my store.

but I have problem with the listing of the slave products.

 

the slave products should be listed like this:

picture2og4.th.jpg

 

everything's fine.

 

BUT not in this Product:

picture1rw7.th.jpg

 

The Problem in this Product is, the sorting behaviour don't act like in other product. I don't know why. since 2 day i tried to solve this problem.

 

The First slave product should be DVB40 and then DVB60, NOT DVB60 and then DVB40.

it means, it should be sort according to Product id, right?

 

How could i solve this problem? I think, it must be in master_listing.php

 

please apologize for my very bad english.

 

appreciate for any help.

 

thanks alot

Edited by ahoktan
Link to comment
Share on other sites

I have a few products I've converted to slaves and their reviews are now not showing on the master product's page.

 

Has anyone had any luck getting former slaves' reviews to show up on the master's page? I was thinking of some sort of join on the line:

 

$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

 

in product_info.php.

 

Also, anybody have any luck with the recently purchased module misbehaving in this same way?

FlyWithSteve Consulting

Link to comment
Share on other sites

Join the conversation

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

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...