# Bundled products

## Recommended Posts

Here's a screenshot of what it should look like...

##### Share on other sites

I've been having a problem with this mod. I have the April 14 version installed with the update for the graphics/links. Every times someone ordered a bundle, It doesn't add the bundle to the cart when they checkout. Let me explain further. Say someone orders bundle #1. When they checkout, it charges them for bunndle #1, but doesn't appear in their cart when I go to update the order status. I have the unsold carts mod installed so I went there and sure enough the bundle was sitting in their unsold cart. Also, the server didn't email me their order this time like it usually does (but this could be an unrelated issue). Is there any way to get it to SAVE the bundle in their cart so I don't have to go through the trouble of re-adding it to their cart in order to print invoice, packing slips, etc?

Any help is appreciated.

Thanks.

##### Share on other sites

I already have installed QT PRO. Now I want to install this contribution. But I have one step that I don't know how to do!

checkout_process.php

QT PRO:

? ? ?if (is_array(\$products_attributes)) {
? ? ? ?\$stock_query_raw .= " AND pa.options_id = '" . \$products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . \$products_attributes[0]['value_id'] . "'";
? ? ?}
? ? ?\$stock_query = tep_db_query(\$stock_query_raw);
? ? ?if (tep_db_num_rows(\$stock_query) > 0) {
? ? ? ?\$stock_values = tep_db_fetch_array(\$stock_query);
//++++ QT Pro: Begin Changed code
? ? ? ?\$actual_stock_bought = \$order->products[\$i]['qty'];
? ? ? ?if ((DOWNLOAD_ENABLED == 'true') && isset(\$stock_values['products_attributes_filename']) && tep_not_null(\$stock_values['products_attributes_filename'])) {
? ? ? ? ?\$download_selected = true;
? ? ? ?}
// ? ? ?If not downloadable and attributes present, adjust attribute stock
? ? ? ?if (!\$download_selected && is_array(\$products_attributes)) {
? ? ? ? ?\$all_nonstocked = true;
? ? ? ? ?\$products_stock_attributes_array = array();
? ? ? ? ?foreach (\$products_attributes as \$attribute) {
? ? ? ? ? ?if (\$attribute['track_stock'] == 1) {
? ? ? ? ? ? ?\$products_stock_attributes_array[] = \$attribute['option_id'] . "-" . \$attribute['value_id'];
? ? ? ? ? ? ?\$all_nonstocked = false;
? ? ? ? ? ?}
? ? ? ? ?}
? ? ? ? ?if (\$all_nonstocked) {
? ? ? ? ? ?\$actual_stock_bought = \$order->products[\$i]['qty'];
? ? ? ? ?} ?else {
? ? ? ? ? ?asort(\$products_stock_attributes_array, SORT_NUMERIC);
? ? ? ? ? ?\$products_stock_attributes = implode(",", \$products_stock_attributes_array);
? ? ? ? ? ?\$attributes_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_stock_attributes = '\$products_stock_attributes' AND products_id = '" . tep_get_prid(\$order->products[\$i]['id']) . "'");
? ? ? ? ? ?if (tep_db_num_rows(\$attributes_stock_query) > 0) {
? ? ? ? ? ? ?\$attributes_stock_values = tep_db_fetch_array(\$attributes_stock_query);
? ? ? ? ? ? ?\$attributes_stock_left = \$attributes_stock_values['products_stock_quantity'] - \$order->products[\$i]['qty'];
? ? ? ? ? ? ?tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '" . \$attributes_stock_left . "' where products_stock_attributes = '\$products_stock_attributes' AND products_id = '" . tep_get_prid(\$order->products[\$i]['id']) . "'");
? ? ? ? ? ? ?\$actual_stock_bought = (\$attributes_stock_left < 1) ? \$attributes_stock_values['products_stock_quantity'] : \$order->products[\$i]['qty'];
? ? ? ? ? ?} else {
? ? ? ? ? ? ?\$attributes_stock_left = 0 - \$order->products[\$i]['qty'];
? ? ? ? ? ? ?tep_db_query("insert into " . TABLE_PRODUCTS_STOCK . " (products_id, products_stock_attributes, products_stock_quantity) values ('" . tep_get_prid(\$order->products[\$i]['id']) . "', '" . \$products_stock_attributes . "', '" . \$attributes_stock_left . "')");
? ? ? ? ? ? ?\$actual_stock_bought = 0;
? ? ? ? ? ?}
? ? ? ? ?}
? ? ? ?}
// ? ? ? ?\$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid(\$order->products[\$i]['id']) . "'");
// ? ? ?}
// ? ? ?if (tep_db_num_rows(\$stock_query) > 0) {
// ? ? ? ?\$stock_values = tep_db_fetch_array(\$stock_query);
// do not decrement quantities if products_attributes_filename exists
? ? ? ? ?\$stock_left = \$stock_values['products_quantity'] - \$actual_stock_bought;
? ? ? ? ?tep_db_query("UPDATE " . TABLE_PRODUCTS . "
? ? ? ? ? ? ? ? ? ? ? ?SET products_quantity = products_quantity - '" . \$actual_stock_bought . "'
? ? ? ? ? ? ? ? ? ? ? ?WHERE products_id = '" . tep_get_prid(\$order->products[\$i]['id']) . "'");
//++++ QT Pro: End Changed Code
? ? ? ? ?if ( (\$stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
? ? ? ? ? ?tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid(\$order->products[\$i]['id']) . "'");
? ? ? ? ?}
? ? ? ?}
? ? ?}
//++++ QT Pro: Begin Changed code
? ?}
//++++ QT Pro: End Changed Code

