Jump to content
hozone

[contribution] Total B2B

Recommended Posts

I am confused as to how set up the b2b to do the following:

 

Product : GoldMine BCM (ie standard product)

Manufacture : FrontRange

End User Price : ?200

Reseller Tier One Price : ?110 (ie 45% discount)

Reseller Tier Two Price : ?150 (ie 25% discount)

 

Product : GoldMine UPP (ie upgrade protection plan)

Manufacture : FrontRange

End User Price : ?100

Reseller Tier One Price : ?75 (ie 25% discount)

Reseller Tier Two Price : ?80 (ie 20% discount)

 

In the above example the products are both from the same manufacture (ie FrontRange) but there are two types of products (ie software and support plans) which have different discount rates for the Resellers (ie for theTier One resellers 45% on software but only 25% for support plans).

 

Any suggestions as to how to set the Pricing to achieve the above?

Share this post


Link to post
Share on other sites

It seems that product attribute (+/- $) are calculated correctly in the order, invoice, packing slip & customer email.

 

But they are not displayed correctly in the attribute list under the ordered products. The non-discounted (at least when using Group discounts) amount is displayed.


Thanks

 

Mike

Share this post


Link to post
Share on other sites
It seems that product attribute (+/- $) are calculated correctly in the order, invoice, packing slip & customer email.

 

But they are not displayed correctly in the attribute list under the ordered products. The non-discounted (at least when using Group discounts) amount is displayed.

 

anyone else see this? Or am I all wet here......


Thanks

 

Mike

Share this post


Link to post
Share on other sites

I am having issues in the account history section of the site.

Order numbers are appearing twice.

 

Order Number: 12 	 Order Status: Processed
Order Date: Thursday 12 May, 2005
Shipped To: Matt Ward  Products: 2
Order Cost: $12.49  View


Order Number: 12  Order Status: Processed
Order Date: Thursday 12 May, 2005
Shipped To: Matt Ward  Products: 2
Order Cost: $6.50  View


Order Number: 11  Order Status: Processed
Order Date: Thursday 12 May, 2005
Shipped To: Matt Ward  Products: 4
Order Cost: $22.47  View


Order Number: 11  Order Status: Processed
Order Date: Thursday 12 May, 2005
Shipped To: Matt Ward  Products: 4
Order Cost: $725.00  View


Order Number: 7  Order Status: Processed
Order Date: Wednesday 11 May, 2005
Shipped To: Matt Ward  Products: 2
Order Cost: $1,203.00  View


Order Number: 7  Order Status: Processed
Order Date: Wednesday 11 May, 2005
Shipped To: Matt Ward  Products: 2
Order Cost: $17.50  View


Order Number: 6  Order Status: Processed
Order Date: Wednesday 11 May, 2005
Shipped To: Matt Ward  Products: 6
Order Cost: $400.76  View


Order Number: 6  Order Status: Processed
Order Date: Wednesday 11 May, 2005
Shipped To: Matt Ward  Products: 6
Order Cost: $57.50  View


Displaying 1 to 8 (of 8 orders)  Result Pages:  1

 

Additionally if I click view the accounting information it is all messed up.

 

Order #12 (Processed)
Order Date: Thursday 12 May, 2005  Order Total: $12.49
Delivery Address
cmwd
Matt Ward
REMOVEDFOR PRIVACY
United States
Shipping Method
Flat Rate (Best Way)

Products
1 x  Yorkshire Terriers Address Book  $7.49
1 x  Borzoi Pin  $1.50
Billing Information
Billing Address
cmwd
Matt Ward
REMOVEDFOR PRIVACY
United States
Payment Method
Use CC or Terms on File

Sub-Total:  $7.49
Sub-Total:  $1.50
Flat Rate (Best Way):  $5.00
Shipping:  $0.00
Total:  $12.49
Handling Fee:  $5.00
Total:  $6.50
Order History


Need Hosting? Just ask!

Share this post


Link to post
Share on other sites

I do have one other issue though....

 

The shopping cart is showing ZERO dollars for items, in the checkout_confirmation.php page.

 

Products (Edit)

100 x American Eskimo Paper Cube $0.00

 

 

 

 

Billing Information

 

Billing Address (Edit)

cmwd

Matt Ward

United States

Payment Method (Edit)

Use CC or Terms on File

Sub-Total: $475.00

Shipping: $0.00

Total: $475.00

 

 

 

Payment Information

 

