Jump to content



- - - - -

Master Products - MS2


  • Please log in to reply
2409 replies to this topic

#2321   dspeak

dspeak
  • Members
  • 93 posts
  • Real Name:Danny

Posted 15 June 2011 - 08:23 PM

I am really wanting to try this contribution.  It is exaclty what I am looking for.

I am using oscommerce v2.2 RC2.

I have downloaded Master Products V2.3 x V2.0 and the sql file in V2.3 x V2.0a.

Following the instructions has already got me confused.  The instructions says to upload the following files in catalog/ includes:

•includes
◦boxes
■bm_suggested_accessories.php
■bm_reviews.php
■bm_shopping_cart.php
■bm_specials.php
■bm_whats_new.php
■bm_best_sellers.php


That is 6 files.  When I go to the downloaded upload file, includes, these files are not there only folders for classes, languages and modules.

Where do I find the files that are supposed to be uploaded?


Thanks for the help.

#2322   dspeak

dspeak
  • Members
  • 93 posts
  • Real Name:Danny

Posted 15 June 2011 - 09:38 PM

Let me clarify my previous post.

The instructions say to upload the following files.

•includes
◦boxes
■bm_suggested_accessories.php
■bm_reviews.php
■bm_shopping_cart.php
■bm_specials.php
■bm_whats_new.php
■bm_best_sellers.php

but when I check the download application the only file I see under includes/boxes is suggest_accesories.

What am I missing?

#2323   Geotex

Geotex
  • Members
  • 633 posts
  • Real Name:George Snell
  • Gender:Male
  • Location:Houston, TX USA

Posted 15 June 2011 - 10:45 PM

I believe the code for the version you have downloaded are for osCommerce 2.3.x. Please check the opening lines in the included in Master_Products_guide_V23x.html

Think you will need to uninstall that version completely by restoring the backup you did before starting to install that contribution and preview an earlier version more suited to one of the RC2 releases.

If Gergely is stil getting reply notifications for this topic, he needs to jump in on this one.
GEOTEX from Houston, TX

(George)

#2324   dspeak

dspeak
  • Members
  • 93 posts
  • Real Name:Danny

Posted 16 June 2011 - 05:00 PM

thank you,  luckily I have not installed this contribution yet, was just beginning to and saw that files didn't match up.  Do you know which version would be more suited to oscommerce v2.2 RC2 ?

thanks

#2325   Peper

Peper
  • Members
  • 374 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 20 June 2011 - 08:28 AM

Still stuck with drop-down quantity box for when showing just a normal product.

is there maybe a code change we can do in product_info.php to say if no master product is displaying, remove its quantity box and insert the following box
<tr>

<?php
for ($i=0; $i<15; $i++) {
$qty_array[] = array('id' => $i+1, 'text' => $i+1);
}
?>
<td align="right" class="main"><br><b><?php echo QUANTITY_WISH . ' : ' . tep_draw_pull_down_menu('quantity', $qty_array, 1) ; ?></td>

</tr>
application_top.php, I changed the following for the above:

$HTTP_POST_VARS['id']))+1

and replaced with this:

$HTTP_POST_VARS['id']))+ (int)$HTTP_POST_VARS['quantity']

Anyone please?
Contributions successfully installed : Header tags SEO, Scrolling new products, Customer testimonials, Support tickets, Polls, Link exchange, SPPC, X-sell, Master products, Dhtml menu, Image cache, Slide show, Product videos, Product custom sort, Product notes, Discount coupons, Ask question(review style + admin), CP builder, Customers also purchased, price list, // SEO URLS 5, and forgot the others and then a real admin setup.

#2326   Gergely

Gergely

    Action Hero

  • Community Team
  • 972 posts
  • Real Name:Gergely Tóth
  • Gender:Male
  • Location:Budapest

Posted 20 June 2011 - 01:38 PM

View PostPeper, on 20 June 2011 - 08:28 AM, said:

Still stuck with drop-down quantity box for when showing just a normal product.