The section is confuse with Bundle Product:

?for (\$i=0, \$n=sizeof(\$order->products); \$i<\$n; \$i++) {
// Stock Update - Joao Correia
? ?if (STOCK_LIMITED == 'true') {
? ? ?if (DOWNLOAD_ENABLED == 'true') {
? ? ? ?\$stock_query_raw = "SELECT products_quantity, products_bundle, pad.products_attributes_filename
? ? ? ? ? ? ? ? ? ? ? ? ? ?FROM " . TABLE_PRODUCTS . " p
? ? ? ? ? ? ? ? ? ? ? ? ? ?LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
? ? ? ? ? ? ? ? ? ? ? ? ? ? ON p.products_id=pa.products_id
? ? ? ? ? ? ? ? ? ? ? ? ? ?LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
? ? ? ? ? ? ? ? ? ? ? ? ? ? ON pa.products_attributes_id=pad.products_attributes_id
? ? ? ? ? ? ? ? ? ? ? ? ? ?WHERE p.products_id = '" . tep_get_prid(\$order->products[\$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
? ? ? ?\$products_attributes = \$order->products[\$i]['attributes'];
? ? ? ?if (is_array(\$products_attributes)) {
? ? ? ? ?\$stock_query_raw .= " AND pa.options_id = '" . \$products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . \$products_attributes[0]['value_id'] . "'";
? ? ? ?}
? ? ? ?\$stock_query = tep_db_query(\$stock_query_raw);
? ? ?} else {
? ? ? ?\$stock_query = tep_db_query("select products_quantity, products_bundle from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid(\$order->products[\$i]['id']) . "'");
? ? ?}
? ?
? ? ?if (tep_db_num_rows(\$stock_query) > 0) {
? ? ? ?\$stock_values = tep_db_fetch_array(\$stock_query);
? ? ? ?if (\$stock_values['products_bundle'] == 'yes') {
? ? ? ? // order item is a bundle and must be separated
? ? ? ? \$report_text .= "Bundle found in order : " . tep_get_prid(\$order->products[\$i]['id']) . "<br>\n";
? ? ? ? ? \$bundle_query = tep_db_query("select pb.subproduct_id, pb.subproduct_qty, p.products_model, 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 = '" . tep_get_prid(\$order->products[\$i]['id']) . "'");

? ? ? ? while (\$bundle_data = tep_db_fetch_array(\$bundle_query)) {
? ? ? ? ? ?if (\$bundle_data['products_bundle'] == "yes") {
? ? ? ? ? ? ? \$report_text .= "<br>level 2 bundle found in order : ?" . \$bundle_data['products_model'] . "<br>";
? ? ? ? ? ? ? ? \$bundle_query_nested = tep_db_query("select pb.subproduct_id, pb.subproduct_qty, p.products_model, 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)) {
? ? ? ? ? ? ? ? ?\$stock_left = \$bundle_data_nested['products_quantity'] - \$bundle_data_nested['subproduct_qty'] * \$order->products[\$i]['qty'];
? ? ? ? ? ? ? ? ?\$report_text .= "updating level 2 item " . \$bundle_data_nested['products_model'] . " : was " . \$bundle_data_nested['products_quantity'] . " and number ordered is " . (\$bundle_data_nested['subproduct_qty'] * \$order->products[\$i]['qty']) . " <br>\n";
? ? ? ? ? ? ? ? ?tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . \$stock_left . "' where products_id = '" . \$bundle_data_nested['subproduct_id'] . "'");
? ? ? ? ? ? ? }
? ? ? ? ? ?} else {
? ? ? ? ? ? ? \$stock_left = \$bundle_data['products_quantity'] - \$bundle_data['subproduct_qty'] * \$order->products[\$i]['qty'];
? ? ? ? ? ? ? \$report_text .= "updating level 1 item " . \$bundle_data['products_model'] . " : was " . \$bundle_data['products_quantity'] . " and number ordered is " . (\$bundle_data['subproduct_qty'] * \$order->products[\$i]['qty']) . " <br>\n";
? ? ? ? ? ? ? tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . \$stock_left . "' where products_id = '" . \$bundle_data['subproduct_id'] . "'");
? ? ? ? ? ?}
? ? ? ? }
? ? ? ? ?
? ? ? ?} else {
// order item is normal and should be treated as such
? ? ? ? \$report_text .= "Normal product found in order : " . tep_get_prid(\$order->products[\$i]['id']) . "\n";
// do not decrement quantities if products_attributes_filename exists
? ? ? ? ? if ((DOWNLOAD_ENABLED != 'true') || (!\$stock_values['products_attributes_filename'])) {
? ? ? ? ? ? \$stock_left = \$stock_values['products_quantity'] - \$order->products[\$i]['qty'];
? ? ? ? ? } else {
? ? ? ? ? ? \$stock_left = \$stock_values['products_quantity'];
? ? ? ? ? }
? ? ? ? ? tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . \$stock_left . "' where products_id = '" . tep_get_prid(\$order->products[\$i]['id']) . "'");
? ? ? ? ? if ( (\$stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
? ? ? ? ? ? tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid(\$order->products[\$i]['id']) . "'");
? ? ? ? ? }
? ? ? ?}
? ? ?}
? ?}

