Jump to content
lushlongboards

Bundled products

Recommended Posts

hi,

 

i've installed this contribution, now i' want to modify it in order to write in orders_products's table the list of subproduct.

can someone help me ?

 

thx

Share this post


Link to post
Share on other sites

Hello.

 

Is it possible to mark a product as only available for sale as part of a bundle, without creating a real bundle? I have an individual product that I don't want to be sold individually, only as an additional option (if selected) to another product. Bundle doesn't work in this case. I want to be able on product info page to list the items that this specific product can be purchased with, without showing savings, because there are none. Right now if I mark a product as only available for sale as part of a bundle, and don't add any items to the bundle, on product info page it shows as:

This product may be purchased only as a part of the following bundle(s):

I hope that I made myself clear.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Can this excellent contribution work with v2.3.3? What should be done to make it work there?

Share this post


Link to post
Share on other sites

The oddon works quite nice except the bundles items does not show product special price on items.

So products on special purchased separately is sometimes cheaper than buying a bundle?

 

How can we get the products special price included into the bundle items price??

 

	  <!-- BOF Bundled Products-->		 
	  <?php
	  function display_bundle($bundle_id, $bundle_price) {
	    global $languages_id, $product_info, $currencies;
	  ?>
	  <table border="0" width="95%" cellspacing="1" cellpadding="2" class="infoBox">
	    <tr class="infoBoxContents">
		  <td>
		    <table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
			    <td class="main" colspan="5">
			    <?php
			  $bundle_sum = 0;
		    echo "<b>" . TEXT_PRODUCTS_BY_BUNDLE . "</b></td></tr>\n";
		    $bundle_query = tep_db_query(" SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_model, p.products_price, p.products_image FROM " . TABLE_PRODUCTS . " p INNER JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON p.products_id=pd.products_id INNER JOIN " . TABLE_PRODUCTS_BUNDLES . " pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id = " . (int)$bundle_id . " and language_id = '" . (int)$languages_id . "'");
		    while ($bundle_data = tep_db_fetch_array($bundle_query)) {
			   echo "<tr><td class=main valign=top>" ;
			   echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $bundle_data['products_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $bundle_data['products_image'], $bundle_data['products_name'], intval(SMALL_IMAGE_WIDTH / 2), intval(SMALL_IMAGE_HEIGHT / 2), 'hspace="1" vspace="1"') . '</a></td>';
			   // comment out the following line to hide the subproduct qty
			   echo "<td class=main align=right><b>" . $bundle_data['subproduct_qty'] . " x </b></td>";
			   echo  '<td class=main><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $bundle_data['products_id']) . '" target="_blank"><b> (' . $bundle_data['products_model'] . ') '  . $bundle_data['products_name'] . '</b></a>';
			   if ($bundle_data['products_bundle'] == "yes") display_bundle($bundle_data['subproduct_id'], $bundle_data['products_price']);
			   echo '</td>';
			   echo '<td align=right class=main><b> ' .  $currencies->display_price($bundle_data['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . "</b></td></tr>\n";
			   $bundle_sum += $bundle_data['products_price']*$bundle_data['subproduct_qty'];
		    }
		    $bundle_saving = $bundle_sum - $bundle_price;
		    $bundle_sum = $currencies->display_price($bundle_sum, tep_get_tax_rate($product_info['products_tax_class_id']));
		    $bundle_saving =  $currencies->display_price($bundle_saving, tep_get_tax_rate($product_info['products_tax_class_id']));
		    // comment out the following line to hide the "saving" text
		    echo "<tr><td colspan=5 class=main><p><b>" . TEXT_RATE_COSTS . ' ' . $bundle_sum . '</b></td></tr><tr><td class=main colspan=5><font color="red"><b>' . TEXT_IT_SAVE . ' ' . $bundle_saving . "</font></b></td></tr>\n";
		  ?>
		  </table></td>
	    </tr>
	  </table>
	  <?php
	  }
	  if ($product_info['products_bundle'] == "yes") {
	    display_bundle($HTTP_GET_VARS['products_id'], $product_info['products_price']);
	  }
	  if ($product_info['sold_in_bundle_only'] == "yes") {
	    echo '<p class="main"><b>' . TEXT_SOLD_IN_BUNDLE . '</b></p><blockquote class="main">';
	    $bquery = tep_db_query('select bundle_id from ' . TABLE_PRODUCTS_BUNDLES . ' where subproduct_id = ' . (int)$HTTP_GET_VARS['products_id']);
	    while ($bid = tep_db_fetch_array($bquery)) {
		  $binfo_query = tep_db_query('select p.products_model, pd.products_name from ' . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$bid['bundle_id'] . "' and pd.products_id = p.products_id and pd.language_id = " . (int)$languages_id);
		  $binfo = tep_db_fetch_array($binfo_query);
		  echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$bid['bundle_id']) . '" target="_blank">[' . $binfo['products_model'] . '] ' . $binfo['products_name'] . '</a><br>';
	    }
	    echo '</blockquote>';
	  }
	  ?>
  <!-- EOF Bundled Products-->

 

I tried a few changes but is failing.

 

If someone can give me help in right direction please.


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

The oddon works quite nice except the bundles items does not show product special price on items.

So products on special purchased separately is sometimes cheaper than buying a bundle?

 

How can we get the products special price included into the bundle items price??

 

		  <!-- BOF Bundled Products-->		 
		  <?php
		  function display_bundle($bundle_id, $bundle_price) {
		    global $languages_id, $product_info, $currencies;
		  ?>
		  <table border="0" width="95%" cellspacing="1" cellpadding="2" class="infoBox">
		    <tr class="infoBoxContents">
			  <td>
			    <table border="0" width="100%" cellspacing="0" cellpadding="2">
				  <tr>
				    <td class="main" colspan="5">
				    <?php
				  $bundle_sum = 0;
			    echo "<b>" . TEXT_PRODUCTS_BY_BUNDLE . "</b></td></tr>\n";
			    $bundle_query = tep_db_query(" SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_model, p.products_price, p.products_image FROM " . TABLE_PRODUCTS . " p INNER JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON p.products_id=pd.products_id INNER JOIN " . TABLE_PRODUCTS_BUNDLES . " pb ON pb.subproduct_id=pd.products_id WHERE pb.bundle_id = " . (int)$bundle_id . " and language_id = '" . (int)$languages_id . "'");
			    while ($bundle_data = tep_db_fetch_array($bundle_query)) {
				   echo "<tr><td class=main valign=top>" ;
				   echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $bundle_data['products_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $bundle_data['products_image'], $bundle_data['products_name'], intval(SMALL_IMAGE_WIDTH / 2), intval(SMALL_IMAGE_HEIGHT / 2), 'hspace="1" vspace="1"') . '</a></td>';
				   // comment out the following line to hide the subproduct qty
				   echo "<td class=main align=right><b>" . $bundle_data['subproduct_qty'] . " x </b></td>";
				   echo  '<td class=main><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $bundle_data['products_id']) . '" target="_blank"><b> (' . $bundle_data['products_model'] . ') '  . $bundle_data['products_name'] . '</b></a>';
				   if ($bundle_data['products_bundle'] == "yes") display_bundle($bundle_data['subproduct_id'], $bundle_data['products_price']);
				   echo '</td>';
				   echo '<td align=right class=main><b> ' .  $currencies->display_price($bundle_data['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . "</b></td></tr>\n";
				   $bundle_sum += $bundle_data['products_price']*$bundle_data['subproduct_qty'];
			    }
			    $bundle_saving = $bundle_sum - $bundle_price;
			    $bundle_sum = $currencies->display_price($bundle_sum, tep_get_tax_rate($product_info['products_tax_class_id']));
			    $bundle_saving =  $currencies->display_price($bundle_saving, tep_get_tax_rate($product_info['products_tax_class_id']));
			    // comment out the following line to hide the "saving" text
			    echo "<tr><td colspan=5 class=main><p><b>" . TEXT_RATE_COSTS . ' ' . $bundle_sum . '</b></td></tr><tr><td class=main colspan=5><font color="red"><b>' . TEXT_IT_SAVE . ' ' . $bundle_saving . "</font></b></td></tr>\n";
			  ?>
			  </table></td>
		    </tr>
		  </table>
		  <?php
		  }
		  if ($product_info['products_bundle'] == "yes") {
		    display_bundle($HTTP_GET_VARS['products_id'], $product_info['products_price']);
		  }
		  if ($product_info['sold_in_bundle_only'] == "yes") {
		    echo '<p class="main"><b>' . TEXT_SOLD_IN_BUNDLE . '</b></p><blockquote class="main">';
		    $bquery = tep_db_query('select bundle_id from ' . TABLE_PRODUCTS_BUNDLES . ' where subproduct_id = ' . (int)$HTTP_GET_VARS['products_id']);
		    while ($bid = tep_db_fetch_array($bquery)) {
			  $binfo_query = tep_db_query('select p.products_model, pd.products_name from ' . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$bid['bundle_id'] . "' and pd.products_id = p.products_id and pd.language_id = " . (int)$languages_id);
			  $binfo = tep_db_fetch_array($binfo_query);
			  echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int)$bid['bundle_id']) . '" target="_blank">[' . $binfo['products_model'] . '] ' . $binfo['products_name'] . '</a><br>';
		    }
		    echo '</blockquote>';
		  }
		  ?>
	  <!-- EOF Bundled Products-->
I tried a few changes but is failing.

 

If someone can give me help in right direction please.

 

Yes, time to bump this post  :lol:


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

Running into an issue where the weight of a bundled product sku is using the sum of the individual components for the weight. This is resulting in a weight which is too high and is messing with the shipping module calculations. Looking through the code tho, I don't see where I might be able to use an override for the bundled product given weight.

Example product 1234 has three bundled products of X, Y and Z. The weights for each is given as say 10lbs each. In fact, the bundled products all combined are say 24lbs.  In the products record there is a given weight of 24lbs, but this is being ignored, and it's taking the XYZ weights and adding them all up for the total 30#... The result is that the shipping calculation is then trying to use too heavy of a weight so the shipping calculation is off. My expectation is that given the bundle has a specified weight, it should be using that instead of adding everything in the bundle up.

The only area in the code I think this might be coming from is in the shopping_cart.php class, where in the calculate() function, in the main while loop there is this on line 417:

$this->weight += ($qty * $products_weight);

where, what I would LIKE for it to do instead would be in the product is a bundle, to not sum up ever product weight for the bundle, but just use the specified weight. I'm not seeing anything anywhere else that looks like it might be causing what we are seeing in the shipping module for the shipments total weight of the cart.
 

Share this post


Link to post
Share on other sites

Display bundle special price and calculate correct savings

 

          <table border="0" width="95%" cellspacing="1" cellpadding="2" class="infoBox">
            <tr class="infoBoxContents">
              <td>
                <table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="main" colspan="5"><strong>
                    <?php
                  $bundle_sum = 0;
		              echo TEXT_PRODUCTS_BY_BUNDLE . "</strong></td></tr>\n";
					    $bundle_query = tep_db_query("select pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_model, p.products_price, p.products_image, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special, p.products_tax_class_id FROM products p INNER JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON p.products_id=pd.products_id INNER JOIN products_bundles pb ON pb.subproduct_id=pd.products_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id and p.products_status = '1' where pb.bundle_id = " . (int)$bundle_id . " and language_id = '" . (int)$languages_id . "'");
		              while ($bundle_data = tep_db_fetch_array($bundle_query)) {
	                  echo '<tr><td class="main" valign="top">' ;
	                  echo '<a href="' . tep_href_link('product_info.php', 'products_id=' . $bundle_data['products_id']) . '" target="_blank">' . tep_image('images/' . $bundle_data['products_image'], $bundle_data['products_name'], intval(SMALL_IMAGE_WIDTH / 2), intval(SMALL_IMAGE_HEIGHT / 2), 'hspace="1" vspace="1"') . '</a></td>';
	                  // comment out the following line to hide the subproduct qty
	                  echo '<td class="main" align="right"><strong>' . $bundle_data['subproduct_qty'] . "&nbsp;x&nbsp;</strong></td>";
	                  echo  '<td class="main"><a href="' . tep_href_link('product_info.php', 'products_id=' . $bundle_data['products_id']) . '" target="_blank"><strong>&nbsp;(' . $bundle_data['products_model'] . ') '  . $bundle_data['products_name'] . '</strong></a>';
	                  if ($bundle_data['products_bundle'] == "yes") display_bundle($bundle_data['subproduct_id'], $bundle_data['products_price']);
	                  echo '</td>';
	                           if (tep_not_null($bundle_data['specials_new_products_price'])) {
         echo '<td align="right"><span  style="color:red"><s><strong>&nbsp;' . $currencies->display_raw($bundle_data['products_price'], tep_get_tax_rate($bundle_data['products_tax_class_id'])) . "</s></span>&nbsp;&nbsp;";
		 echo  '' . $currencies->display_price($bundle_data['specials_new_products_price'], tep_get_tax_rate($bundle_data['products_tax_class_id'])) . "</strong></td></tr>\n";

      } else {
	  echo '<td align="right" class="main"><strong>&nbsp;' . $currencies->display_price($bundle_data['products_price'], tep_get_tax_rate($bundle_data['products_tax_class_id'])) . "</strong></td></tr>\n";
	 }
			   if ($bundle_data['specials_new_products_price'] > '0') {
					 $bundle_sum += $bundle_data['specials_new_products_price']*$bundle_data['subproduct_qty'];  
				   } else {
	                  $bundle_sum += $bundle_data['products_price']*$bundle_data['subproduct_qty'];
				    }
		              }
		              $bundle_saving = $bundle_price - $bundle_sum;
		              $bundle_sum = $currencies->display_price($bundle_sum, tep_get_tax_rate($product_info['products_tax_class_id']));
		              $bundle_saving =  $currencies->display_price($bundle_saving, tep_get_tax_rate($product_info['products_tax_class_id']));
		              // comment out the following line to hide the "saving" text
		              echo '<tr><td colspan="5" class="main"><p><strong>' . TEXT_RATE_COSTS . '&nbsp;' . $bundle_sum . '</strong></td></tr><tr><td class="main" colspan="5" style="color:red"><strong>' . TEXT_IT_SAVE . '&nbsp;' . $bundle_saving . "</strong></td></tr>\n";
		            ?>
              </table></td>
            </tr>
          </table> 

 


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

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

Sign in

Already have an account? Sign in here.

Sign In Now

×