is there maybe a code change we can do in product_info.php to say if no master product is displaying, remove its quantity box and insert the following box
<tr>

<?php
for ($i=0; $i<15; $i++) {
$qty_array[] = array('id' => $i+1, 'text' => $i+1);
}
?>
<td align="right" class="main"><br><b><?php echo QUANTITY_WISH . ' : ' . tep_draw_pull_down_menu('quantity', $qty_array, 1) ; ?></td>

</tr>
application_top.php, I changed the following for the above:

$HTTP_POST_VARS['id']))+1

and replaced with this:

$HTTP_POST_VARS['id']))+ (int)$HTTP_POST_VARS['quantity']

Anyone please?

Hi,


 	switch ($HTTP_GET_VARS['action']) {
  	// customer wants to update the product quantity in their shopping cart
  	case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {
								if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array(isset($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : $node_note) ? $HTTP_POST_VARS['cart_delete'] : array()))) {
							  	$cart->remove($HTTP_POST_VARS['products_id'][$i]);
								} else {
							  	$attributes = (isset($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]])) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
							  	$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['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($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
								$attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : '';
								$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+1, $attributes);
						  	}

						  	tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  	break;
  	// customer removes a product from their shopping cart
  	case 'remove_product' : if (isset($HTTP_GET_VARS['products_id'])) {
								$cart->remove($HTTP_GET_VARS['products_id']);
						  	}
						  	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' :
  	// Master Products modification if attributes needed
						  	while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {
								if (substr($key,0,11) == "Qty_ProdId_" && ($val !== 0)) {
							  	$prodId = substr($key,11);
							  	
							  	$qty = (is_numeric($val) ? $val : 0);  // prevent injection
							  	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 {
									if (isset($HTTP_POST_VARS["products_id"]) && isset($HTTP_POST_VARS['id'])) {
							   		// We have attributes with normal product only
								  	if ($prodId == $HTTP_POST_VARS['products_id']) {
										$attributes = $HTTP_POST_VARS['id'];
								  	} else {
										$attributes = $HTTP_POST_VARS["id_$prodId"];
								  	}
								  	$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $attributes))+$qty, $attributes);
									} else {
									// No attributes and normal products
									$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($HTTP_GET_VARS['products_id'])) {
								if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  	tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
								} else {
							  	$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
								}
						  	}
						  	tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  	break;


and product_info.php in oscommerce v2.3.1 (can be a little diffenecies)

<?php
  $qty_array = array();
  if ($product_info['products_price']>0) {
	for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {
		$qty_array[] = array('id' => $i, 'text' => $i);
	}
  }
?>

<div class="buttonSet">
	<p align="left" class="main">
<?php 
  if ($product_info['products_quantity'] > 0) {
	if ($product_info['products_price'] > 0 ) {
		echo TEXT_QUANTITY . '&nbsp;&nbsp;' . ( ($product_info['products_buy_status'] == 1) ? tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) : '' ) ;
	} else {
  	//echo 'Master';
	}
  } 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 . '&nbsp;&nbsp;' . ( ($product_info['products_buy_status'] == 1) ? tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array) : '' ) ;
  } elseif ((STOCK_CHECK == 'true') && ($product_info['products_quantity'] < 1)){
  
  } else {
	echo '<p class="stockWarning">' . TEXT_ORDER . '</p>';
	echo '<p align="center"><small><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id'] . '&action=notify') . '">' . TEXT_STOCK_NOTIFY . '</a><br /><a href="' . tep_href_link(FILENAME_CONTACT_US, 'products_id=' . $product_info['products_id']) . '">' . TEXT_STOCK_CONTACT . '</a><br /><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=' . $product_info['products_name'] . '&search_in_description=1&stock=in') . '">' . TEXT_STOCK_OFFERS . '</a></small></p>';

  }
?>
	</p>
  </div>

Edited by Gergely, 20 June 2011 - 01:47 PM.

some rewrites :-)

#2327   Peper

Peper
  • Members
  • 374 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 20 June 2011 - 06:13 PM