Edited by randychang

##### Share on other sites

Regarding your bundle products mod... Our store is selling magazine subscriptions so the whole purpose in using your mod is to be able to have like 6 magazines and allow the customer to select 3 of those for a set price.

I was wondering if you had any tips/tricks for adapting your mod to our needs?

##### Share on other sites

Update!

The stock level is now checked BEFORE the order is made.

Bundles where the subproducts are out of stock cannot be purchased. You can buy as many as the stock will allow.

http://www.oscommerce.com/community/contributions,2015

Dave

- osCommerce is fun! -

##### Share on other sites

double post

Edited by sosidge

- osCommerce is fun! -

##### Share on other sites

triple post

Edited by sosidge

- osCommerce is fun! -

##### Share on other sites

I've just installed a "Bundled Products v1.4". When I go to Admin section, I get the following error:

Parse error: parse error in .............\osCommerce\admin\categories.php on line 325
Does anybody have any idea what can cause this error?

Irina.

##### Share on other sites

Parse error is usually a missing bracket.

First of all, double check that you have copied the code EXACTLY as detailed in the readme.

If there are no errors, please post the code you have around line 325 of that file.

It is not an area of code that is changed by this contribution in a standard installation.

Edited by sosidge

- osCommerce is fun! -

##### Share on other sites
Parse error is usually a missing bracket.