Use Credit Card or Payments Terms that are already on File

 

 

 

 

 

 

 

 

 

 

Delivery Information Payment Information Confirmation Finished!


Need Hosting? Just ask!

Share this post


Link to post
Share on other sites
where are prices not calculated correcly?

 

They are "calculated" correctly. But the product attribute xtra charges are not "displayed" correctly. In the below example. I am in a "Wholesale" group. 20% discount. The product is normally $12.00 and the "Decoration to Add" attribute is $22.00.

 

The product 20% discount is displayed correctly as shown below,

But the Attribute is still shown as $22.00. No 20% discount shown.

 

The 20% discount of both product & attribute is used in the totals and tax calculations correctly, $27.20 (20% discount off of $34)

 

Image1.gif

 

The DB has the following entries for group discounts:

 

Image2.gif

 

I see the same incorrect attribute display in my Invoice (although here I have added a contribution for Fancy Invoice if that might make a difference)

 

Also, since I am in a "Wholesale" group. I'd like to NOT get charged Sales Tax. Any chance that option is available or easy to add?? It seems to make sense that Wholesale customer groups should not get charged Sales Tax (at least in the USA)

 

Thanks


Thanks

 

Mike

Share this post


Link to post
Share on other sites

it looks like the attribute price shown in /catalog/checkout_payment.php

was a mod I added. So you may not see the attribute listed in your checkout. So not a problem for most I suspect.

 

I had added:

 

//if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';

