Jump to content



Photo
- - - - -

Bundled products


  • Please log in to reply
330 replies to this topic

#301   Obewanz

Obewanz
  • Members
  • 153 posts
  • Real Name:Ben Kenobi
  • Location:United States

Posted 04 January 2009 - 00:48

The Problem/Error: Every time I try to add a bundle to a product, the bundled items would be added to the PRODUCTS_BUNDLES table but they would not show up when I went back into the product detail page to view or edit something else about the bundled (master) product. I don't know why this became an issue as this has been working for some time.

The Fix: What I discovered was happening was the PRODUCTS table had the products_bundle field type set to tinyint. This in effect stored a '1' in the table for products with bundles and since that does not equal a "yes" the bundled items were never being pulled from the table to be displayed in the product detail page.

The other side of this was that the website would not display or work with the bundles either as all tests on that side of the app require the string value "yes" as well and not a numeric value. It is possible that this began as in issue from a database restore, but since it took me about 5 hours to find this needle, I thought I would share - in case anyone else is having the same problem.
The GraphicZoo
  
check profile for web address

#302   Desertsky

Desertsky
  • Members
  • 120 posts
  • Real Name:Paul Mcintosh

Posted 12 January 2009 - 22:33

I installed the contribution with no problems. Seems to work fine!

One thing I need is more items in the bundle. I have some kits that take up to 15 items but this thing seems limited to 6. Any way to expand it? I have had some general looks at the code but I am not a PHP programmer!

#303   Desertsky

Desertsky
  • Members
  • 120 posts
  • Real Name:Paul Mcintosh

Posted 15 January 2009 - 17:11

Hi, gotta say that this is a really good mod. There are so many situations where this is going to come in handy /rolleyes.gif' class='bbc_emoticon' alt=':rolleyes:' />

2.
We need to find a way of sorting the product list that appears in the bundle setup in the admin section. If you only have 10 products then I guess it's not too difficult to find the single items you want to add to your bundle, but we have around 500 products. Trying to find a single items from the seemingly random list can be a major pain.

If anyone has ideas on how to improve the sorting of the list I would be very happy to hear it.

Again, congrats on such a fantastic mod, keep up the good work.


The list really isn't random. It sorts alphabetically based on the Products Model. At least it does on mine! /wink.gif' class='bbc_emoticon' alt=';)' />

#304   Desertsky

Desertsky
  • Members
  • 120 posts
  • Real Name:Paul Mcintosh

Posted 15 January 2009 - 17:12

I installed the contribution with no problems. Seems to work fine!

One thing I need is more items in the bundle. I have some kits that take up to 15 items but this thing seems limited to 6. Any way to expand it? I have had some general looks at the code but I am not a PHP programmer!


Anyone?

#305   Desertsky

Desertsky
  • Members
  • 120 posts
  • Real Name:Paul Mcintosh

Posted 23 January 2009 - 14:53

Anyone?


NO ONE here knows how to do this???

#306   Desertsky

Desertsky
  • Members
  • 120 posts
  • Real Name:Paul Mcintosh

Posted 24 January 2009 - 23:07

NO ONE here knows how to do this???


Found it waaaay back on page 4. Just ignore me! ;^)

#307   galey1981

galey1981
  • Members
  • 99 posts
  • Real Name:David Gale

Posted 18 February 2009 - 18:20

I have modded my product_listing.php module so I can not do a find and replace to get the out of stock button.

I need this to be on the page:

// BOF Bundled Products
		  case 'PRODUCT_LIST_BUY_NOW':
			$lc_align = 'center';
			$StockChecker1 = tep_get_products_stock($listing['products_id']);
			  if ( $StockChecker1 <> 0){
				$lc_text = (($listing['products_price'] > 0) ? '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>&nbsp;' : '&nbsp;');
			  }else{	
				$lc_text = tep_image_button('button_out_of_stock.gif', IMAGE_BUTTON_OUT_OF_STOCK) . '&nbsp;';
			  }
			  break;
		  // EOF Bundled Products