First of all, double check that you have copied the code EXACTLY as detailed in the readme.

If there are no errors, please post the code you have around line 325 of that file.

It is not an area of code that is changed by this contribution in a standard installation.

Here is my admin/categories.php code, lines 267 through 350 (line 325: case 'copy_to_confirm': ):

\$sql_data_array = array_merge(\$sql_data_array, \$update_sql_data);

tep_db_perform(TABLE_PRODUCTS, \$sql_data_array, 'update', "products_id = '" . (int)\$products_id . "'");
// update bundle contents
if (\$HTTP_POST_VARS['products_bundle'] == "yes") {
tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . \$products_id . "'");
for (\$i=0, \$n=6; \$i<\$n; \$i++) {
if (isset(\$HTTP_POST_VARS['subproduct_' . \$i . '_qty']) && \$HTTP_POST_VARS['subproduct_' . \$i . '_qty'] > 0) {
tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . \$products_id . "', '" . \$HTTP_POST_VARS['subproduct_' . \$i . '_id'] . "', '" . \$HTTP_POST_VARS['subproduct_' . \$i . '_qty'] . "')");
}
}
// X-SELL by Kavita Begin
\$selected_xsellids = \$HTTP_POST_VARS['products_xsell_ids'];
if (\$selected_xsellids)
{
tep_db_query("DELETE FROM " . TABLE_PRODUCTS_XSELL . " WHERE products_id = '".(int)\$products_id . "'");
\$selected_xsellids = array_reverse(\$selected_xsellids);
\$s = 0;
foreach (\$selected_xsellids as \$xsell_product_id)
{
\$s += 1;
tep_db_query("insert into " . TABLE_PRODUCTS_XSELL . " (products_id, xsell_id, sort_order) values ('" . \$products_id . "', '" . \$xsell_product_id . "','" . \$s . "')");
}
}
// X-SELL by Kavita End
}

\$languages = tep_get_languages();
for (\$i=0, \$n=sizeof(\$languages); \$i<\$n; \$i++) {
\$language_id = \$languages[\$i]['id'];

\$sql_data_array = array('products_name' => tep_db_prepare_input(\$HTTP_POST_VARS['products_name'][\$language_id]),
'products_description' => tep_db_prepare_input(\$HTTP_POST_VARS['products_description'][\$language_id]),
'products_url' => tep_db_prepare_input(\$HTTP_POST_VARS['products_url'][\$language_id]));

if (\$action == 'insert_product') {
\$insert_sql_data = array('products_id' => \$products_id,
'language_id' => \$language_id);

\$sql_data_array = array_merge(\$sql_data_array, \$insert_sql_data);

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, \$sql_data_array);
} elseif (\$action == 'update_product') {
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, \$sql_data_array, 'update', "products_id = '" . (int)\$products_id . "' and language_id = '" . (int)\$language_id . "'");
}
}

if (USE_CACHE == 'true') {
tep_reset_cache_block('categories');
tep_reset_cache_block('also_purchased');
}