Thanks Gergely

Tried as you suggested
My cart is ver. 2.2
Piece of code that I think is giving the main problem is
<?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 class="main" align="right"><?php if ($product_info['products_quantity'] > 0) {
 	echo QUANTITY_WISH . '&nbsp;&nbsp;' . 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 QUANTITY_WISH . '&nbsp;&nbsp;' . 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');

echo tep_draw_hidden_field('products_id', $product_info['products_id']);
		if ($master_check['check'] == "1") {
		  echo TEXT_BUNDLE_ONLY;
		} elseif ((STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') && ($qty < 1)) {
		  echo tep_image_button('button_out_of_stock.gif', IMAGE_BUTTON_OUT_OF_STOCK);
		} else { 
		  echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
		} 
		?>
The code works correctly when a master product is displaying
but for a normal product the amount added to cart will always be 1


When I add
		  <!-- ############  easy way add Qty box in your product_info.php BOF ################# -->
<tr>

<?php
for ($i=0; $i<15; $i++) {
$qty_array[] = array('id' => $i+1, 'text' => $i+1);
}
?>
<td align="center" class="main"><br><b><?php echo QUANTITY_WISH . ' : ' . tep_draw_pull_down_menu('quantity', $qty_array, 1) ; ?></td>

</tr>
<!-- ############## easy way add Qty box in your product_info.php EOF ############# -->


-------------------------------------------------------------------------------------------------------------------------------

2. Like Sean's contribution, search application_top.php for the following code:

--------------------------------------------- 
$HTTP_POST_VARS['id']))+1 
--------------------------------------------

and replace with this:

$HTTP_POST_VARS['id']))+ (int)$HTTP_POST_VARS['quantity']
Then normal products is adding correctly except for master products

My code in application_top.php
	  // customer wants to update the product quantity in their shopping cart
	  case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {
								if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {
								  $cart->remove($HTTP_POST_VARS['products_id'][$i]);
								} else {
								  if (PHP_VERSION < 4) {
									// if PHP3, make correction for lack of multidimensional array.
									reset($HTTP_POST_VARS);
									while (list($key, $value) = each($HTTP_POST_VARS)) {
									  if (is_array($value)) {
										while (list($key2, $value2) = each($value)) {
										  if (preg_match ("/(.*)\]\[(.*)/", $key2, $var)) {
											$id2[$var[1]][$var[2]] = $value2;
										  }
										}
									  }
									}
									$attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';
								  } else {
									$attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
								  }
								  $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
								}
							  }
							  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($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;
//Master Products EOF
	  // customer adds a product from the products page
	  case 'add_product' :	if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
								$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+ (int)$HTTP_POST_VARS['quantity'], $HTTP_POST_VARS['id']);
							  }
							  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
							  break;
	  // custom product builder add to cart from builder_info page
	  case 'add_build' :	  if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
								if ($_POST['uncloaked_build'] == '0') {
								  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '1' where products_id = '" . $_POST['products_id'] . "' and products_quantity > '" . $cart->get_quantity(tep_get_uprid($_POST['products_id'],$_POST['id'])) . "'");
								}
								$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
								if ($_POST['disable_build'] == '1' or $_POST['uncloaked_build'] =='0') {
								  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . $_POST['products_id'] . "'");
								}
							  }
							  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
							  break;

	  // performed by the 'buy now' button in product listings and review page
	  // BOF: XSell
	  case 'buy_now' :		if (isset($HTTP_GET_VARS['product_to_buy_id'])) {
								if (tep_has_product_attributes($HTTP_GET_VARS['product_to_buy_id'])) {
								  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['product_to_buy_id']));
								} else {
								  $cart->add_cart($HTTP_GET_VARS['product_to_buy_id'], $cart->get_quantity($HTTP_GET_VARS['product_to_buy_id'])+1);
								}
							  } elseif (isset($HTTP_GET_VARS['products_id'])) {
// EOF: XSell
								if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
								  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
								} elseif (isset($HTTP_POST_VARS['cart_quantity'])) {
					$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$HTTP_POST_VARS['cart_quantity']);
				} else {
//modification to add quantity instead of 1 
if($HTTP_POST_VARS['buyqty']=="") {
$quantity = 1;
}else{
$quantity = $HTTP_POST_VARS['buyqty'];							
}
//end of modification to add quantity instead of 1

$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$quantity);
								}
							  }
							  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
							  break;
	  case 'notify' :		