My code has a qty box, an add to cart button and a read more info button. I want the add to cart button to go to out of stock, like the above code does. Below is my code on the product_info page, can anyone give tips on how I can integrate the out of stock bit into my version?

case 'PRODUCT_LIST_BUY_NOW':
		  $lc_align = 'center';
		  $lc_text = tep_draw_form('buy_now' . $listing['products_id'], tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']), 'POST') . '<b>Qty:</b>&nbsp;' . tep_draw_input_field('list_quantity', '1', 'size=2') . '<br><br>' . tep_image_submit('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</form>&nbsp;' . '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image_button('small_view.gif', IMAGE_BUTTON_BUY_NOW) . '</a>';
			break;


#308   gameflier

gameflier
  • Members
  • 2 posts
  • Real Name:Ken

Posted 08 April 2009 - 10:26

hi all.. sorry my bad english.. here is my problem when I try to install bundled product intergrated with qtpro..
since there are many duplicate codes need to modify on those 2 contributions.. especially in catalog/includes/functions/general.php
function tep_get_products_stock($products_id)..

can any help me to combine those 2 codes ? thanks

osc version: 2.2rc2a
bundle product version:1.5.4
qtpro version: 4.51b

here is original code

// Return a product's stock
// TABLES: products
  function tep_get_products_stock($products_id) {
	$products_id = tep_get_prid($products_id);
	$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	$stock_values = tep_db_fetch_array($stock_query);

	return $stock_values['products_quantity'];
  }

qtpro code

// Return a product's stock
// TABLES: products
//++++ QT Pro: Begin Changed code
  function tep_get_products_stock($products_id, $attributes=array()) {
	global $languages_id;
	$products_id = tep_get_prid($products_id);
	if (sizeof($attributes)>0) {
	  $all_nonstocked = true;
	  $attr_list='';
	  $options_list=implode(",",array_keys($attributes));
	  $track_stock_query=tep_db_query("select products_options_id, products_options_track_stock from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id in ($options_list) and language_id= '" . (int)$languages_id . "order by products_options_id'");
	  while($track_stock_array=tep_db_fetch_array($track_stock_query)) {
		if ($track_stock_array['products_options_track_stock']) {
		  $attr_list.=$track_stock_array['products_options_id'] . '-' . $attributes[$track_stock_array['products_options_id']] . ',';
		  $all_nonstocked=false;
		}
	  }
	  $attr_list=substr($attr_list,0,strlen($attr_list)-1);
	}
	
	if ((sizeof($attributes)==0) | ($all_nonstocked)) {
	  $stock_query = tep_db_query("select products_quantity as quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	} else {
	  $stock_query=tep_db_query("select products_stock_quantity as quantity from " . TABLE_PRODUCTS_STOCK . " where products_id='". (int)$products_id . "' and products_stock_attributes='$attr_list'");
	}
	if (tep_db_num_rows($stock_query)>0) {
	  $stock=tep_db_fetch_array($stock_query);
	  $quantity=$stock['quantity'];
	} else {
	  $quantity = 0;
	}
	return $quantity;
//++++ QT Pro: End Changed Code
  }

bundle product code

// BOF Bundled Products
////
// Return a product's stock
// TABLES: products
// function heavily modified for bundle mod
  function tep_get_products_stock($products_id) {
	$products_id = tep_get_prid($products_id);
	//add bundle field to database query
	$stock_query = tep_db_query("select products_quantity, products_bundle from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	
	//determine whether product is a bundle
	$stock_data = tep_db_fetch_array($stock_query);
	if ($stock_data['products_bundle'] == 'yes') {
	  // order item is a bundle and must be separated
	  $bundle_query = tep_db_query("select pb.subproduct_id, pb.subproduct_qty, p.products_quantity, p.products_bundle from " . TABLE_PRODUCTS_BUNDLES . " pb LEFT JOIN " . TABLE_PRODUCTS . " p ON p.products_id=pb.subproduct_id where pb.bundle_id = '" . (int)$products_id . "'");
	  while ($bundle_data = tep_db_fetch_array($bundle_query)) {
		if ($bundle_data['products_bundle'] == "yes") {
			//seperation routine in case there is also a bundle within a bundle
		  $bundle_query_nested = tep_db_query("select pb.subproduct_id, pb.subproduct_qty, p.products_quantity, p.products_bundle from " . TABLE_PRODUCTS_BUNDLES . " pb LEFT JOIN " . TABLE_PRODUCTS . " p ON p.products_id=pb.subproduct_id where pb.bundle_id = '" . $bundle_data['subproduct_id'] . "'");
		  while ($bundle_data_nested = tep_db_fetch_array($bundle_query_nested)) {
			//generate stock levels string within 2nd level bundle, adding commas between values
			$stock_bundle .= (int)($bundle_data_nested['products_quantity'] / $bundle_data_nested['subproduct_qty']) . ',';
		  }
		} else {
		  //generate stock levels string if it is only a 1st level bundle, adding commas between values
		  $stock_bundle .= (int)($bundle_data['products_quantity'] / $bundle_data['subproduct_qty']) . ',';
		}
	  }
	  //create an array from the stock_bundle string
	  $stock_bundle_array = explode (',', $stock_bundle);
	  //sorts the array in order of stock levels of subproducts 
	  sort($stock_bundle_array);
	  //select the smallest subproduct stock value as the stock level of the bundle (first value is null due to way $stock_bundle is made)
	  $stock_values = $stock_bundle_array[1];
	} else {
	  //generate stock value for single product
	  $stock_values = $stock_data['products_quantity'];
	}
	
	return $stock_values;
  }
// EOF Bundled Products


#309   beeman147

beeman147
  • Members
  • 11 posts
  • Real Name:brian herraghty
  • Gender:Male
  • Location:London

Posted 21 April 2009 - 08:55

I have bundled products 1.5.3 working well with Sppc 4.2.2 (or so it seems) but i need to make further modifications.

I would like for the customer & store emails to list all the sub products within a bundle when sold.
I have modified the admin order.php, invoice.php and packingslip.php to display this way, but no luck with the email part yet. I'm probably missing something simple... it's been a long session.

Any pointers would be greatly appreciated. In the meantime, i will watch mighty boosh and then have another bash with a fresh mind /smile.gif' class='bbc_emoticon' alt=':)' />

Thx

Bee
There are 10 types of people in this world, those who understand binary and those who don't...

#310   bluebozzle

bluebozzle
  • Members
  • 2 posts
  • Real Name:Adam Burrough
  • Gender:Male
  • Location:Isle of Wight

Posted 05 May 2009 - 12:40

When implementing that change i get this error:

Parse error: parse error, unexpected T_ELSEIF in /home/customers/bleie/www.domain.com/catalog/admin/categories.php on line 256

----

When I try to checkout, /catalog/checkout_confirmation.php gives me this 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 '' at line 1

SELECT products_bundle FROM products where products_id =

[TEP STOP]

The strange thing is that i cannot find this line in checkout_confirmation.php or any other file for that sake.

Anyhow, I think the error may be here(checkout_confirmation.php):
// Stock Check
if (STOCK_CHECK == 'true') {
$bundle_status_query = tep_db_query("SELECT products_bundle FROM " . TABLE_PRODUCTS . " where products_id = " . tep_get_prid($order->products[$i]['id']));
$bundle_status = tep_db_fetch_array($bundle_status_query);


I got the same error and your right, the error is in checkout_confirmation.php. I looked at this forum and found people like yourself with the same problem, but no fixes, so went through the code myself and found the error. Having fixed it, I thought of your entry and so posting my fix to you.

if (STOCK_CHECK == 'true') {
$bundle_status_query = tep_db_query("SELECT products_bundle FROM " . TABLE_PRODUCTS . " where products_id = '1'" . tep_get_prid($order->products[$i]['id']));
$bundle_status = tep_db_fetch_array($bundle_query_raw);

#311   bluebozzle

bluebozzle
  • Members
  • 2 posts
  • Real Name:Adam Burrough
  • Gender:Male
  • Location:Isle of Wight

Posted 05 May 2009 - 14:46

I got the same error and your right, the error is in checkout_confirmation.php. I looked at this forum and found people like yourself with the same problem, but no fixes, so went through the code myself and found the error. Having fixed it, I thought of your entry and so posting my fix to you.

if (STOCK_CHECK == 'true') {
$bundle_status_query = tep_db_query("SELECT products_bundle FROM " . TABLE_PRODUCTS . " where products_id = '1'" . tep_get_prid($order->products[$i]['id']));
$bundle_status = tep_db_fetch_array($bundle_query_raw);


Ignore last post as I had a problem in checkout with:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\xxx\xxx\includes\functions\database.php on line 99
so I commented out the above code and it now works.

COPY THIS CODE:
if (STOCK_CHECK == 'true') {
// $bundle_status_query = tep_db_query("select products_bundle from " . TABLE_PRODUCTS . " where products_id = ''" . tep_get_prid($order->products[$i]['id']));
// $bundle_status = tep_db_fetch_array($bundle_query_raw);


#312   nnclyn

nnclyn
  • Members
  • 265 posts
  • Real Name:Nancy O

Posted 28 May 2009 - 15:59

For some reason, all of my products are showing as being out of stock and I haven't even applied ths contribution to any products yet. I do not use "check stock level".

Any ideas on what might be wrong?
Nancy

#313   Peter M

Peter M
  • Members
  • 52 posts
  • Real Name:Peter Milner
  • Gender:Male
  • Location:South West UK

Posted 16 January 2010 - 13:56

For some reason, all of my products are showing as being out of stock and I haven't even applied ths contribution to any products yet. I do not use "check stock level".

Any ideas on what might be wrong?


Hi, I have found the code that does this, its in catalog/includes/modules/product_listing.php

Do a search for the following code;

// BOF Bundled Products
          case 'PRODUCT_LIST_BUY_NOW':
            $lc_align = 'center';
            $StockChecker1 = tep_get_products_stock($listing['products_id']);
	          if ( $StockChecker1 <> 0){
                $lc_text = (($listing['products_price'] > 0) ? '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>&nbsp;' : '&nbsp;');
	          }else{    
                $lc_text = tep_image_button('button_out_of_stock.gif', IMAGE_BUTTON_OUT_OF_STOCK) . '&nbsp;';
	          }
	          break;
          // EOF Bundled Products

As you can see, it's checking to see if the stock level is <> 0, if so, it displays the Buy It Now button, if not, i.e. the stock level is 0 it displays the Out of Stock image instead.

I am currently looking at this code with the view to modifying it to include the check to see whether stock checking is turned on or off in the stock section of the configuration part of the Admin area.

Once I have figured it out, I will post the modified code here too, so keep an eye out for it;)

#314   Peter M

Peter M
  • Members
  • 52 posts
  • Real Name:Peter Milner
  • Gender:Male
  • Location:South West UK

Posted 18 January 2010 - 12:30

Hi Again,

I have now modified the code to comply with the stock settings in the admin panel. It now checks to see whether both stock check and Allow Checkout are enabled or not.

// BOF Bundled Products
          case 'PRODUCT_LIST_BUY_NOW':
            $lc_align = 'center';
            $StockChecker1 = tep_get_products_stock($listing['products_id']);
	          
		  // Peter Milner - Phoenix Model Aviation Ltd (www.phoenixmodelaviation.co.uk)
		  // Check to see if stock_check is true or false, also check stock_allow_checkout is true or false
		  	 if  (STOCK_CHECK == 'true') 
			 {
			 		if  ($StockChecker1 < 1)
					{
			 			if  (STOCK_ALLOW_CHECKOUT == 'false')
			  			{
			  			$lc_text = tep_image_button('button_out_of_stock.gif', IMAGE_BUTTON_OUT_OF_STOCK) . '&nbsp;';
			  			}
						else
						{
						$lc_text = (($listing['products_price'] > 0) ? '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>&nbsp;' : '&nbsp;');
			 		    }
			  	   }
				   else
				   {
				   $lc_text = (($listing['products_price'] > 0) ? '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>&nbsp;' : '&nbsp;');
				   }
			  }
			  else
			  {
			    $lc_text = (($listing['products_price'] > 0) ? '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>&nbsp;' : '&nbsp;');
			  }
			  break;


#315   canadianvapour

canadianvapour
  • Members
  • 4 posts
  • Real Name:sean

Posted 26 May 2010 - 01:27

Every time i try and update products with bundles i get :
1146 - Table '*******.TABLE_PRODUCTS_BUNDLES' doesn't exist

DELETE FROM TABLE_PRODUCTS_BUNDLES WHERE bundle_id = '63'

[TEP STOP]


My webmaster cant figure out what to do so i am at the mercy of the forum /smile.gif' class='bbc_emoticon' alt=':)' />

What have i done wrong? the install instructions are not any help i am lost

please someone help:(

#316   germ

germ
  • Members
  • 13,921 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 26 May 2010 - 01:36

Every time i try and update products with bundles i get :
1146 - Table '*******.TABLE_PRODUCTS_BUNDLES' doesn't exist

DELETE FROM TABLE_PRODUCTS_BUNDLES WHERE bundle_id = '63'

[TEP STOP]


My webmaster cant figure out what to do so i am at the mercy of the forum /smile.gif' class='bbc_emoticon' alt=':)' />

What have i done wrong? the install instructions are not any help i am lost

please someone help:(

Check the files on the server that these changes in the install directione were made and in fact still exist:

######################################################
STEP 3: /catalog/includes/database_tables.php

***ADD BEFORE FINAL ?>:

// BOF Bundled Products
define('TABLE_PRODUCTS_BUNDLES', 'products_bundles');
// EOF Bundled Products

######################################################
STEP 4: /catalog/admin/includes/database_tables.php
***ADD BEFORE FINAL ?>:

// BOF Bundled Products
define('TABLE_PRODUCTS_BUNDLES', 'products_bundles');
// EOF Bundled Products
######################################################


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -

"Headers already sent" - The definitive help

"Cannot redeclare ..." - How to find/fix it

SSL Implementation Help

Like this post? "Like" it again over there >

#317   canadianvapour

canadianvapour
  • Members
  • 4 posts
  • Real Name:sean

Posted 26 May 2010 - 02:15

Check the files on the server that these changes in the install directione were made and in fact still exist:

i have changed all files you suggested and still get 1146 - Table '***********.products_bundles' doesn't exist

DELETE FROM products_bundles WHERE bundle_id = '64'

#318   germ

germ
  • Members
  • 13,921 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 26 May 2010 - 16:37

i have changed all files you suggested and still get 1146 - Table '***********.products_bundles' doesn't exist

DELETE FROM products_bundles WHERE bundle_id = '64'

Not quite the same error.

Notice how the missing table name changed from UPPER CASE to lower case.

Now it's telling you the table doen't exist in the database.

The previous error was indicative of the table name constant not being defined.
If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -

"Headers already sent" - The definitive help

"Cannot redeclare ..." - How to find/fix it

SSL Implementation Help

Like this post? "Like" it again over there >

#319   canadianvapour

canadianvapour
  • Members
  • 4 posts
  • Real Name:sean

Posted 26 May 2010 - 16:41

Not quite the same error.

Notice how the missing table name changed from UPPER CASE to lower case.

Now it's telling you the table doen't exist in the database.

The previous error was indicative of the table name constant not being defined.



im so lost. i have no idea how i got into this so deep. any chance you may be able to help me with the new error?

#320   germ

germ
  • Members
  • 13,921 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 26 May 2010 - 16:50

im so lost. i have no idea how i got into this so deep. any chance you may be able to help me with the new error?

I'm so lost, too...

Did this contribution get installed recently or has it been around on the site for a while?
/unsure.gif' class='bbc_emoticon' alt=':unsure:' />
If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -

"Headers already sent" - The definitive help

"Cannot redeclare ..." - How to find/fix it

SSL Implementation Help

Like this post? "Like" it again over there >