// commented and replaced for product attributes contrib
//        tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . \$cPath . '&pID=' . \$products_id));
tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . \$cPath . '&pID=' . \$products_id . '&action=new_product'));
// end replacement
}
break;
case 'copy_to_confirm':
if (isset(\$HTTP_POST_VARS['products_id']) && isset(\$HTTP_POST_VARS['categories_id'])) {
\$products_id = tep_db_prepare_input(\$HTTP_POST_VARS['products_id']);
\$categories_id = tep_db_prepare_input(\$HTTP_POST_VARS['categories_id']);

if (\$HTTP_POST_VARS['copy_as'] == 'link') {
if (\$categories_id != \$current_category_id) {
\$check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)\$products_id . "' and categories_id = '" . (int)\$categories_id . "'");
\$check = tep_db_fetch_array(\$check_query);
if (\$check['total'] < '1') {
tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)\$products_id . "', '" . (int)\$categories_id . "')");
}
} else {
}
} elseif (\$HTTP_POST_VARS['copy_as'] == 'duplicate') {
\$product_query = tep_db_query("select products_quantity, products_model, products_image, products_pdfupload, products_price, products_cost, products_date_available, products_weight, products_tax_class_id, manufacturers_id, products_bundle from " . TABLE_PRODUCTS . " where products_id = '" . (int)\$products_id . "'");
\$product = tep_db_fetch_array(\$product_query);

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_pdfupload, products_price, products_cost, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, products_bundle) values ('" . tep_db_input(\$product['products_quantity']) . "', '" . tep_db_input(\$product['products_model']) . "', '" . tep_db_input(\$product['products_image']) . "', '" . tep_db_input(\$product['products_pdfupload']) . "', '". tep_db_input(\$product['products_price']) . "',  '" . tep_db_input(\$product['products_bundle']) . "', '" . tep_db_input(\$product['products_cost']) . "', now(), '" . tep_db_input(\$product['products_date_available']) . "', '" . tep_db_input(\$product['products_weight']) . "', '0', '" . (int)\$product['products_tax_class_id'] . "', '" . (int)\$product['manufacturers_id'] . "')");
\$dup_products_id = tep_db_insert_id();

\$description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)\$products_id . "'");
while (\$description = tep_db_fetch_array(\$description_query)) {
tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)\$dup_products_id . "', '" . (int)\$description['language_id'] . "', '" . tep_db_input(\$description['products_name']) . "', '" . tep_db_input(\$description['products_description']) . "', '" . tep_db_input(\$description['products_url']) . "', '0')");
}

Thanks.

##### Share on other sites

As far as I can tell you have missed out a closing curly bracket from this section...

// update bundle contents
if (\$HTTP_POST_VARS['products_bundle'] == "yes") {
tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . \$products_id . "'");
for (\$i=0, \$n=6; \$i<\$n; \$i++) {
if (isset(\$HTTP_POST_VARS['subproduct_' . \$i . '_qty']) && \$HTTP_POST_VARS['subproduct_' . \$i . '_qty'] > 0) {
tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . \$products_id . "', '" . \$HTTP_POST_VARS['subproduct_' . \$i . '_id'] . "', '" . \$HTTP_POST_VARS['subproduct_' . \$i . '_qty'] . "')");
}
}

// update bundle contents
if (\$HTTP_POST_VARS['products_bundle'] == "yes") {
tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . \$products_id . "'");
for (\$i=0, \$n=6; \$i<\$n; \$i++) {
if (isset(\$HTTP_POST_VARS['subproduct_' . \$i . '_qty']) && \$HTTP_POST_VARS['subproduct_' . \$i . '_qty'] > 0) {
tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . \$products_id . "', '" . \$HTTP_POST_VARS['subproduct_' . \$i . '_id'] . "', '" . \$HTTP_POST_VARS['subproduct_' . \$i . '_qty'] . "')");
}
}
}

(note the third bracket at the end of the code section).

- osCommerce is fun! -

##### Share on other sites
As far as I can tell you have missed out a closing curly bracket from this section...