:'(
Contributions successfully installed : Header tags SEO, Scrolling new products, Customer testimonials, Support tickets, Polls, Link exchange, SPPC, X-sell, Master products, Dhtml menu, Image cache, Slide show, Product videos, Product custom sort, Product notes, Discount coupons, Ask question(review style + admin), CP builder, Customers also purchased, price list, // SEO URLS 5, and forgot the others and then a real admin setup.

#2328   Gergely

Gergely

    Action Hero

  • Community Team
  • 972 posts
  • Real Name:Gergely Tóth
  • Gender:Male
  • Location:Budapest

Posted 20 June 2011 - 06:38 PM

View PostPeper, on 20 June 2011 - 06:13 PM, said:

Thanks Gergely

Tried as you suggested
My cart is ver. 2.2
Piece of code that I think is giving the main problem is

Hi,

I think the form action is wrong. If I have truth you have to change fom header in the product_info.php. (2 in one)

  if ($master_check['products_master_status'] > 0 || $master_check['products_master'] == 0) { // this modify!!
	echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">';
  } else {
	echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));
  }
// Master Products EOF

I had to separate this functions some month before. There are two different form action we use. The original and the master  (buy_now_) product actions.

Sorry but I didnt examine your codes.
some rewrites :-)

#2329   Peper

Peper
  • Members
  • 374 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 20 June 2011 - 07:35 PM

View PostGergely, on 20 June 2011 - 06:38 PM, said:

Hi,

I think the form action is wrong. If I have truth you have to change fom header in the product_info.php. (2 in one)

  if ($master_check['products_master_status'] > 0 || $master_check['products_master'] == 0) { // this modify!!
	echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">';
  } else {
	echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));
  }
// Master Products EOF

I had to separate this functions some month before. There are two different form action we use. The original and the master  (buy_now_) product actions.

