Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 1 votes

Bundled Products


48 replies to this topic

#41 shock01

  • Community Member
  • 2 posts
  • Real Name:Bruno

Posted 01 January 2011, 18:02

Quote

I have one problem with this contribution.
In the admin pannel when i add a new line (after the first 3) this appear but it dosen't work. I can't add the product in the new line. To add the product i have to exit from the product page and reenter, so i can add the new bundle product from the list.

Somebody can help me please?

p.s. sorry for my english.

First of all... happy new year!!!

About my post nobody can't help me?

Edited by shock01, 01 January 2011, 18:04.


#42 thedevilz

  • Community Member
  • 12 posts
  • Real Name:Paula
  • Gender:Female

Posted 14 March 2011, 17:04

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

#43 Peper

  • Community Member
  • 343 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 15 May 2011, 09:57

Thanks for this add on

Only would like to modify this to show products listed by sort order in products_info.php
in admin also to use some sorting by categories when using the drop down box to select product or to select product category first then product when using large store

Any help on this would be greatly appreciated
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.

#44 honda4

  • Community Member
  • 8 posts
  • Real Name:Rene van Maanen

Posted 07 August 2011, 18:18

I am currently preparing the install of this excellent module.

Can somebody clear out the comment:

***IMPORTANT NOTE If you do not use the MSRP contribution then make sure
that you delete the references to products_msrp from both queries above
in the section under calculate total MSRP and weight.

Waht exacly should the below code be changed to?

Thanks so much, HONDA4.

      	  // BOF Bundled Products
          if ($HTTP_POST_VARS['products_bundle'] == "yes") {
            $to_avoid = bundle_avoid($products_id);
            $subprods = array();
            $subprodqty = array();
            tep_db_query("DELETE FROM " . TABLE_PRODUCTS_BUNDLES . " WHERE bundle_id = '" . (int)$products_id . "'");
            for ($i=0, $n=100; $i<$n; $i++) {
              if (isset($HTTP_POST_VARS['subproduct_' . $i . '_qty']) && ((int)$HTTP_POST_VARS['subproduct_' . $i . '_qty'] > 0) && !in_array($HTTP_POST_VARS['subproduct_' . $i . '_id'], $to_avoid)) {
                if (in_array($HTTP_POST_VARS['subproduct_' . $i . '_id'], $subprods)) {
                  $subprodqty[$HTTP_POST_VARS['subproduct_' . $i . '_id']] += (int)$HTTP_POST_VARS['subproduct_' . $i . '_qty'];
                  tep_db_query('update ' . TABLE_PRODUCTS_BUNDLES . ' set subproduct_qty = ' . (int)$subprodqty[$HTTP_POST_VARS['subproduct_' . $i . '_id']] . ' where bundle_id = ' . (int)$products_id . ' and subproduct_id = ' . (int)$HTTP_POST_VARS['subproduct_' . $i . '_id']);
                } else {
                  $subprods[] = $HTTP_POST_VARS['subproduct_' . $i . '_id'];
                  $subprodqty[$HTTP_POST_VARS['subproduct_' . $i . '_id']] = (int)$HTTP_POST_VARS['subproduct_' . $i . '_qty'];
                  tep_db_query("INSERT INTO " . TABLE_PRODUCTS_BUNDLES . " (bundle_id, subproduct_id, subproduct_qty) VALUES ('" . (int)$products_id . "', '" . (int)$HTTP_POST_VARS['subproduct_' . $i . '_id'] . "', '" . (int)$HTTP_POST_VARS['subproduct_' . $i . '_qty'] . "')");
                }
       	      }
            }
            if (empty($subprods)) { // not a bundle if no subproducts set
              tep_db_query('update ' . TABLE_PRODUCTS . ' set products_bundle = "no" where products_id = ' . (int)$products_id);
            } else { // calculate total MSRP and weight from subproducts
              $msrp = 0;
              $weight = 0;
              foreach ($subprodqty as $id => $qty) {
                $subprod_query = tep_db_query('select products_msrp, products_weight from ' . TABLE_PRODUCTS . ' where products_id = ' . (int)$id);
                $subprod = tep_db_fetch_array($subprod_query);
                $msrp += ($subprod['products_msrp'] * $qty);
                $weight += ($subprod['products_weight'] * $qty);
              }
              tep_db_query('update ' . TABLE_PRODUCTS . ' set products_quantity = 1, products_msrp = "' . tep_db_input($msrp) . '", products_weight = "' . tep_db_input($weight) . '" where products_id = ' . (int)$products_id);
            }
          }
          // EOF Bundled Products