// update bundle contents
? ? ? ? if (\$HTTP_POST_VARS['products_bundle'] == "yes") {
? ? ? ? ? tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . \$products_id . "'");
? ? ? ? ? for (\$i=0, \$n=6; \$i<\$n; \$i++) {
? ? ? ? ? ? if (isset(\$HTTP_POST_VARS['subproduct_' . \$i . '_qty']) && \$HTTP_POST_VARS['subproduct_' . \$i . '_qty'] > 0) {
? ? ? ? ? ? ? tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . \$products_id . "', '" . \$HTTP_POST_VARS['subproduct_' . \$i . '_id'] . "', '" . \$HTTP_POST_VARS['subproduct_' . \$i . '_qty'] . "')");
? ? ? ? ? ? }
? ? ? ? ? }

// update bundle contents
? ? ? ? if (\$HTTP_POST_VARS['products_bundle'] == "yes") {
? ? ? ? ? tep_db_query("DELETE FROM products_bundles WHERE bundle_id = '" . \$products_id . "'");
? ? ? ? ? for (\$i=0, \$n=6; \$i<\$n; \$i++) {
? ? ? ? ? ? if (isset(\$HTTP_POST_VARS['subproduct_' . \$i . '_qty']) && \$HTTP_POST_VARS['subproduct_' . \$i . '_qty'] > 0) {
? ? ? ? ? ? ? tep_db_query("INSERT INTO products_bundles (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . \$products_id . "', '" . \$HTTP_POST_VARS['subproduct_' . \$i . '_id'] . "', '" . \$HTTP_POST_VARS['subproduct_' . \$i . '_qty'] . "')");
? ? ? ? ? ? }
? ? ? ? ? }
? ? ? ? }

(note the third bracket at the end of the code section).

Ok, I added that missing third bracket and now I get error:

Parse error: parse error in .......\osCommerce\admin\categories.php on line 1557

My last line in this file is 1556:

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Any ideas?

Thanks.

Edited by Irin

##### Share on other sites

There is probably still a } bracket missing somewhere.

DOUBLE DOUBLE check the code you have added with the contribution, and check you have not deleted any other } brackets by mistake.

- osCommerce is fun! -

##### Share on other sites
There is probably still a } bracket missing somewhere.

DOUBLE DOUBLE check the code you have added with the contribution, and check you have not deleted any other } brackets by mistake.

Ok, I found some more missing brackets. Now it's ok. I have a question, though. How can I set a bundle and let the customers see their savings if purchased a bundle instead of separate items? Shoud I make a new product as a bundle with a discounted price?

Thanks,

Irina.

Edited by Irin

##### Share on other sites

The bundle does this as standard.

You will see the saving listed at the bottom of the bundle list in product_info.php

- osCommerce is fun! -

##### Share on other sites
The bundle does this as standard.

You will see the saving listed at the bottom of the bundle list in product_info.php

But in order to see that saving, should I add a new product as a bundle with a discounted price to my catalog? Or I just can add an additional items to my existing product to make it a bundle? In this case I won't have my product listed separately...

Thanks.

Edited by Irin

##### Share on other sites

Yes, you need to have the subproducts listed seperately, then create the bundle from them.

- osCommerce is fun! -

##### Share on other sites
Yes, you need to have the subproducts listed seperately, then create the bundle from them.

Can I add subproducts to a main product instead of adding a main product to subproducts to make it a bundle? And how customer can buy a bundle if there is no Add to Cart for the whole bundle? It just listed as an option.

Thanks.

##### Share on other sites

You're trying to use the contribution in the wrong way.

The bundle is only a "virtual" product, it is ONLY used to hold together the subproducts inside it.

You can't make a bundle out of itself.

So, you MUST list all the individual subproducts individually before making a bundle with them.

If you don't want the actual subproducts to be visible to the customer, I suppose you could set them to be a "red dot" in admin.

And the last comment about Add To Cart I don't understand, because I have no problems adding the bundle to the cart in my installation.

- osCommerce is fun! -

##### Share on other sites
You're trying to use the contribution in the wrong way.

The bundle is only a "virtual" product, it is ONLY used to hold together the subproducts inside it.

