Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Bundled products


Recommended Posts

Hi, gotta say that this is a really good mod. There are so many situations where this is going to come in handy :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! ;)

Link to comment
Share on other sites

  • Replies 331
  • Created
  • Last Reply

Top Posters In This Topic

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?

Link to comment
Share on other sites

  • 4 weeks later...

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> ' : ' ');
		  }else{	
			$lc_text = tep_image_button('button_out_of_stock.gif', IMAGE_BUTTON_OUT_OF_STOCK) . ' ';
		  }
		  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> ' . tep_draw_input_field('list_quantity', '1', 'size=2') . '<br><br>' . tep_image_submit('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</form> ' . ' <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;

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

  • 2 weeks later...

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 :)

 

Thx

 

Bee

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

Link to comment
Share on other sites

  • 2 weeks later...
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);

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

  • 4 weeks later...

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?

Link to comment
Share on other sites

  • 7 months later...

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> ' : ' ');
          }else{    
               $lc_text = tep_image_button('button_out_of_stock.gif', IMAGE_BUTTON_OUT_OF_STOCK) . ' ';
          }
          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;)

Link to comment
Share on other sites

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) . ' ';
		  			}
					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> ' : ' ');
		 		    }
		  	   }
			   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> ' : ' ');
			   }
		  }
		  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> ' : ' ');
		  }
		  break;

Link to comment
Share on other sites

  • 4 months later...

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 :)

 

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

 

please someone help:(

Link to comment
Share on other sites

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 :)

 

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 >

Link to comment
Share on other sites

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'

Link to comment
Share on other sites

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 >

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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:

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 >

Link to comment
Share on other sites

I'm so lost, too...

 

Did this contribution get installed recently or has it been around on the site for a while?

:unsure:

it has never worked. the guy that was building this website told me that all of this is beyond his experience and passed it off to me.

Link to comment
Share on other sites

it has never worked. the guy that was building this website told me that all of this is beyond his experience and passed it off to me.

There is a MYSQL file that comes with the contribution you have to run to add the table to the database.

 

This person's profile contains some instructions on how to accomplish that.

 

That's about all I can do...

:blush:

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 >

Link to comment
Share on other sites

  • 9 months later...

Hello,

 

I have installed this plugin, and all working fine except if i select "This product is available for sale only as a part of a bundle." in the admin panel. It shows "Not Sold Separately" at a place of "Add to cart" button.

I donot know what i am missing. Can Any one help me out please

With many Thanks

 

Best Regards

Ralph

Link to comment
Share on other sites

Hello,

 

I have installed this plugin, and all working fine except if i select "This product is available for sale only as a part of a bundle." in the admin panel. It shows "Not Sold Separately" at a place of "Add to cart" button.

I donot know what i am missing. Can Any one help me out please

With many Thanks

 

Best Regards

Ralph

 

 

Ooh I was getting wrong. items added in the bundle should be "This product is available for sale only as a part of a bundle."

 

Regards

Ralph

Link to comment
Share on other sites

Hi,

 

all going good at my store from this excellent plugin. but i have installed oscommerce ultimate SEO plugin "http://www.oscommerce.com/community/contributions,2823".

Now its not updating cart with all the bundled products. it just add only the main item at which the bundle offer is offering.

 

for example:

http://www.shoppingtingle.com/old/matrix-p-6.html?osCsid=kokc6ijq5pm952derag19m3kr0

 

please help me with many thanks

 

 

Best Regards

Paula

Link to comment
Share on other sites

  • 1 month later...

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 :)

 

Thx

 

Bee

 

Bee, I would like to achieve the same. Have you solved the email problem ?

 

Also, could you share your fix to the admin order.php, invoice.php and packingslip.php (to list all the sub products within a bundle) ?

 

 

Thx

Link to comment
Share on other sites

  • 1 month later...

Something not right here

Can anyone please can help me with the following:

invoice.php and packingslip the same

$bundleContents = '';
$bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM " . TABLE_PRODUCTS . " p LEFT JOIN products_bundles pb ON (pb.bundle_id=p.products_id) LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = '1'");
while ($bundle = tep_db_fetch_array($bundle_query)) {
echo "<br> <i>" . $bundle['subproduct_qty'] . " x " . $bundle['products_name'] . "</i>";
}

before

      echo '        </td>' . "\n" .

On testing it locally code works 100%

when I send the file to server, refresh cache the changes does not reflect - stays the same.

 

Baffles me, anyone?

Getting the Phoenix off the ground

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