Sorry but I didnt examine your codes.
WoW, thanks alot
Yeah worked :lol:
 if ($master_check['products_master_status'] > 0 || $master_check['products_master'] == 0) { // this modify!!
Almost there after reading the tread for the 3rd time(busy) looking to make either description or product name clickable from slaves to take customer to slave's product_info.php page
Contributions successfully installed : Header tags SEO, Scrolling new products, Customer testimonials, Support tickets, Polls, Link exchange, SPPC, X-sell, Master products, Dhtml menu, Image cache, Slide show, Product videos, Product custom sort, Product notes, Discount coupons, Ask question(review style + admin), CP builder, Customers also purchased, price list, // SEO URLS 5, and forgot the others and then a real admin setup.

#2330   Peper

Peper
  • Members
  • 374 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 21 June 2011 - 07:01 AM

Me again  >_<

I see that when showing product on the index.php page and product has got options, if we click on add to cart, it will first redirect us to it's master product.
Options on the product is however selectable when having master product on top of page, but this would be sort of wrong way - misleading product to wrong page?

So, in index.php showing products, product got options then it need to direct customer to actual product and not it's master

Any help please
Contributions successfully installed : Header tags SEO, Scrolling new products, Customer testimonials, Support tickets, Polls, Link exchange, SPPC, X-sell, Master products, Dhtml menu, Image cache, Slide show, Product videos, Product custom sort, Product notes, Discount coupons, Ask question(review style + admin), CP builder, Customers also purchased, price list, // SEO URLS 5, and forgot the others and then a real admin setup.

#2331   Geotex

Geotex
  • Members
  • 633 posts
  • Real Name:George Snell
  • Gender:Male
  • Location:Houston, TX USA

Posted 21 June 2011 - 04:03 PM

View PostPeper, on 21 June 2011 - 07:01 AM, said:

Me again  >_<

I see that when showing product on the index.php page and product has got options, if we click on add to cart, it will first redirect us to it's master product.
Options on the product is however selectable when having master product on top of page, but this would be sort of wrong way - misleading product to wrong page?

So, in index.php showing products, product got options then it need to direct customer to actual product and not it's master

Any help please

Basically what you are saying is that "if a product has no options, go to Master" and "if product has options, go to prodct"? This voids the purpose of setting a Master-Slave relationship. The choice here is to not have a master for items with options, or add options to product listing when pulling a category, thereby changing the basic action of a buy now in catalog/includes/modules/product_listing[_col].php. You would also need to alter the shopping cart options in catalog/includes/application_top.php and possible also classes and functions. The second option is possible, but not very desirable for obvious reasons.

Edited by Geotex, 21 June 2011 - 04:06 PM.

GEOTEX from Houston, TX

(George)

#2332   Peper

Peper
  • Members
  • 374 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 21 June 2011 - 04:32 PM

View PostGeotex, on 21 June 2011 - 04:03 PM, said:

Basically what you are saying is that "if a product has no options, go to Master" and "if product has options, go to prodct"? This voids the purpose of setting a Master-Slave relationship. The choice here is to not have a master for items with options, or add options to product listing when pulling a category, thereby changing the basic action of a buy now in catalog/includes/modules/product_listing[_col].php. You would also need to alter the shopping cart options in catalog/includes/application_top.php and possible also classes and functions. The second option is possible, but not very desirable for obvious reasons.
Thanks,
Not quite

All slaves is behaving like a normal product = 99% except when slave product got attribute.
My shop now is displaying slave e.g. from index.php side, when user clicks it takes them to product master, from there showing all the other slaves customer is able to select attribute for his intended product

(What is weird my localhost with exact file match works correct in that way but is not adding attribute to product for some reason)

Let me put example 1st product here got attribute and then takes customer to master product
The second product listed also got attributes but is not a slave and takes us to the correct page, can we do all the slave products this way?
Contributions successfully installed : Header tags SEO, Scrolling new products, Customer testimonials, Support tickets, Polls, Link exchange, SPPC, X-sell, Master products, Dhtml menu, Image cache, Slide show, Product videos, Product custom sort, Product notes, Discount coupons, Ask question(review style + admin), CP builder, Customers also purchased, price list, // SEO URLS 5, and forgot the others and then a real admin setup.

#2333   Geotex

Geotex
  • Members
  • 633 posts
  • Real Name:George Snell
  • Gender:Male
  • Location:Houston, TX USA

Posted 21 June 2011 - 06:49 PM

View PostPeper, on 21 June 2011 - 04:32 PM, said:

Thanks,
Not quite

All slaves is behaving like a normal product = 99% except when slave product got attribute.
My shop now is displaying slave e.g. from index.php side, when user clicks it takes them to product master, from there showing all the other slaves customer is able to select attribute for his intended product

(What is weird my localhost with exact file match works correct in that way but is not adding attribute to product for some reason)

Let me put example 1st product here got attribute and then takes customer to master product
The second product listed also got attributes but is not a slave and takes us to the correct page, can we do all the slave products this way?

There probably are several ways, Gergely probably has a better solution than I. If it were me, I would look under //Shopping Cart Actions in application_top.php, uder the subsection //customer adds a product from the products page to find the code that sends a product with attributes to the product page and write an exception for slaves with options/attributes to redirect to the product instead of the Master. This would be the most direct and not require manipulation of any other pages.


hth

George
GEOTEX from Houston, TX

(George)

#2334   Peper

Peper
  • Members
  • 374 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 21 June 2011 - 10:22 PM

View PostGeotex, on 21 June 2011 - 06:49 PM, said:

There probably are several ways, Gergely probably has a better solution than I. If it were me, I would look under //Shopping Cart Actions in application_top.php, uder the subsection //customer adds a product from the products page to find the code that sends a product with attributes to the product page and write an exception for slaves with options/attributes to redirect to the product instead of the Master. This would be the most direct and not require manipulation of any other pages.


hth

George
Ok, I'm going to abandon and restore a backup till I can figure out for now
Contributions successfully installed : Header tags SEO, Scrolling new products, Customer testimonials, Support tickets, Polls, Link exchange, SPPC, X-sell, Master products, Dhtml menu, Image cache, Slide show, Product videos, Product custom sort, Product notes, Discount coupons, Ask question(review style + admin), CP builder, Customers also purchased, price list, // SEO URLS 5, and forgot the others and then a real admin setup.

#2335   Geotex

Geotex
  • Members
  • 633 posts
  • Real Name:George Snell
  • Gender:Male
  • Location:Houston, TX USA

Posted 22 June 2011 - 03:58 AM

View PostPeper, on 21 June 2011 - 10:22 PM, said:

Ok, I'm going to abandon and restore a backup till I can figure out for now

Here's an update. To enter a product with options/attributes directly to the shopping cart requires alteration of your catalog/includes/modules/product_listing.php and catalog/includes/modules/new_products.php and, if used, catalog/includes/modules/special_products.php, and if you have all products you would have to look at the product listing file for that contribution. Also, if you have buy_now buttons in catalog/products_new.php and catalog/specials.php you will need to alter these pages as well.

The main alteration to the above pages consists of inserting the code to choose options found in catalog/includes/modules/master_listing.php. This will allow the user to choose options from a drop-down menu, and pass the option/attribute variables in $HTTP_GET_VARS[] ($_GET[] for those who have gone to the trouble to replace deprecated code) when the buy-now button is pressed.

Then, change any instances (in sql calls or buy-now code) of 'product_to_buy_id' to 'products_id' which will skip the code in application_top that sends products with attributes purchased form these pages to product_info.php instead of adding the products directly to the cart.

This should be a fairly straight forward update as you are basically replacing the code in the files above with that found in catalog/includes/modules/master_listing with only minor changes.

Although I see some value to these changes and will probably implement them, I am not putting the code changes here due to the number of files that need to be altered. This would have to be an add-on to the Master-Slave contribution.
GEOTEX from Houston, TX

(George)

#2336   Peper

Peper
  • Members
  • 374 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 22 June 2011 - 07:30 PM

George - Gergely: So far so good.

Seeing only one problem now after couple of changes as in previous posts above.

Where can I start to find problem - when I got product with/without attribute, slave or normal - it will always add 2 products no matter the quantity selected,
but when slave product is showing together with master, attributes adds up correctly to amount specified in input boxes as well as master product quantity

Any help on this

Something telss me it's from this piece of code - application_top.php
		case 'remove_product' : if (isset($HTTP_GET_VARS['products_id'])) {
								$cart->remove($HTTP_GET_VARS['products_id']);
								}
								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' :
		// Master Products modification if attributes needed
								while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {
								if (substr($key,0,11) == "Qty_ProdId_" && ($val !== 0)) {
								$prodId = substr($key,11);
								
								$qty = (is_numeric($val) ? $val : 0);  // prevent injection
								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 {
										if (isset($HTTP_POST_VARS["products_id"]) && isset($HTTP_POST_VARS['id'])) {
										// We have attributes with normal product only
										if ($prodId == $HTTP_POST_VARS['products_id']) {
										$attributes = $HTTP_POST_VARS['id'];
										} else {
										$attributes = $HTTP_POST_VARS["id_$prodId"];
										}
										$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $attributes))+$qty, $attributes);
										} else {
										// No attributes and normal products
										$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
	  // BOF: XSell
	  case 'buy_now' :		if (isset($HTTP_GET_VARS['product_to_buy_id'])) {
								if (tep_has_product_attributes($HTTP_GET_VARS['product_to_buy_id'])) {
								  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['product_to_buy_id']));
								} else {
								  $cart->add_cart($HTTP_GET_VARS['product_to_buy_id'], $cart->get_quantity($HTTP_GET_VARS['product_to_buy_id'])+1);
								}
							  } elseif (isset($HTTP_GET_VARS['products_id'])) {
// EOF: XSell
								if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
								  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
								} elseif (isset($HTTP_POST_VARS['cart_quantity'])) {
					$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$HTTP_POST_VARS['cart_quantity']);
				} else {
//modification to add quantity instead of 1 
if($HTTP_POST_VARS['buyqty']=="") {
$quantity = 1;
}else{
$quantity = $HTTP_POST_VARS['buyqty'];							
}
//end of modification to add quantity instead of 1

$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$quantity);
								}
							  }
							  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
							  break;
	  case 'notify' :  