You can't make a bundle out of itself.

So, you MUST list all the individual subproducts individually before making a bundle with them.

If you don't want the actual subproducts to be visible to the customer, I suppose you could set them to be a "red dot" in admin.

And the last comment about Add To Cart I don't understand, because I have no problems adding the bundle to the cart in my installation.

May be I'm trying to use it in the wrong way indeed. I have all my products listed separately. What I'm trying to do is create a bundle from an existing products by combining a main product with some accessories together and making a discount for the whole bundle. So customer can save some money if buying them as a kit, not just one by one. But I still want to give a customer an option to choose between purchasing a kit or just separate product. My Add to Cart is just for one product, not a bundle. Does it make any sense?

Thanks.

##### Share on other sites

What you are describing is EXACTLY what the contribution does as standard. I'm getting quite confused about why you have problems.

Example:

I have three products in my shop. Apples, Pears and Bananas.

Each fruit costs ?1 each.

I want to offer my customers one of each for ?2.50 - a 50p saving.

So I create ANOTHER product - a bundle - that costs ?2.50, and includes 1x Apple, 1x Pear and 1x Banana.

When customers look at the bundle, they see what it includes, how much it costs, and how much the saving is.

They can still buy Apples, Pears and Bananas individually too if they want.

The bundle and the individual products can all be added to the cart. In the cart, the bundle just shows as a bundle, it does not break up into the indvidual products.

- osCommerce is fun! -

##### Share on other sites
What you are describing is EXACTLY what the contribution does as standard. I'm getting quite confused about why you have problems.

Example:

I have three products in my shop. Apples, Pears and Bananas.

Each fruit costs ?1 each.

I want to offer my customers one of each for ?2.50 - a 50p saving.

So I create ANOTHER product - a bundle - that costs ?2.50, and includes 1x Apple, 1x Pear and 1x Banana.

When customers look at the bundle, they see what it includes, how much it costs, and how much the saving is.

They can still buy Apples, Pears and Bananas individually too if they want.

The bundle and the individual products can all be added to the cart. In the cart, the bundle just shows as a bundle, it does not break up into the indvidual products.

From your reply I understand that I need to create a new product as a bundle or kit, not just add subproducts to the existing product. Am I right?

Thanks.

Edited by Irin

##### Share on other sites

That's right. The bundle is a NEW, SEPERATE product.

- osCommerce is fun! -

##### Share on other sites
Update!

The stock level is now checked BEFORE the order is made.

Bundles where the subproducts are out of stock cannot be purchased. You can buy as many as the stock will allow.

http://www.oscommerce.com/community/contributions,2015

Dave

Just installed v1.4 and everything seems to be working. My store is not "live" yet but I have made a few test orders. For those interested I also have 1) Downloads Controller 2) PayPal IPN (osCommerce version) and 3)Quantity Price Breaks per Product installed. There was only one conflicting line with QPBPP (line #72 --In /catalog/admin/categories.php but it was easy to combine into

\$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)\$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)\$languages_id . "'");

I do have one question, it is somewhat of a repeat of an unanswered question earlier in this topic. The bundles that I am creating are software downloads, so when a bundle is purchased I need to provide the download. I can accomplish this by creating product attributes and assigning multiple attributes to the "bundled" product. Is there way to allow existing attributes of the sub products of a bundle to be included with the bundle? If not, any ideas on where to start?

Thanks to everyone that has added to or helped with this contribution.

Brian

##### Share on other sites
snip...

If not, any ideas on where to start?

I've looked into this and I think I may have a solution. The list of downloads available for an order is stored in the table orders_products_download which gets updated in checkout_process.php. Currently it just uses the order_products to find downloads and update the table. However, if a check could be performed to see if the order_products is a bundle, then the subproduct_id(s) from the products_bundles table could be used to update the orders_products_download for the order.

My first question is am I on the right track and the next question is can someone help my with implementing?

Thanks,

Brian

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account