Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Master Products - MS2


Guest

Recommended Posts

Just curious if anyone else has had this issue - or knows if this is the best fix.

 

On my product_listing.php for Master Products, I was having a problem where the Add to Cart button was not successfully adding slaves to the cart. But, if you clicked on the slave and then clicked add to cart from the resulting page- it did work.

 

It appeared by reviewing the URL the link was pointing to, that it was grabbing a "page=1&sort=3" bit of information from the master products product_listing.php.

 

I appear to have been able to fix it by commenting out the below bit of code in includes/modules/product_listing.php

//	if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
//	  $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
//	}

 

My questions:

A) was this the best option for correcting this issue?

B)What is the above code used for (am I going to find that something else doesn't work because I commented this out)?

 

Thanks for any thoughts :blush:

~Tracy
 

Link to comment
Share on other sites

Just curious if anyone else has had this issue - or knows if this is the best fix.

 

On my product_listing.php for Master Products, I was having a problem where the Add to Cart button was not successfully adding slaves to the cart. But, if you clicked on the slave and then clicked add to cart from the resulting page- it did work.

 

 

My questions:

A) was this the best option for correcting this issue?

B)What is the above code used for (am I going to find that something else doesn't work because I commented this out)?

 

Thanks for any thoughts :blush:

 

Hi, Tracy

 

The action you were seeing is (was) the correct action. When you are in includes/modules/product_listing.php (or product_listing_col.php) any slave item is supposed to go to the master page on any click on that item. This is a similar action as a product with options. When you click on the buy-now button, you go to the item page to choose the options. Well, with a slave, you are supposed to go to the Master Item page so you can add some of the other wonderful slave items offered there.

 

IMO, when you change the concept of the slave to immediately add to the cart, you have in essence undone the work you did to tie the products together in the first place and lose a strong selling tool to add multiple items to the cart in one shot.

 

again, just my opinion.

 

George

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

Hi George,

 

Thank you for your reply. We have a heavily modified store at this point, and I do have all of the slaves listed under the Master Products on the master pages. They have text boxes for quantity to be entered and then one "Add to Cart" button underneath the list. This way a customer can add multiple items at one time. None of our products have options, so the customer doesn't need to choose anything other than the product itself. (you can see what I mean here: www.mountainmeadowherbs.com/maximilk-p-54.html)

 

What gets me is that it didn't used to cause a problem to add a slave to the cart from the master page - it is a recent development. The site has been allowing the adding of multiple slaves from the master pages for over a year, so apparently I had this resolved once upon a time. We changed our layout (and more code tweaking - LOL) and I ended up with this issue. :blush:

 

Other than allowing a person to choose options for a slave product, is there anything else commenting out that block of code will affect?

 

 

Hi, Tracy

 

The action you were seeing is (was) the correct action. When you are in includes/modules/product_listing.php (or product_listing_col.php) any slave item is supposed to go to the master page on any click on that item. This is a similar action as a product with options. When you click on the buy-now button, you go to the item page to choose the options. Well, with a slave, you are supposed to go to the Master Item page so you can add some of the other wonderful slave items offered there.

 

IMO, when you change the concept of the slave to immediately add to the cart, you have in essence undone the work you did to tie the products together in the first place and lose a strong selling tool to add multiple items to the cart in one shot.

 

again, just my opinion.

 

George

Edited by TracyS

~Tracy
 

Link to comment
Share on other sites

Hi George,

 

Thank you for your reply. We have a heavily modified store at this point, and I do have all of the slaves listed under the Master Products on the master pages. They have text boxes for quantity to be entered and then one "Add to Cart" button underneath the list. This way a customer can add multiple items at one time. None of our products have options, so the customer doesn't need to choose anything other than the product itself. (you can see what I mean here: www.mountainmeadowherbs.com/maximilk-p-54.html)

 

What gets me is that it didn't used to cause a problem to add a slave to the cart from the master page - it is a recent development. The site has been allowing the adding of multiple slaves from the master pages for over a year, so apparently I had this resolved once upon a time. We changed our layout (and more code tweaking - LOL) and I ended up with this issue. :blush:

 

Other than allowing a person to choose options for a slave product, is there anything else commenting out that block of code will affect?

 

I know just how heavily your store is modified!

 

As to what won't work, I would take a guess that if you have a normal item that has attributes, you will probably just add it to the cart either without any attributes or only the default settings. What else? Probably no other hazards. But, I have also seen some of what you have done to practically have your own custom program instead of a master/slave contribution. You have done several things with this contribution that I have been unable to easily duplicate because of the large number of contributions I have reworked to get all to go together. I have several nearly non-compatible contributions working in harmony and another several still to add. But, with the current setup that I am about 35% into a complete overhaul, a lot of the code still is "hold your breath" with every change or update.

 

George

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

  • 2 weeks later...

LOL - If it weren't for the help of the wonderful people on these forums I wouldn't have anywhere near such a modified store ;) Y'all have taught me a ton!! :)

 