Contributions successfully installed : Header tags SEO, Scrolling new products, Customer testimonials, Support tickets, Polls, Link exchange, SPPC, X-sell, Master products, Dhtml menu, Image cache, Slide show, Product videos, Product custom sort, Product notes, Discount coupons, Ask question(review style + admin), CP builder, Customers also purchased, price list, // SEO URLS 5, and forgot the others and then a real admin setup.

#2337   Peper

Peper
  • Members
  • 374 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 23 June 2011 - 05:50 PM

Ok, above solve in application_top.php  :thumbsup:

Last one(hopefully), When in shopping_cart.php - product got attributes(product is not slave or master)is showing in cart, the product link takes us to http://localhost/oti/product_info.php?products_id=416{12}128&osCsid=is3muihnaklc07nfhd16hl00m3

So when clicked on product from shopping cart - takes me to above link and shows error above product and right column missing(stopped loading on error)
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{12}128' at line 1

select products_id from products where products_master = 416{12}128

[TEP STOP]

I did removed MP edit for shopping_cart.php, no change
Any help on his please
Contributions successfully installed : Header tags SEO, Scrolling new products, Customer testimonials, Support tickets, Polls, Link exchange, SPPC, X-sell, Master products, Dhtml menu, Image cache, Slide show, Product videos, Product custom sort, Product notes, Discount coupons, Ask question(review style + admin), CP builder, Customers also purchased, price list, // SEO URLS 5, and forgot the others and then a real admin setup.