Edited by honda4, 07 August 2011, 18:19.


#45 honda4

  • Community Member
  • 8 posts
  • Real Name:Rene van Maanen

Posted 23 August 2011, 13:17

Kick...Anyone?

#46 hho

  • Community Member
  • 18 posts
  • Real Name:Hans
  • Gender:Male
  • Location:Rainy Sweden

Posted 28 October 2011, 12:28

Has anyone got this module to work on 2.3.1?

#47 guidocalvo

  • Community Member
  • 3 posts
  • Real Name:guido calvo

Posted 10 November 2011, 04:38

I had installed the bundled products add with out a problem. But know, I want to add the attributes on product listing add on, where the attributes of each products are shown down the product title at the product listing page, and not at the product info one.
How can I get to see the attributes for the products inside the bundle?
Thanks, hope you understand my problem.

#48 psytanium

  • Community Member
  • 18 posts
  • Real Name:Ludwig Arcache
  • Gender:Male
  • Location:Lebanon

Posted 07 February 2012, 13:20

Hi, i need some assistance plz, i have reach step 19
catalog/includes/classes/shopping_cart.php:

Can't find (under function add_cart):

$check_product_query = tep_db_query("select products_status from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$check_product = tep_db_fetch_array($check_product_query);

if (($check_product !== false) && ($check_product['products_status'] == '1')) {

here you have my current code:

<?php
/*
  $Id: shopping_cart.php,v 1.35 2003/06/25 21:14:33 hpdl Exp $
  E-Commerce Solutions
  Copyright (c) 2005 www.flash-template-design.com
  Released under the GNU General Public License
*/
  class shoppingCart {
    var $contents, $total, $weight, $cartID, $content_type;
    function shoppingCart() {
	  $this->reset();
    }
    function restore_contents() {
	  global $customer_id;
	  if (!tep_session_is_registered('customer_id')) return false;
// insert current cart contents in database
	  if (is_array($this->contents)) {
	    reset($this->contents);
	    while (list($products_id, ) = each($this->contents)) {
		  $qty = $this->contents[$products_id]['qty'];
		  $product_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
		  if (!tep_db_num_rows($product_query)) {
		    tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "')");
		    if (isset($this->contents[$products_id]['attributes'])) {
			  reset($this->contents[$products_id]['attributes']);
			  while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
			    tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
			  }
		    }
		  } else {
		    tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $qty . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
		  }
	    }
	  }
// reset per-session cart contents, but not the database contents
	  $this->reset(false);
	  $products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
	  while ($products = tep_db_fetch_array($products_query)) {
	    $this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']);
// attributes
	    $attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");
	    while ($attributes = tep_db_fetch_array($attributes_query)) {
		  $this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
	    }
	  }
	  $this->cleanup();
    }
    function reset($reset_database = false) {
	  global $customer_id;
	  $this->contents = array();
	  $this->total = 0;
	  $this->weight = 0;
	  $this->content_type = false;
	  if (tep_session_is_registered('customer_id') && ($reset_database == true)) {
	    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
	    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");
	  }
	  unset($this->cartID);
	  if (tep_session_is_registered('cartID')) tep_session_unregister('cartID');
    }
    function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
	  global $new_products_id_in_cart, $customer_id;
	  $products_id = tep_get_uprid($products_id, $attributes);
	  if ($notify == true) {
	    $new_products_id_in_cart = $products_id;
	    tep_session_register('new_products_id_in_cart');
	  }
	  if ($this->in_cart($products_id)) {
	    $this->update_quantity($products_id, $qty, $attributes);
	  } else {
	    $this->contents[] = array($products_id);
	    $this->contents[$products_id] = array('qty' => $qty);
// insert into database
	    if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "')");
	    if (is_array($attributes)) {
		  reset($attributes);
		  while (list($option, $value) = each($attributes)) {
		    $this->contents[$products_id]['attributes'][$option] = $value;
// insert into database
		    if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
		  }
	    }
	  }
	  $this->cleanup();
// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
	  $this->cartID = $this->generate_cart_id();
    }
    function update_quantity($products_id, $quantity = '', $attributes = '') {
	  global $customer_id;
	  if (empty($quantity)) return true; // nothing needs to be updated if theres no quantity, so we return true..
	  $this->contents[$products_id] = array('qty' => $quantity);
// update database
	  if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
	  if (is_array($attributes)) {
	    reset($attributes);
	    while (list($option, $value) = each($attributes)) {
		  $this->contents[$products_id]['attributes'][$option] = $value;
// update database
		  if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and products_options_id = '" . (int)$option . "'");
	    }
	  }
    }
    function cleanup() {
	  global $customer_id;
	  reset($this->contents);
	  while (list($key,) = each($this->contents)) {
	    if ($this->contents[$key]['qty'] < 1) {
		  unset($this->contents[$key]);
// remove from database
		  if (tep_session_is_registered('customer_id')) {
		    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
		    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
		  }
	    }
	  }
    }
    function count_contents() {  // get total number of items in cart
	  $total_items = 0;
	  if (is_array($this->contents)) {
	    reset($this->contents);
	    while (list($products_id, ) = each($this->contents)) {
		  $total_items += $this->get_quantity($products_id);
	    }
	  }
	  return $total_items;
    }
    function get_quantity($products_id) {
	  if (isset($this->contents[$products_id])) {
	    return $this->contents[$products_id]['qty'];
	  } else {
	    return 0;
	  }
    }
    function in_cart($products_id) {
	  if (isset($this->contents[$products_id])) {
	    return true;
	  } else {
	    return false;
	  }
    }
    function remove($products_id) {
	  global $customer_id;
	  unset($this->contents[$products_id]);
// remove from database
	  if (tep_session_is_registered('customer_id')) {
	    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
	    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
	  }
// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
	  $this->cartID = $this->generate_cart_id();
    }
    function remove_all() {
	  $this->reset();
    }
    function get_product_id_list() {
	  $product_id_list = '';
	  if (is_array($this->contents)) {
	    reset($this->contents);
	    while (list($products_id, ) = each($this->contents)) {
		  $product_id_list .= ', ' . $products_id;
	    }
	  }
	  return substr($product_id_list, 2);
    }
    function calculate() {
	  $this->total = 0;
	  $this->weight = 0;
	  if (!is_array($this->contents)) return 0;
	  reset($this->contents);
	  while (list($products_id, ) = each($this->contents)) {
	    $qty = $this->contents[$products_id]['qty'];
// products price
	    $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	    if ($product = tep_db_fetch_array($product_query)) {
		  $prid = $product['products_id'];
		  $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
		  $products_price = $product['products_price'];
		  $products_weight = $product['products_weight'];
		  $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
		  if (tep_db_num_rows ($specials_query)) {
		    $specials = tep_db_fetch_array($specials_query);
		    $products_price = $specials['specials_new_products_price'];
		  }
		  $this->total += tep_add_tax($products_price, $products_tax) * $qty;
		  $this->weight += ($qty * $products_weight);
	    }
// attributes price
	    if (isset($this->contents[$products_id]['attributes'])) {
		  reset($this->contents[$products_id]['attributes']);
		  while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
		    $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
		    $attribute_price = tep_db_fetch_array($attribute_price_query);
		    if ($attribute_price['price_prefix'] == '+') {
			  $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
		    } else {
			  $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
		    }
		  }
	    }
	  }
    }
    function attributes_price($products_id) {
	  $attributes_price = 0;
	  if (isset($this->contents[$products_id]['attributes'])) {
	    reset($this->contents[$products_id]['attributes']);
	    while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
		  $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
		  $attribute_price = tep_db_fetch_array($attribute_price_query);
		  if ($attribute_price['price_prefix'] == '+') {
		    $attributes_price += $attribute_price['options_values_price'];
		  } else {
		    $attributes_price -= $attribute_price['options_values_price'];
		  }
	    }
	  }
	  return $attributes_price;
    }
    function get_products() {
	  global $languages_id;
	  if (!is_array($this->contents)) return false;
	  $products_array = array();
	  reset($this->contents);
	  while (list($products_id, ) = each($this->contents)) {
	    $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
	    if ($products = tep_db_fetch_array($products_query)) {
		  $prid = $products['products_id'];
		  $products_price = $products['products_price'];
		  $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
		  if (tep_db_num_rows($specials_query)) {
		    $specials = tep_db_fetch_array($specials_query);
		    $products_price = $specials['specials_new_products_price'];
		  }
		  $products_array[] = array('id' => $products_id,
								    'name' => $products['products_name'],
								    'model' => $products['products_model'],
								    'image' => $products['products_image'],
								    'price' => $products_price,
								    'quantity' => $this->contents[$products_id]['qty'],
								    'weight' => $products['products_weight'],
								    'final_price' => ($products_price + $this->attributes_price($products_id)),
								    'tax_class_id' => $products['products_tax_class_id'],
								    'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''));
	    }
	  }
	  return $products_array;
    }
    function show_total() {
	  $this->calculate();
	  return $this->total;
    }
    function show_weight() {
	  $this->calculate();
	  return $this->weight;
    }
    function generate_cart_id($length = 5) {
	  return tep_create_random_value($length, 'digits');
    }
    function get_content_type() {
	  $this->content_type = false;
	  if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) {
	    reset($this->contents);
	    while (list($products_id, ) = each($this->contents)) {
		  if (isset($this->contents[$products_id]['attributes'])) {
		    reset($this->contents[$products_id]['attributes']);
		    while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
			  $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id");
			  $virtual_check = tep_db_fetch_array($virtual_check_query);
			  if ($virtual_check['total'] > 0) {
			    switch ($this->content_type) {
				  case 'physical':
				    $this->content_type = 'mixed';
				    return $this->content_type;
				    break;
				  default:
				    $this->content_type = 'virtual';
				    break;
			    }
			  } else {
			    switch ($this->content_type) {
				  case 'virtual':
				    $this->content_type = 'mixed';
				    return $this->content_type;
				    break;
				  default:
				    $this->content_type = 'physical';
				    break;
			    }
			  }
		    }
		  } else {
		    switch ($this->content_type) {
			  case 'virtual':
			    $this->content_type = 'mixed';
			    return $this->content_type;
			    break;
			  default:
			    $this->content_type = 'physical';
			    break;
		    }
		  }
	    }
	  } else {
	    $this->content_type = 'physical';
	  }
	  return $this->content_type;
    }
    function unserialize($broken) {
	  for(reset($broken);$kv=each($broken);) {
	    $key=$kv['key'];
	    if (gettype($this->$key)!="user function")
	    $this->$key=$kv['value'];
	  }
    }
  }
?>


#49 trevorpoolton

  • Community Member
  • 12 posts
  • Real Name:Trevor Poolton

Posted 05 March 2012, 07:56

View Postsunrise99, on 18 March 2009, 00:50, said:

My store have install QTPro now, but how to install this module and make it can work with QTPro?
Please help to give some advice asap.

Thanks & Best Regards,
Sunrise

I have the same problem. Anyone have a solution for this?