if ($order->products[$i]['attributes'][$j]['price'] != '0') {
 echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';

 

Any idea how I can show the correct discounted attribute price here??? Sorry for the mis-direction....

 

It 'may' still be a problem in the Invoice though for others since the default Invoice (I think) shows the attribute price. Mine shows incorectly, but I have the Fancy Invoice mod installed.

 

Does your invoice show Product attribute charges discountedcorrectly???

 

AND, still the question about the Wholesale group NOT being charged Sales Tax?????


Thanks

 

Mike

Share this post


Link to post
Share on other sites

i suppose this conde is in checkout_confirmation.php, not in checkout_payment.php

anyway

> Any idea how I can show the correct discounted attribute price here?

try

if ($order->products[$i]['attributes'][$j]['price'] != '0') {

echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->display_price_nodiscount($order->products[$i]['attributes'][$j]['price'],$order->products[$i]['tax'], $order->products[$i]['qty']) . ')';

i don't know if it's work, i don't try ;) but maybe works - cross fingers

 

> Does your invoice show Product attribute charges discountedcorrectly???

Yes

>still the question about the Wholesale group NOT being charged Sales Tax?????

this i don't understaind again.. i'm from italy and my english is not so good.

 

hi,

hOZONE

 

it looks like the attribute price shown in  /catalog/checkout_payment.php

was a mod I added.  So you may not see the attribute listed in your checkout.  So not a problem for most I suspect.

 

I had added:

 

//if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';

if ($order->products[$i]['attributes'][$j]['price'] != '0') {
 echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';

 

Any idea how I can show the correct discounted attribute price here???  Sorry for the mis-direction....

 

It 'may' still be a problem in the Invoice though for others since the default Invoice (I think) shows the attribute price.  Mine shows incorectly, but I have the Fancy Invoice mod installed.

 

Does your invoice show Product attribute charges discountedcorrectly???

 

AND, still the question about the Wholesale group NOT being charged Sales Tax?????


osCommerce Italia support: http://www.oscommerceitalia.com

Share this post


Link to post
Share on other sites
i suppose this conde is in checkout_confirmation.php, not in checkout_payment.php

anyway

> Any idea how I can show the correct discounted attribute price here?

try

if ($order->products[$i]['attributes'][$j]['price'] != '0') {

  echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->display_price_nodiscount($order->products[$i]['attributes'][$j]['price'],$order->products[$i]['tax'], $order->products[$i]['qty']) . ')';

i don't know if it's work, i don't try ;) but maybe works - cross fingers

 

> Does your invoice show Product attribute charges discountedcorrectly???

Yes

>still the question about the Wholesale group NOT being charged Sales Tax?????

this i don't understaind again.. i'm from italy and my english is not so good.

 

hi,

hOZONE

 

no..didn't work. working on it also. Thanks for the idea though.

 

The Sales Tax issue: If someone is a wholesale customer, then I as a seller, don't charge them sales tax in the state. In the above invoice it is listed as: Tx Tax 8.25%

 

This line item should not be charged for a wholesale customer.

 

I'm thinking about adding an additional field to the customer_groups table, called customers_groups_tax. This will be a true/false for charging sales tax or not.

 

Thinking about then makeing a query in function tep_get_tax_rate, and if customers_groups_tax is FALSE, always return a 0 as the Sales Tax rate? That sounds like a good place to put this. Ideas???

 

Thanks for the help.


Thanks

 

Mike

Share this post


Link to post
Share on other sites
no..didn't work. working on it also.  Thanks for the idea though.

 

The Sales Tax issue:  If someone is a wholesale customer, then I as a seller, don't charge them sales tax in the state.  In the above invoice it is listed as: Tx Tax 8.25%

 

This line  item should  not be charged for a wholesale customer. 

 

I'm thinking about adding an additional field to the customer_groups table, called customers_groups_tax. This will be a true/false for charging sales tax or not. 

 

Thinking about then makeing a query in function tep_get_tax_rate, and if customers_groups_tax  is FALSE, always return a 0 as the Sales Tax rate?  That sounds like a good place to put this.  Ideas???

 

Thanks for the help.

 

OK...got totalb2b to eliminate sales tax if in a gorup with the no sales tax flag.

 

I changed the DB table for totalb2b to the following (I added the field customers_groups_salestax):

 

DROP TABLE IF EXISTS customers_groups;
CREATE TABLE customers_groups (
 customers_groups_id INT(11) NOT NULL AUTO_INCREMENT,
 customers_groups_name VARCHAR(32) NOT NULL DEFAULT '',
 customers_groups_discount DECIMAL(8,2) NOT NULL DEFAULT '-0',
 customers_groups_price INT(11) NOT NULL DEFAULT '1',
 customers_groups_salestax INT(11) NOT NULL DEFAULT '0',
 PRIMARY KEY  (customers_groups_id)
) TYPE=MyISAM;

INSERT INTO customers_groups VALUES (1, 'Default', '-0.00', '1', '1');
INSERT INTO customers_groups VALUES (2, 'Friends', '-10.00', '1', '1');
INSERT INTO customers_groups VALUES (3, 'WholeSale-10', '-10.00', '1','0');
INSERT INTO customers_groups VALUES (4, 'WholeSale-20', '-20.00', '1','0');
INSERT INTO customers_groups VALUES (5, 'WholeSale-30', '-30.00', '1','0');
INSERT INTO customers_groups VALUES (6, 'WholeSale-40', '-40.00', '1','0');

 

The last field customers_groups_salestax is 0 for no sales tax. 1 for normal sales tax processing.

 

In catalog/includes/functions/general.php I modified the function tep_get_tax_rate to this:

 

  function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
   global $customer_zone_id, $customer_country_id;
       
   global $customer_id;   
   $customer_groups_id = tep_get_customers_groups_id();

   $customer_query = tep_db_query("select customers_groups_salestax from " . TABLE_CUSTOMERS_GROUPS . " WHERE " . " customers_groups_id = '" . $customer_groups_id ."'" );

   $customer_query_result = tep_db_fetch_array($customer_query);    
   
   $customer_salestax = $customer_query_result['customers_groups_salestax'];

   if($customer_salestax == 0) return 0;

   if ( ($country_id == -1) && ($zone_id == -1) ) {
     if (!tep_session_is_registered('customer_id')) {
       $country_id = STORE_COUNTRY;
       $zone_id = STORE_ZONE;
     } else {
       $country_id = $customer_country_id;
       $zone_id = $customer_zone_id;
     }
   }

   $tax_query = tep_db_query("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' group by tr.tax_priority");
   if (tep_db_num_rows($tax_query)) {
     $tax_multiplier = 1.0;
     while ($tax = tep_db_fetch_array($tax_query)) {
       $tax_multiplier *= 1.0 + ($tax['tax_rate'] / 100);
     }

     return ($tax_multiplier - 1.0) * 100;

   } else {
     return 0;
   }
 }

 

When a cutomer is in a group with the customers_groups_salestax = 0

the sales tax row dissapears for the order, invoice, packing slip, etc...

Seems to work as far as I can tell.

 

Mike


Thanks

 

Mike

Share this post


Link to post
Share on other sites

Hozone...

 

Been looking at the admin side: invoice, packing slip, order history, ....

 

Seems more complex to get the prices AND product atributes discounted by a group discount.

 

Thinking about making some test mods (backup first!), and actually put the discounted price of products & products attributes into the orders tables in the data base intead of applying the discount every place an order is displayed. It seems that this would be more accurate. It reflects the prices charged to a customer at his group discount rate at the time of his order instead of his rate at the time of display (I think)... I would then remove all mechanism where the discount is applied to the price displayed (currencies->display_price(...) )

 

Your thought?????


Thanks

 

Mike

Share this post


Link to post
Share on other sites
...but basically what u have to do is search products_price and duplicate this columns for how many price u have... products_price, products_price_2, products_price_3.. and so on.. u must edit easypopulate.php dubbing every line of products_price, making brothers lines.

hi,

hOZONE

I understand what you say above but I don't know how to write the code. I'm a good copy and paster :D . The lines I need to modify look like this:

 

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

if (tep_not_null($listing['specials_new_products_price'])) {

$lc_text = ' <s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';

} else {

$lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';

}

break;

 

can you modify this code for me? i have 3 price groups. I have 2 other files that i need to modify the same way. if you could do this one, i can do the rest by following the example. I think it would help newbies also. I can see you've been frustrated with this same question over and over again. I have read EVERY post you've made trying to find the answer, i'm not just being lazy. I just don't know php very well. thanks for your time, beth :thumbsup:

Share this post


Link to post
Share on other sites

How would I be able to set TotalB2B to automatically activate customers upon signup? I only have 1 price per item and I don't want to have to go and activate each customer when they sign up, I just want them to have all the default values.

 

Thank you

Share this post


Link to post
Share on other sites

I am getting this error in the "What's new" box:

 

Warning: Missing argument 3 for display_price() in E:\Miata\dividi\includes\classes\currencies.php on line 71

 

Line 71 is

 

 ? ?function display_price($products_id, $products_price, $products_tax, $quantity = 1) {

I have tried everything that i could find in this forum to correct it but still getting same error. Any help would be more then greatly appreciated.


Your help and suggestions are greatly appreciated.

Thanks

Wayne

Share this post


Link to post
Share on other sites
u have to add as the first argument of the call to diplay_price the product_id of the product you want to display

 

Could you show how and where as numerous people are having this problem, and by my code, it shows what you say its supposed to listing product id first

    function display_price($products_id, $products_price, $products_tax, $quantity = 1) {
and not all of us are programmers or php wizards, we do need a little explaning and assistance. Thanks

Your help and suggestions are greatly appreciated.

Thanks

Wayne

Share this post


Link to post
Share on other sites
I am getting this error in the "What's new" box:

 

Warning: Missing argument 3 for display_price() in E:\Miata\dividi\includes\classes\currencies.php on line 71

 

Line 71 is

 

    function display_price($products_id, $products_price, $products_tax, $quantity = 1) {

  I have tried everything that i could find in this forum to correct it but still getting same error.  Any help would be more then greatly appreciated.

 

This error originates from the products_new.php in your catalog/root directory and initially I had the same after following the installation instructions.

At some point in the installation instructions the '// TotalB2B end' comes a bit to soon as was for this file.

When you look for this change

        //TotalB2B start
 $query_special_prices_hide = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " WHERE configuration_key = 'SPECIAL_PRICES_HIDE'");
       $query_special_prices_hide_result = tep_db_fetch_array($query_special_prices_hide);
       if ($query_special_prices_hide_result['configuration_value'] == 'true') {
         $products_price = '<span class="productSpecialPrice">' . $currencies->display_price_nodiscount($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>';
    } else {
         $products_price = '<s>' . $currencies->display_price($products_new['products_id'], $products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price_nodiscount($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>';
    }
       //TotalB2B end

you'll see that there is an

} else {

right underneath which is not mentioned in the install instructions but does need to be changed to the new display_price format. So it should read

      } else {
       $products_price = $currencies->display_price($products_new['products_id'], $products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));

 

HTH

Share this post


Link to post
Share on other sites
This error originates from the products_new.php in your catalog/root directory and initially I had the same after following the installation instructions.

At some point in the installation instructions the '// TotalB2B end' comes a bit to soon as was for this file.

When you look for this change

 ? ? ? ?//TotalB2B start
?$query_special_prices_hide = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " WHERE configuration_key = 'SPECIAL_PRICES_HIDE'");
? ? ? ?$query_special_prices_hide_result = tep_db_fetch_array($query_special_prices_hide);
? ? ? ?if ($query_special_prices_hide_result['configuration_value'] == 'true') {
? ? ? ? ?$products_price = '<span class="productSpecialPrice">' . $currencies->display_price_nodiscount($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>';
? ? } else {
? ? ? ? ?$products_price = '<s>' . $currencies->display_price($products_new['products_id'], $products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price_nodiscount($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>';
? ? }
? ? ? ?//TotalB2B end

you'll see that there is an

} else {

right underneath which is not mentioned in the install instructions but does need to be changed to the new display_price format. So it should read

 ? ? ?} else {
? ? ? ?$products_price = $currencies->display_price($products_new['products_id'], $products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));

 

HTH

 

Thanks, tried this but still getting the same error. If you go to http://fhceramics.com/osCommerce/catalog/ you will see what is happening in the What's New Box.

Edited by FHCeramics

Your help and suggestions are greatly appreciated.

Thanks

Wayne

Share this post


Link to post
Share on other sites
Thanks, tried this but still getting the same error.  If you go to http://fhceramics.com/osCommerce/catalog/  you will see what is happening in the What's New Box.

 

You have the same error in product_info.php ?! Did you change the catalog/includes/classes/currencies.php according to the installation instructions ??

 

On the products_new.php there is also this error

<b>Fatal error</b>:  Call to undefined function:  tep_xppp_get_product_price() in <b>/www/f/fhceramics/htdocs/osCommerce/catalog/products_new.php</b> on line <b>83</b><br /

which makes me wonder if you did do the changes to catalog/includes/functions/general.php also ?!

 

It seems you missed implementing some essential parts of the contrib or you did the changes but they are not picked up from the correct files.

Share this post


Link to post
Share on other sites

You have the same error in product_info.php ?! Did you change the catalog/includes/classes/currencies.php according to the installation instructions

??

 

There were no modifications to the currencies.php so i overwrote it using the one from the contribution.

 

On the products_new.php there is also this error

<b>Fatal error</b>:  Call to undefined function:  tep_xppp_get_product_price() in <b>/www/f/fhceramics/htdocs/osCommerce/catalog/products_new.php</b> on line <b>83</b><br /

 

Here the code tep_xppp_get_product_price() was mixed up, should have read tep_xppp_getproductprice()

 

which makes me wonder if you did do the changes to catalog/includes/functions/general.php also ?!

 

There were no modifications to the general.php so i overwrote it using the one from the contribution.

 

It seems you missed implementing some essential parts of the contrib or you did the changes but they are not picked up from the correct files.

 

Double checked everything else and it all seems correct unless there are changes made that are not clearly identified.


Your help and suggestions are greatly appreciated.

Thanks

Wayne

Share this post


Link to post
Share on other sites
There were no modifications to the currencies.php so i overwrote it using the one from the contribution.

 

There were no modifications to the general.php so i overwrote it using the one from the contribution.

 

Then that should not be a problem.

 

Double checked everything else and it all seems correct unless there are changes made that are not clearly identified.

 

There is no other changes I am aware of.

 

This is getting really mysterious. If all changed files are in place there should be no reason for this error. Have you checked if you have other display_price calls from other contirubtions in that same file ?

And looking back to your first message I saw now there is a reference to an E: drive which I assume is a local drive where you have a local installation. Could there be some mixup with the changes/installation of TotalB2B on your server ?

Just asking as this seems to be more getting something to have a look at directly in your sources and installation.

Share this post


Link to post
Share on other sites

Hi. I need some help sorting out a problem integrating "Bundled Products" with TotalB2B.

 

I have TotalB2B working fine. After adding the code to display the bundle price I get the following error when viewing a bundle in the store. Single products appear to work fine.

 

>>>>>>>>>>>>>>>>

Warning: Missing argument 3 for display_price() in /home2/public_html/catalog/includes/classes/currencies.php on line 72

 

Warning: Missing argument 3 for display_price() in /home2/public_html/catalog/includes/classes/currencies.php on line 72

This Bundle contains the following items:

 

Individual part prices: $0.00

You save $0.00

>>>>>>>>>>>>>>

 

I have 2 products that make up this bundle. It is erroring trying to display the line items. I know there is a problem and it is in the catalog/product_info.php. I suspect it is not passing parameters to currrency.php properly. (argument 3 which I think is $products_tax)

 

Not being a php programmer, I can't seem to figure out what is broken or missing. The code from the section in product_info.php was modified as follows. I copied into this post an excerpt from the installation document that described what to change and where:

 

>>>>>>>>>>>>

--In catalog/product_info.php

120 <p><?php echo stripslashes($product_info['products_description']); ?></p>

--after line 120 insert:

 

<!-- start bundle At the beginning of Bundle Mod Addition 21.01.2005-->

<?php if (tep_not_null($product_info['products_bundle'])) {

?>

<table border="0" width="65%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

 

<td class="main" colspan="3">

 

<?php

 

if ($product_info['products_bundle'] == "yes") {

$products_bundle = $product_info['products_bundle'];

 

echo TEXT_PRODUCTS_BY_BUNDLE . "</td></tr>";

$bundle_query = tep_db_query(" SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price, p.products_image

FROM 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 = " . $HTTP_GET_VARS['products_id'] . " and language_id = '" . (int)$languages_id . "'");

while ($bundle_data = tep_db_fetch_array($bundle_query)) {

if ($bundle_data['products_bundle'] == "yes") {

// uncomment the following line to display subproduct qty

echo "<br>» <b>" . $bundle_data['subproduct_qty'] . " x " . $bundle_data['products_name'] . "</b>";

echo "<br>» <b> " . $bundle_data['products_name'] . "</b>";

$bundle_query_nested = tep_db_query(" SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price

FROM 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 = " . $bundle_data['products_id'] . " and language_id = '" . (int)$languages_id . "'");

 

/* $bundle_query_nested = tep_db_query("select pb.subproduct_id, pb.subproduct_qty, p.products_model, p.products_quantity, p.products_bundle, p.products_price, p.products_tax_class_id

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

// uncomment the following line to display subproduct qty

echo "<br><i>     " . $bundle_data_nested['subproduct_qty'] . " x " . $bundle_data_nested['products_name'] . "</i>";

echo "<br><i>     " . $bundle_data_nested['products_name'] . "</i>";

$bundle_sum += $bundle_data_nested['products_price']*$bundle_data_nested['subproduct_qty'];

}

} else {

// uncomment the following line to display subproduct qty

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'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="1" vspace="1"') . '</a>' ;

echo "</td><td class=main >» <b>" . $bundle_data['subproduct_qty'] . " x " . $bundle_data['products_name'] . '</b>   </td><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>";

// echo "<br>» <b> " . $bundle_data['products_name'] . "</b>";

$bundle_sum += $bundle_data['products_price']*$bundle_data['subproduct_qty'];

}

}

$bundle_saving = $bundle_sum - $product_info['products_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=3 class=main><p><b>" . TEXT_RATE_COSTS . ' ' . $bundle_sum . '</b></td></tr><tr><td class=main colspan=3><font color="red"><b>' . TEXT_IT_SAVE . ' ' . $bundle_saving . '</font></b>';

}

 

?>

 

</td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table>

<?php

}

?>

<!-- end bundle End of Bundle Mod Addition 21.01.2005-->

----------------------------------------------

72 $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_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 . "'");

--replace line 72 with:

$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_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_bundle 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 . "'");

 

******************************************************

 

Any help would surely be appreciated.

Edited by ishtek

Share this post


Link to post
Share on other sites
Hi. I need some help sorting out a problem integrating "Bundled Products" with TotalB2B.

 

I have TotalB2B working fine. After adding the code to display the bundle price I get the following error when viewing a bundle in the store. Single products appear to work fine.

 

>>>>>>>>>>>>>>>>

Warning: Missing argument 3 for display_price() in /home2/public_html/catalog/includes/classes/currencies.php on line 72

 

Warning: Missing argument 3 for display_price() in /home2/public_html/catalog/includes/classes/currencies.php on line 72

This Bundle contains the following items:

 

Individual part prices: $0.00

You save $0.00

>>>>>>>>>>>>>>

 

You'll have to change every occurence of the display_price() function to adept for TotalB2B which wants the product-id as first argument.

For the part of the bundle code you show it means:

$currencies->display_price($bundle_data['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']))

should be

$currencies->display_price($bundle_data['products_id'], $bundle_data['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']))

and

$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']));

would have to become

$bundle_sum = $currencies->display_price($product_info['products_price'],$bundle_sum, tep_get_tax_rate($product_info['products_tax_class_id']));
$bundle_saving = $currencies->display_price($product_info['products_price'],$bundle_saving, tep_get_tax_rate($product_info['products_tax_class_id']));

 

I hope this will solve the problem ! It is something to keep in mind with every contribution one adds where a display_price() is used and TotalB2B is installed.

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

×