Got a new question :blush:

 

I am trying to get my specials box to only show the master products. For some reason the ability to do this seems to be eluding me - LOL My masters have no prices associated with them as they aren't purchasable, so they aren't actually the item put on Special in the admin side. So I figured if I added a query to pull the masters based on the query that pulls the slaves I should, in effect, be able to display the master products only in the specials box and customers can click on that to go to the master page and see the prices of the slaves.

 

Here is what I have (the $rp_master_query is the new one):

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

 if ($customer_group_id == '0')  {
  $rp_query = tep_db_query("select p.products_id, p.products_master, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id = '0' AND find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 order by s.specials_date_added desc");
 } else { // $sppc_customer_group_id is in the session variables, so must be set
  $rp_query = tep_db_query("select p.products_id, p.products_master, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using (products_id, customers_group_id) where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id= '".$customer_group_id."' AND find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 order by s.specials_date_added desc");
}
$rp_master_query = tep_db_query("select distinct p.products_id, pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $rp_query['products_master'] . "' and pd.products_id = p.products_id and p.products_master_status = '1' and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name ASC");

//  if (tep_not_null($rp_query)) {
// EOF Separate Price per Customer

 if (tep_db_num_rows($rp_master_query)) {
?>
<!-- specials //-->
	  <tr>
		<td align="top">
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_SPECIALS);

new SpecialsBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));

while ($random_product = tep_db_fetch_array($rp_master_query)) {
$rp .= '<center><br /><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_image'] . '<br>' . $random_product['products_name'] . '</a>';
$rp .= "<br /><br />";
}

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
							 'text' => '<MARQUEE align="center" direction="up" loop="true" behavior="scroll" height="130" scrollamount="2" scrolldelay="80" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$rp.'</span></MARQUEE>');

new SpecialsBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- specials_eof //-->
<?php
 }
?>

 

I'm not getting any errors, but I'm also not getting the specials box to show up. The if (tep_db_num_rows($rp_master_query)) { statement seems to be coming back as 0 rows because if I change it to if (tep_db_num_rows($rp_query)) { then I at least get the box - but I don't get any products listed in the box. So something with the new $rp_master_query is just not working :(

 

Any ideas on why this doesn't work? I know I must be missing something simple here, but for the life of me I'm just not seeing it - LOL :blush:

 

I know just how heavily your store is modified!

 

As to what won't work, I would take a guess that if you have a normal item that has attributes, you will probably just add it to the cart either without any attributes or only the default settings. What else? Probably no other hazards. But, I have also seen some of what you have done to practically have your own custom program instead of a master/slave contribution. You have done several things with this contribution that I have been unable to easily duplicate because of the large number of contributions I have reworked to get all to go together. I have several nearly non-compatible contributions working in harmony and another several still to add. But, with the current setup that I am about 35% into a complete overhaul, a lot of the code still is "hold your breath" with every change or update.

 

George

~Tracy
 

Link to comment
Share on other sites

Got a new question :blush:

 

I am trying to get my specials box to only show the master products. For some reason the ability to do this seems to be eluding me - LOL My masters have no prices associated with them as they aren't purchasable, so they aren't actually the item put on Special in the admin side. So I figured if I added a query to pull the masters based on the query that pulls the slaves I should, in effect, be able to display the master products only in the specials box and customers can click on that to go to the master page and see the prices of the slaves.

 

I've got your code in my editor to look at, but I see you are still using all the convoluted code for SPPC, instead of a simple, simple change to 2 functions. Think about that, if you don't see it, let me know, I will give you a couple of hints. I have to analyze a little because of the sppc stuff, but it appears that a simple solution would be to let the special routines run as normal, then, just before printing in the box or specials page, do a quick check to see if a master exists for the item. If so, call a short routine that inserts the master item for the special item with a "more info" and no price directing to your master product in place of the buy now button. That way, you have already determined that a) the item is on special for the signed in group, and b.) the item needs to be listed in your specials and c) a master does not exist so no changes, or d) a master exists and you need to run the substitute the master function.

 