#2338   Peper

Peper
  • Members
  • 374 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 25 June 2011 - 06:19 AM

Ok, thanks for help on previous post even going back to start of thread.

Sorted all problems

Working 100% :thumbsup:
Contributions successfully installed : Header tags SEO, Scrolling new products, Customer testimonials, Support tickets, Polls, Link exchange, SPPC, X-sell, Master products, Dhtml menu, Image cache, Slide show, Product videos, Product custom sort, Product notes, Discount coupons, Ask question(review style + admin), CP builder, Customers also purchased, price list, // SEO URLS 5, and forgot the others and then a real admin setup.

#2339   austintechsus

austintechsus
  • Members
  • 19 posts
  • Real Name:Tom

Posted 30 June 2011 - 04:30 PM

First, I would like to thank those responsible for this contribution. It is something I have wanted for a while but was unaware existed until recently...

I have it largely installed and am able to make the relationships just fine. When I assign a product as a slave, however, the search does not show that it exists nor does the category listing.

Can someone please explain to me why the search was even changed?

Can someone also please give me a clue as to why the category listing would exclude slaves?

Are both of these normal behavior?

I have one other quandry... Why does the SQL script add products_master as a varchar(255)? Shouldn't it be int(11)?


Thanks in advance,

Tom

#2340   dspeak

dspeak
  • Members
  • 93 posts
  • Real Name:Danny

Posted 19 July 2011 - 04:08 PM

I have the contribution installed and have been playing with it some.  I have a parts store that sells engine parts, clutch parts, etc.

What I would like to be able to do is have the slave products show up as slaves under the master, but also to remain as a individual product.

Is there anyway to do this?

V2.2 RC2 of osCommerce.