HTH,

 

George

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

Not sure what you mean by the "convoluted code for SPPC" :blush:

 

I've almost got it - but I'm only getting one product rather than the array :huh:

Here is what I've got now:

 

  if ($customer_group_id == '0')  {
  $rp_query = tep_db_query("select p.products_id, p.products_master, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id = '0' AND find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 order by s.specials_date_added desc");
 } else { // $sppc_customer_group_id is in the session variables, so must be set
  $rp_query = tep_db_query("select p.products_id, p.products_master, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using (products_id, customers_group_id) where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id= '".$customer_group_id."' AND find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 order by s.specials_date_added desc");
}

//  if (tep_not_null($rp_query)) {
// EOF Separate Price per Customer

while ($slaves = tep_db_fetch_array($rp_query)) {

$rp_master_query = tep_db_query("select distinct p.products_id, pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $slaves['products_master'] . "' and pd.products_id = p.products_id and  pd.language_id = '" . (int)$languages_id . "' order by pd.products_name ASC");  
 }
if (tep_db_num_rows($rp_master_query)) {

?>
<!-- specials //-->
	  <tr>
		<td align="top">
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_SPECIALS);

new SpecialsBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));

while ($random_product = tep_db_fetch_array($rp_master_query)) {
$rp .= '<center><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $random_product['products_name'] . '</a>';
$rp .= "<br>";
}

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
							 'text' => '<MARQUEE align="center" direction="up" loop="true" behavior="scroll" height="130" scrollamount="2" scrolldelay="80" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$rp.'</span></MARQUEE>');

new SpecialsBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- specials_eof //-->
<?php
 }
?>

 

Even if I take the "distinct" out of the query, I still only get results for one product. I'm not very good with arrays, so this doesn't completely surprise me :blush:

 

I'm wondering if I need to somehow change

while ($slaves = tep_db_fetch_array($rp_query)) {

into a foreach statement, but my attempts at this have been unsuccessful :(

 

I've also tried moving the ending } for the while ($slaves = tep_db_fetch_array($rp_query)) { statement from after the rp_master_query to the end of the page. This results, oddly enough, in two separate specials boxes displaying - but the 1st box only shows one of the two products on special, while the second box scrolls through both products on special ?? :blink:

 

I've got your code in my editor to look at, but I see you are still using all the convoluted code for SPPC, instead of a simple, simple change to 2 functions. Think about that, if you don't see it, let me know, I will give you a couple of hints. I have to analyze a little because of the sppc stuff, but it appears that a simple solution would be to let the special routines run as normal, then, just before printing in the box or specials page, do a quick check to see if a master exists for the item. If so, call a short routine that inserts the master item for the special item with a "more info" and no price directing to your master product in place of the buy now button. That way, you have already determined that a) the item is on special for the signed in group, and b.) the item needs to be listed in your specials and c) a master does not exist so no changes, or d) a master exists and you need to run the substitute the master function.

 

HTH,

 

George

Edited by TracyS

~Tracy
 

Link to comment
Share on other sites

I've almost got it - but I'm only getting one product rather than the array :huh:

Here is what I've got now:

 

Back up a second. Go back to your original code. Then look at minor changes to my calls. Tested this, it works wonderfully. This is my standard specials box, with this main section added, you can see where I sub the variable in the info box. First, add p.products_master to your Random call at the start of the specials box, then add this code as shown below, then insert $master_direct in array(text) as shown in code below. (note: you can ignore the sppc code, as yours is different, but may give you a clue to where we can go with simplified sppc)

 

// show master for special item substitution
 $master_direct = '';
if ($random_product['products_master'] > 0) {
	$random_product['products_id'] = $random_product['products_master'];
	$master_direct = "'Super Savings'";
}else{
	$master_direct = '<br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
}

 

<?php
/*
 $Id: specials.php,v 1.31 2003/06/09 22:21:03 hpdl Exp $
 adapted for Separate Pricing Per Customer v3.6 2005/01/25

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
// ######################## Added Enable / Disable Categorie ################
//  if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
 if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, p.products_master, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c  where c.categories_status='1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p.products_carrot = '0' and p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and s.customers_group_id= '".$customer_group_id."' and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
// ######################## End Added Enable / Disable Categorie ################
// Pricing by Group
	$products_group_price = tep_get_products_price($random_product['products_id'], $customer_group_id);
		  if (tep_not_null($products_group_price)) {
			$random_product['products_price'] = $products_group_price;
		  }
// Pricing by Group_eof
// show master for special item substitution
 $master_direct = '';
if ($random_product['products_master'] > 0) {
	$random_product['products_id'] = $random_product['products_master'];
	$master_direct = "'Super Savings'";
}else{
	$master_direct = '<br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
}
?>
<!-- specials //-->
	  <tr>
		<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_SPECIALS);

new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
							 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a>' . $master_direct . '</span>');

new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- specials_eof //-->
<?php
 }
?>

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

Hmmm - well, all I get is my slave products with 'Super Savings' text after the product name :huh:

 

I did put the //show master for special item substitution bit of code underneath of my while ($random_product = tep_db_fetch_array($rp_query)) { bit of code so it would know what query to pull info from - but still no dice.

 

The query I made correctly pulls the master, but for some reason is only showing one master unless I have it create two specials boxes, then it shows one master in the first box and two masters in the second box? Strange - LOL

 

Will review the SPPC stuff once I get the rest working ;)

 

Back up a second. Go back to your original code. Then look at minor changes to my calls. Tested this, it works wonderfully. This is my standard specials box, with this main section added, you can see where I sub the variable in the info box. First, add p.products_master to your Random call at the start of the specials box, then add this code as shown below, then insert $master_direct in array(text) as shown in code below. (note: you can ignore the sppc code, as yours is different, but may give you a clue to where we can go with simplified sppc)

 

// show master for special item substitution
 $master_direct = '';
if ($random_product['products_master'] > 0) {
	$random_product['products_id'] = $random_product['products_master'];
	$master_direct = "'Super Savings'";
}else{
	$master_direct = '<br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
}

 

<?php
/*
 $Id: specials.php,v 1.31 2003/06/09 22:21:03 hpdl Exp $
 adapted for Separate Pricing Per Customer v3.6 2005/01/25

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
// ######################## Added Enable / Disable Categorie ################
//  if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
 if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, p.products_master, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c  where c.categories_status='1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p.products_carrot = '0' and p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and s.customers_group_id= '".$customer_group_id."' and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
// ######################## End Added Enable / Disable Categorie ################
// Pricing by Group
	$products_group_price = tep_get_products_price($random_product['products_id'], $customer_group_id);
		  if (tep_not_null($products_group_price)) {
			$random_product['products_price'] = $products_group_price;
		  }
// Pricing by Group_eof
// show master for special item substitution
 $master_direct = '';
if ($random_product['products_master'] > 0) {
	$random_product['products_id'] = $random_product['products_master'];
	$master_direct = "'Super Savings'";
}else{
	$master_direct = '<br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
}
?>
<!-- specials //-->
	  <tr>
		<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_SPECIALS);

new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
							 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a>' . $master_direct . '</span>');

new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- specials_eof //-->
<?php
 }
?>

~Tracy
 

Link to comment
Share on other sites

Hmmm - well, all I get is my slave products with 'Super Savings' text after the product name :huh:

 

I did put the //show master for special item substitution bit of code underneath of my while ($random_product = tep_db_fetch_array($rp_query)) { bit of code so it would know what query to pull info from - but still no dice.

 

The query I made correctly pulls the master, but for some reason is only showing one master unless I have it create two specials boxes, then it shows one master in the first box and two masters in the second box? Strange - LOL

 

Will review the SPPC stuff once I get the rest working ;)

 

That is what you should get. The special box is set to only display one random item. When you go to a page that displays the special box, a new (sometimes the same) random item is chosen. That is what the tep_random_select function does. If you are looking to display more than one item, you need catalog/specials.php instead of catalog/includes/boxes/specials.php, applying the same filters as used in the box.

 

George

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

Typically it works that way, but I'm running the scrolling specials box contribution, which lets me pull all of the items on special and scroll through them in the includes/boxes/specials.php - which is why I have the while statements and arrays as well as the text portion of the box being a Marquee:

 

'text' => '<MARQUEE align="center" direction="up" loop="true" behavior="scroll" height="130" scrollamount="2" scrolldelay="80" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$rp.'</span></MARQUEE>');

 

That is what you should get. The special box is set to only display one random item. When you go to a page that displays the special box, a new (sometimes the same) random item is chosen. That is what the tep_random_select function does. If you are looking to display more than one item, you need catalog/specials.php instead of catalog/includes/boxes/specials.php, applying the same filters as used in the box.

 

George

~Tracy
 

Link to comment
Share on other sites

Typically it works that way, but I'm running the scrolling specials box contribution, which lets me pull all of the items on special and scroll through them in the includes/boxes/specials.php - which is why I have the while statements and arrays as well as the text portion of the box being a Marquee:

 

'text' => '<MARQUEE align="center" direction="up" loop="true" behavior="scroll" height="130" scrollamount="2" scrolldelay="80" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$rp.'</span></MARQUEE>');

 

Okay. Then, try this.... using contrib 2583, scrolling boxes. I don't know which exact version you have, but the principal should be the same if you are using a different box.

 

<?php
/*
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $rp_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, p.products_master, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc");
 if (tep_db_num_rows($rp_query)) {
?>
<!-- specials //-->
	  <tr>
		<td>
<?php
$info_box_contents = array();
//add for see title box
$info_box_contents[] = array('text' => BOX_HEADING_SPECIALS);
//End add for see title box

new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));

while ($random_product = tep_db_fetch_array($rp_query)) {

// show master for special item substitution
 $master_direct = '';
if ($random_product['products_master'] > 0) {
	$random_product['products_id'] = $random_product['products_master'];
	$master_direct = "'Super Savings'";
}else{
	$master_direct = '<br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
}

$rp .= '<center><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $master_direct;
$rp .= "</SPAN><BR />";
}
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
							 'text' => '<MARQUEE behavior= "scroll" align= "center" direction= "right" height="160" scrollamount= "2" scrolldelay= "20" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'.$rp.'</span></MARQUEE>');

new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- specials_eof //-->
<?php
 }
?>

 

You may have to change the version, or just chage direction="right" to direction="up'

 

George

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

Hello.

 

I have successfully added this wonderful work and now have a few quick questions.

1. I've noticed that all of my items (even those not specified as a master or slave) do not display in the category box anymore unless they are in a category sub-folder. They are also not searchable unless in a folder. Is this part of the program?

2. I know that a master can have a number of slaves, but can it have only one selectable slave? Perhaps with a radial button or some other means?

3. Finally, can the master itself be limited to a quantity of one as well?

 

Regards,

Harold Shitzele

Link to comment
Share on other sites

Hello.

 

I have successfully added this wonderful work and now have a few quick questions.

1. I've noticed that all of my items (even those not specified as a master or slave) do not display in the category box anymore unless they are in a category sub-folder. They are also not searchable unless in a folder. Is this part of the program?

2. I know that a master can have a number of slaves, but can it have only one selectable slave? Perhaps with a radial button or some other means?

3. Finally, can the master itself be limited to a quantity of one as well?

 

Regards,

Harold Shitzele

 

1. No, not normal. If you added this contribution to a working site, check your code very carefully. There are a lot of places to make errors, especially if you have a modified cart.

 

2. It could have none, if you so desire. Having only one slave on a master is unusual, but sometimes necessary depending on how you group your products.

 

3. Makes no difference, you should not be able to buy a master, as they are display only for all the wonderful products listed underneath. The only exception I know to this is an unpublished mod I did for some customers that sell sets only, and they wanted to display the components of the set throughout the catalog, but only sell the entire collection as a set.

 

HTH

 

George

btw.. This is an unsupported contribution, the original author is long gone, so any help here is only furnished by users such as yourself, and development or changes to the code are normally done by yourself at your own risk, although those of us who post here may be able to help with some problem we have already experienced or solved.

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

 

Has anyone been successful in getting Master Products to work with Products Extra Fields? I am trying to get an extra filed to be populated in the product info page where the table appears for the slave products.

 

Anyone know how to accomplish this?

 

Thanks

Link to comment
Share on other sites

  • 3 weeks later...

I searched, but couldn't find this.

 

On regular products (no slave products) I want customers (wholesalers) to be able to have the option to order more than what is in stock and have a message appear in the cart saying some of the quantity selected will be back ordered. As it is right now if there is 2 products in stock the drop down box will only show choices 0, 1, 2. I'd like it to show 0,1,2,3,4,5,6... or better yet be a text box where they can enter the desired number.

 

I've been messing around with this for a few hours and haven't been able to get it to work.

 

Thanks,

Link to comment
Share on other sites

  • 2 weeks later...

Has anyone managed to install this contr. on 2.2rc2a version?

 

I have used Master Products on a lot of sites erlier, and want to use it again.

Now im using the 2.2rc2a version, but I cant manage to install Master Products, just gets to many errors.

 

If anyone have managed it, please give me a guide! ;)

Link to comment
Share on other sites

Has anyone managed to install this contr. on 2.2rc2a version?

 

I have used Master Products on a lot of sites erlier, and want to use it again.

Now im using the 2.2rc2a version, but I cant manage to install Master Products, just gets to many errors.

 

If anyone have managed it, please give me a guide! ;)

 

I would imagine it would be easier to install in an older version and then do security updates. I installed in 2.2, and have upgraded database calls and a lot of code to work with PHP5 and mySQL 5, but am still working (very slowly :blush: ) to get all the various contributions cleaned up enough to turn register globals off.

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

I would imagine it would be easier to install in an older version and then do security updates. I installed in 2.2, and have upgraded database calls and a lot of code to work with PHP5 and mySQL 5, but am still working (very slowly :blush: ) to get all the various contributions cleaned up enough to turn register globals off.

 

To get this working on the new version is important for me.

I will try to install an old version and upgrade it.

 

Please tell us, if you make a new installation instruction for the new versions! ;)

I guess we are a lot of people here thats willing to donate some money tp get this working :) At least I am! =)

Link to comment
Share on other sites

To get this working on the new version is important for me.

I will try to install an old version and upgrade it.

 

Please tell us, if you make a new installation instruction for the new versions! ;)

I guess we are a lot of people here thats willing to donate some money tp get this working :) At least I am! =)

 

I probably would be, too, as this is an abandoned contribution, and anything posted here is strictly by users, muddling through the trials of making a contribution that was written for a clean install of ms2.2 with an early 4.x php and 3.23.x mySQL work with all the other contributions we all need, plus the upgrades and changes with PHP 5.2+ and mySQL 5.0.x or 5.1.x

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

I probably would be, too, as this is an abandoned contribution, and anything posted here is strictly by users, muddling through the trials of making a contribution that was written for a clean install of ms2.2 with an early 4.x php and 3.23.x mySQL work with all the other contributions we all need, plus the upgrades and changes with PHP 5.2+ and mySQL 5.0.x or 5.1.x

 

It was not abandoned Matti was banned (unfortunately as he was very skilled) if no skilled coders have picked up the support then it's a shame as this was a very neat contribution.

Link to comment
Share on other sites

It was not abandoned Matti was banned (unfortunately as he was very skilled) if no skilled coders have picked up the support then it's a shame as this was a very neat contribution.

 

I am aware of the circumstances.

 

Whatever, the contribution is not supported except by users. Many who do have considerable coding skill which you suggest may be lacking here. While it does do a couple of things that are not easily accomplished using other methods, there is really no point in redoing this contribution for a release that has been at end-of-life for some time pending a stable RC of osCommerce Online Merchant v3.0.

GEOTEX from Houston, TX

 

(George)

Link to comment
Share on other sites

I am aware of the circumstances.

 

Whatever, the contribution is not supported except by users. Many who do have considerable coding skill which you suggest may be lacking here.

 

I did not intimate anything about the coding skill of the users .. the following:-

 

I probably would be, too, as this is an abandoned contribution, and anything posted here is strictly by users

 

Led me to believe that "abandoned contribution" and "strictly by users" is obviously not seen by you as being a solid development path. i.e. not being developed by a skilled coder.

 

 

While it does do a couple of things that are not easily accomplished using other methods, there is really no point in redoing this contribution for a release that has been at end-of-life for some time pending a stable RC of osCommerce Online Merchant v3.0.

 

It'll be a good few years before 3.0 can compete with 2.2 and its contributions so I'd rethink that line.

Link to comment
Share on other sites

I think i have managed to install Master Products on 2.2Rca.

Admin works perfect, and most on the catalog side, it shows the products, i dosent get any error.

BUT - i cant add any products to the cart, not masters, not slaves..

 

Where to beging? ;)

 

 

To wait for a stabel V3.0.. will that ever happend?

I have waited on 3.0 since 2005.. :)

Link to comment
Share on other sites

I think i have managed to install Master Products on 2.2Rca.

Admin works perfect, and most on the catalog side, it shows the products, i dosent get any error.

BUT - i cant add any products to the cart, not masters, not slaves..

 

Where to beging? ;)

 

 

To wait for a stabel V3.0.. will that ever happend?

I have waited on 3.0 since 2005.. :)

 

Take a careful look at a couple of areas. 1st is product_info.php. The form names are changed for Master-Slave contribution.

 

2nd, and most often a problem, is double checking the SHOPPING CART code in application_top.php, as the calls here reflect the change in form name, and there are some other calls to action() that are unique to master-slave.

 

Mine will probably be different than yours, but here is the Shopping Cart area from catalog\includes\application_top.php

 

// Shopping cart actions
 if (isset($_GET['action'])) {
// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
if ($session_started == false) {
  tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
}
if ($_GET['products_set_only']) {
		tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO . '?products_id=' . $_GET['products_master']));
	}	
if (DISPLAY_CART == 'true') {
  $goto =  FILENAME_SHOPPING_CART;
  $parameters = array('action', 'cPath', 'products_id', 'pid');
} else {
  $goto = basename($PHP_SELF);
  if ($_GET['action'] == 'buy_now') {
	$parameters = array('action', 'pid', 'products_id');
  } else {
	$parameters = array('action', 'pid');
  }
}
switch ($_GET['action']) {
  // customer wants to update the product quantity in their shopping cart
  case 'update_product' : for ($i=0, $n=sizeof($_POST['products_id']); $i<$n; $i++) {
							if (in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array()))) {
							  $cart->remove($_POST['products_id'][$i]);
// denuz text attr
							  tep_db_query("delete from customers_basket_text_attributes where products_id = " . tep_get_prid($_POST['products_id'][$i]) . " and session_id = '" . $osCsid . "'");
// eof denuz text attr
							} else {
							  if (PHP_VERSION < 4) {
								// if PHP3, make correction for lack of multidimensional array.
								reset($_POST);
								while (list($key, $value) = each($_POST)) {
								  if (is_array($value)) {
									while (list($key2, $value2) = each($value)) {
									  if (ereg ("(.*)\]\[(.*)", $key2, $var)) {
										$id2[$var[1]][$var[2]] = $value2;
									  }
									}
								  }
								}
								$attributes = ($id2[$_POST['products_id'][$i]]) ? $id2[$_POST['products_id'][$i]] : '';
							  } else {
								$attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';
							  }
							  $cart->add_cart($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $attributes, false);
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // customer adds a product from the products page
  case 'add_product' :	if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
							$cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id']))+$quantity, $_POST['id']);
// denuz text attr
							tep_db_query("delete from customers_basket_text_attributes where products_id = " . $_POST['products_id'] . " and session_id = '" . $osCsid . "'");
							$attr_query = tep_db_query("select * from products_text_attributes_enabled where products_id = " . $_POST['products_id']);
							while ($attr = tep_db_fetch_array($attr_query)) {
							  tep_db_query("insert into customers_basket_text_attributes values ('$osCsid', " . $_POST['products_id'] . ", " . $attr['products_text_attributes_id'] . ", '" . addslashes($_POST['products_text_attributes_' . $attr['products_text_attributes_id']]) . "');");
							}
// eof denuz text attr
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
 //Master Products
 // customer adds multiple products from the master_listing page
  case 'add_slave' :
						  reset($_POST);
						  while ( list( $key, $val ) = each( $_POST ) ) {
							if (substr($key,0,11) == "Qty_ProdId_") {
							  $prodId = substr($key,11);
							  $qty = $val;
							  if(isset($_POST["id_$prodId"]) && is_array($_POST["id_$prodId"])) {
								// We have attributes
								$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$_POST["id_$prodId"]))+$qty, $_POST["id_$prodId"]);
							  } else {
								// No attributes
								$cart->add_cart($prodId, $cart->get_quantity($prodId)+$qty);
							  }
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
 //Master Products EOF
  // performed by the 'buy now' button in product listings and review page
  case 'buy_now' :		if (isset($_GET['products_id'])) {
							if (tep_has_product_attributes($_GET['products_id'], (int)$languages_id)) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['products_id']));
							} else {
							  $cart->add_cart($_GET['products_id'], $cart->get_quantity($_GET['products_id'])+1);
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  case 'notify' :		 if (tep_session_is_registered('customer_id')) {
							if (isset($_GET['products_id'])) {
							  $notify = $_GET['products_id'];
							} elseif (isset($_GET['notify'])) {
							  $notify = $_GET['notify'];
							} elseif (isset($_POST['notify'])) {
							  $notify = $_POST['notify'];
							} else {
							  tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
							}
							if (!is_array($notify)) $notify = array($notify);
							for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
							  $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");
							  $check = tep_db_fetch_array($check_query);
							  if ($check['count'] < 1) {
								tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");
							  }
							}
							tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
						  } else {
							$navigation->set_snapshot();
							tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
						  }
						  break;
  case 'notify_remove' :  if (tep_session_is_registered('customer_id') && isset($_GET['products_id'])) {
							$check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $_GET['products_id'] . "' and customers_id = '" . $customer_id . "'");
							$check = tep_db_fetch_array($check_query);
							if ($check['count'] > 0) {
							  tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $_GET['products_id'] . "' and customers_id = '" . $customer_id . "'");
							}
							tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));
						  } else {
							$navigation->set_snapshot();
							tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
						  }
						  break;
  case 'cust_order' :	 if (tep_session_is_registered('customer_id') && isset($_GET['pid'])) {
							if (tep_has_product_attributes($_GET['pid'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['pid']));
							} else {
							  $cart->add_cart($_GET['pid'], $cart->get_quantity($_GET['pid'])+1);
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
}
 }

 

hth

 

George

GEOTEX from Houston, TX

 

(George)

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