Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity Price Breaks Per Product


maria071

Recommended Posts

  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

Anyone have any ideas?
Sure, but it seems obvious that where you change the price (indeed, admin/categories.php) you also put in the price breaks so I assume nobody wants to state the obvious.

 

You can download another Quantity Price Break contribution with screenshots that will give you an idea how the table where you put in the info should look like if it doesn't look any different than before installing that contribution.

Link to comment
Share on other sites

Sure, but it seems obvious that where you change the price (indeed, admin/categories.php) you also put in the price breaks so I assume nobody wants to state the obvious.

 

You can download another Quantity Price Break contribution with screenshots that will give you an idea how the table where you put in the info should look like if it doesn't look any different than before installing that contribution.

 

 

Thank you VERY much for responding. My screen looks nothing like the screenshot so now I have to backtrack and figure out where I went wrong.

 

I am sorry that the question seemed stupid I just wasn't seeing anything different.

Link to comment
Share on other sites

  • 2 weeks later...

Please place questions regarding the Quantity Price Breaks Per Product contribution here. Hopefully members can help with the various questions.

 

I get a lot of emails regarding this contribution, however, I am not the author of it and don't know any of the particular details. My contribution was simply pulling out the code that was changed in order to modify php files that may have been modified by other contributions.

 

If you have not installed any other contributions, I strongly urge downloading the complete package where you just copy over old files with the updated files.

 

Please only install the version where you have to copy and paste code (my contribution) only if you are familiar with the PHP language. If you are not, try getting a local friend to help you as it's very easy to mess things up using this method.

Link to comment
Share on other sites

Please place questions regarding the Quantity Price Breaks Per Product contribution here. Hopefully members can help with the various questions.

 

I get a lot of emails regarding this contribution, however, I am not the author of it and don't know any of the particular details. My contribution was simply pulling out the code that was changed in order to modify php files that may have been modified by other contributions.

 

If you have not installed any other contributions, I strongly urge downloading the complete package where you just copy over old files with the updated files.

 

Please only install the version where you have to copy and paste code (my contribution) only if you are familiar with the PHP language. If you are not, try getting a local friend to help you as it's very easy to mess things up using this method.

Hello,

 

I've installed a "Quantity Price Breaks Per Product" contrib. Everything seems to work OK. I have some formating questions, though.

1. How can I make my Qty. discount to show like:

5-9 $108.00

10-24 $93.00

25+ $85.00

Right now I have:

5+ $108.00

10+ $93.00

25+ $85.00

 

2. How can I relocate my table to show up under product description, just before "This product was added to our catalog on ...." instead of at the place of product price? Actually, I'd like to keep an originally formated product price and have a table under product description with Qty. discounts.

Right now I have:

$130.00

5+ $108.00

10+ $93.00

25+ $85.00

 

3. And I'd like to change "Quantity" formating to a smaller font size.

 

I'll appreciate any ideas. Thanks,

Irina.

Edited by Irin
Link to comment
Share on other sites

Hi,

 

OOPS - Sorry I couldn't fine a thread so I started one but now I see there is this one so I'm double posting.

 

Anyway, I've just installed this contribution and now I realize how thick I am that it's not exactly what I need. I need Quantity Price Breaks across the store so no matter which size or style they buy when they buy 2 cartons they get 20% off the 1 carton price for that item, 3 cartons 30%, 4 cartons 40%, and 5 or more cartons 50%.

 

Also - I don't like the little table I want to remove it - where's the code?

 

HELP PLEASE!

Link to comment
Share on other sites

Can anyone help me out with this. I have this mod installed with the Product Attribute Options mod. When I add the same product to the cart, but with a different attribute, it is not discounted.

 

IE - if I order one blue widget and one red widget, no discount. Two blue widgets or two red widgets I get a discount.

 

Anyone know how to make this thing ignore attributes?

Link to comment
Share on other sites

Problems with Shopping cart.

 

This contribution works great. However, I am having problems when an item is on special.

 

Example: Special price of item is $10.00. Quantity Discounts set at 2+ $9.00.

 

When 2 items are added, the shopping cart shows $18.00 - which is correct. However, the sub-total shows $20.00 - incorrect.

 

It seems the special price is overiding the quantity discount price in the shopping cart.

 

When there is no special price, the quantity discount works great - no problems in the shopping cart.

 

Any ideas please?

Link to comment
Share on other sites

Please disregard my previous post. Problem corrected.

 

Operator error. Failed to follow instructions for includes/classes/shopping_cart.php. In CRE version the code is a little different, find the following:

 

		  $products_price = $pf->computePrice($qty);
	  $products_weight = $product['products_weight'];

 

Immediately after delete:

		  $special_price = tep_get_products_special_price($prid);
	  if ($special_price) {
		$products_price = $special_price;

 

Works fine now.

Link to comment
Share on other sites

I am trying to implement this add-on and I'm getting an error. It says "Call to a member function on a non-object" and points to this line (bolded - in products_info.php):

 

$product_info = tep_db_fetch_array($product_info_query);

 

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

$pf->loadProduct((int)$HTTP_GET_VARS['products_id'], (int)$languages_id);

$products_price=$pf->getPriceString();

 

 

 

$pf also appears:

 

in products.php

 

 

<?php echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>

 

in application_top.php

 

// include the price formatter for the price breaks contribution

require(DIR_WS_CLASSES . 'PriceFormatter.php');

$pf = new PriceFormatter;

 

in shopping_cart.php

 

}

 

function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {

global $new_products_id_in_cart, $customer_id;

global $languages_id;

 

$pf = new PriceFormatter;

$pf->loadProduct($products_id, $languages_id);

$qty = $pf->adjustQty($qty);

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

}

 

100 or so lines down:

 

}

 

function calculate() {

global $languages_id;

$this->total = 0;

$this->weight = 0;

if (!is_array($this->contents)) return 0;

$pf = new PriceFormatter;

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$qty = $this->contents[$products_id]['qty'];

 

// products price

if ($product = $pf->loadProduct($products_id, $languages_id)){

$prid = $product['products_id'];

$products_tax = tep_get_tax_rate($product['products_tax_class_id']);

$products_price = $pf->computePrice($qty);

$products_weight = $product['products_weight'];

 

...

 

function get_products() {

global $languages_id;

 

if (!is_array($this->contents)) return false;

$pf = new PriceFormatter;

$products_array = array();

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

if ($products = $pf->loadProduct($products_id, $languages_id)) {

$products_price = $pf->computePrice($this->contents[$products_id]['qty']);

 

in product_listing.php:

 

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

$pf->parse($listing);

$lc_text = $pf->getPriceStringShort();

 

about 50 lines down:

 

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

$pf->parse($listing);

$lc_text = $pf->getPriceStringShort();

break;

Link to comment
Share on other sites

  • 1 month later...
I am trying to implement this add-on and I'm getting an error. It says "Call to a member function on a non-object" and points to this line (bolded - in products_info.php):

 

I had a similar problem, and the solution for me was that I edited the wrong line in application.top.php

 

This is what mine currently looks like. There are two instances where $cart->add_cart... comes up and I had edited the second one, when in fact, I should have edited the first one. This code below is the correct edited version. So I guess you can check yours with mine and see if they match.

 $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+ $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // performed by the 'buy now' button in product listings and review page
  case 'buy_now' :		if (isset($HTTP_GET_VARS['products_id'])) {
							if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
							} else {
							  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
							}
						  }

 

Hope this helps :)

Link to comment
Share on other sites

I've got QPBPP mostly successfully installed but I am having an issue with the product copy feature in admin. When I attempt to copy (duplicate) a product I get this:

 

1136 - Column count doesn't match value count at row 1

 

insert into products (products_quantity, products_model, products_image, products_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('99', 'KUKUI-LEI', '', '7.0000', now(), null, '0.00', '0', '0', '0')

 

[TEP STOP]

 

The corresponding code in categories.php is:

 

elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
		$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks, products_date_available, products_weight, products_tax_class_id, manufacturers_id 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_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "',  now(), " . (empty($product['products_date_available']) ? "null" : "'" . 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')");
		}

 

Where have I gone wrong here?

 

Thanks,

Alane

Link to comment
Share on other sites

Where have I gone wrong here?
From a version I downloaded some time ago it looks like you are not wrong, but the instructions incomplete. The (top) part should have been:

		  } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') { // BOF changes for Price Break 1.11.3
		$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks, products_date_available, products_weight, products_tax_class_id, manufacturers_id 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_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', '" . tep_db_input($product['products_price1']) . "', '" . tep_db_input($product['products_price2']) . "', '" . tep_db_input($product['products_price3']) . "', '" . tep_db_input($product['products_price4']) . "', '" . tep_db_input($product['products_price5']) . "', '" . tep_db_input($product['products_price6']) . "', '" . tep_db_input($product['products_price7']) . "', '" . tep_db_input($product['products_price8']) .  "', '" . tep_db_input($product['products_price1_qty']) . "', '" . tep_db_input($product['products_price2_qty']) . "', '" . tep_db_input($product['products_price3_qty']) . "', '" . tep_db_input($product['products_price4_qty']) . "', '" . tep_db_input($product['products_price5_qty']) . "', '" . tep_db_input($product['products_price6_qty']) . "', '" . tep_db_input($product['products_price7_qty']) . "', '" . tep_db_input($product['products_price8_qty']) ."', '" . tep_db_input($product['products_qty_blocks']) . "',  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'] . "')");
	// EOF changes for Price Break 1.11.3
		$dup_products_id = tep_db_insert_id();

Link to comment
Share on other sites

I am having an interesting problem with this module maybe someone can help here. I have the module installed in conjunction with lots of modules. Including the MAP module and the salemaker. When I use salemaker the sale price appears when you enter the product description and it does apply it when you check out. However it does not appear anywhere else. I am wondering if anyone has ever seen this before I would appreciate any help. If you want to see an example of this look at discount-wholesale-carpet.com/catalog.

 

Thanks

 

Dominik

Link to comment
Share on other sites

Hi there,

 

I've installed the trib and works fine now.

 

The only thing which bothers me a bit is that I have to fill the prices excluding tax even though I have display prices incl. tax set to true in the controlpanel.

 

So I want to insert the price incl. tax in the price field of the trib.

 

Any help is appreciated.

 

Thanks

 

Hub

Link to comment
Share on other sites

HI,

 

I have installed this contribution and all went well.. The problem i have to should i say the request i have is that i would like to have the product listing page to show the values that show on the product info page..

 

At the moment it shows like image, product name , 10-20 and the buy now button,

 

What i would like to show is the image, product name , then a box with the price and quantity to add and the buy now button ie .

 

image, Product name, 1 ($20), 3+ ($15), 5+($20) - Buy Now. * also to show at the bottom of each a quantity box.

 

Many thanks

Link to comment
Share on other sites

  • 4 weeks later...

I am trying to incorporate MSRP Display Price & Percentage into my system which already has Quantity Price Breaks Per Product installed.

 

Since PriceFormatter.php replaced code in product_info.php, I am stuck. The MSRP code was designed to replace the same code which was removed by Quantity Price Breaks.

 

Example:

/* REPLACED by Quantity Price Break per Product V-1.11.2_1
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $products_price = 'Regular Price: <s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice"><br>Special Price: ' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
  $products_price = 'Your Price: <font color ="#FF0000">' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</font>';
}
*/
// BEGIN Quantity Price Break per Product V-1.11.2_1 
$pf->loadProduct((int)$HTTP_GET_VARS['products_id'], (int)$languages_id);
$products_price=$pf->getPriceString();
// END Quantity Price Break per Product

 

I am supposed to replace the "original" product_info.php code with the following MSRP code:

				 $products_price = '<table class="PriceList" border="0" width="100%" cellspacing="0" cellpadding="0">';
		$new_price = tep_get_products_special_price($product_info['products_id']);
		if ($product_info['products_msrp'] > $product_info['products_price'])
		  $products_price .= '<tr><td>' . TEXT_PRODUCTS_MSRP . '</td><td class="oldPrice" align="right">' . $currencies->display_price($product_info['products_msrp'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';
		$products_price .= '<tr><td>' . TEXT_PRODUCTS_OUR_PRICE . '</td>';
		if ($new_price != '')
		  {$products_price .= '<td class="oldPrice"';}
		else
		  {$products_price .= '<td';}
		$products_price .= ' align=right>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';
		if ($new_price != '')
		  {$products_price .= '<tr class="productSpecialPrice"><td>' . TEXT_PRODUCTS_SALE . '</td><td align=right>' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}
		if ($product_info['products_msrp'] > $product_info['products_price'])
		  {if ($new_price != '')
			{$products_price .= '<tr><td>' . TEXT_PRODUCTS_SAVINGS . '</td><td align=right>' . $currencies->display_price(($product_info['products_msrp'] -  $new_price) , tep_get_tax_rate($product_info['products_tax_class_id'])) . ' (' . ceil((($product_info['products_msrp'] -  $new_price) / $product_info['products_msrp']) * 100) . '% )</td></tr>';}
		  else
			{$products_price .= '<tr><td>' . TEXT_PRODUCTS_SAVINGS . '</td><td align=right>' . $currencies->display_price(($product_info['products_msrp'] -  $product_info['products_price']) , tep_get_tax_rate($product_info['products_tax_class_id'])) . ' (' . ceil((($product_info['products_msrp'] -  $product_info['products_price']) / $product_info['products_msrp']) * 100) . '% )</td></tr>';}}
		else
		  {if ($new_price != '')
			{$products_price .= '<tr><td>' . TEXT_PRODUCTS_SAVINGS . '</td><td align=right>' . $currencies->display_price(($product_info['products_price'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) . ' (' . ceil((($product_info['products_price'] - $new_price) / $product_info['products_price']) * 100) . '% )</td></tr>';}}
		$products_price .= '</table>';

 

Any help would be very much appreciated!!

Link to comment
Share on other sites

  • 2 weeks later...
Hello,

 

I've installed a "Quantity Price Breaks Per Product" contrib. Everything seems to work OK. I have some formating questions, though.

1. How can I make my Qty. discount to show like:

5-9 $108.00

10-24 $93.00

25+ $85.00

Right now I have:

5+ $108.00

10+ $93.00

25+ $85.00

 

2. How can I relocate my table to show up under product description, just before "This product was added to our catalog on ...." instead of at the place of product price? Actually, I'd like to keep an originally formated product price and have a table under product description with Qty. discounts.

Right now I have:

$130.00

5+ $108.00

10+ $93.00

25+ $85.00

 

3. And I'd like to change "Quantity" formating to a smaller font size.

 

I'll appreciate any ideas. Thanks,

Irina.

 

I too would like to know how to change the look and location of the price information table and also the size of the 'quantity' text above the add to cart button

Link to comment
Share on other sites

Genius,

 

What you want to do can be done in two ways.

One is control limited as in it will appear in the same font as the productinfo page.

The other is a not but involves editing 2 files instead of one.

 

Method 1.

1. Open product_listing.php.

2. Find this word. getPriceStringShort Replace with getPriceString

3. Done

 

Method 2.

Create a new getPriceString for product_listing.php

1.Open product_listing.php

2.Find this word. getPriceStringShort Replace with getPriceStrprodl

3.Open PriceFormatter

4.Find function getPriceString($style='productPriceInBox')

5.Make a duplicate of the functions entire contents and create function getPriceStrprodl($style='getpricestrprodl')

6.Open your stylesheet file and make a entry for getPriceStrprodl for example

.getpricestrprodl {font-family: Tahoma; font-size: 12px;font-weight: bold;}

Link to comment
Share on other sites

northernmonkey

Here is how to make the listing look like

5-9 $108.00

10-24 $93.00

25+ $85.00

 

I am sure there is probably a cleaner way but this one works for me.

If anyone wants to rewrite the code please do so and post it back on here.

 

In includes/classes/PriceFormatter.php

 

Find:

 

if($this->hasQuantityPrice == true) {
	for($i=1; $i<=8; $i++) {
		if($this->quantity[$i] > 0) {
			$lc_text .= '<tr><td class='.$style.'>'
			. $this->quantity[$i]
			.'+?</td><td class='.$style.'>'
			. $currencies->display_price($this->price[$i],
			tep_get_tax_rate($this->taxClass))
			.'</td></tr>';
		}

 

 

 

Replace with:

 

 

if($this->hasQuantityPrice == true) {
//begin mod
if($this->quantity[1] > 0 && ($this->quantity[2] > 0)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[1] . ' - ' . $this->quantity[2] . ' ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[1], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[1] > 0 && ($this->quantity[2] < 1)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[1] . ' + ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[1], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[2] > 0 && ($this->quantity[3] > 0)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[2] . ' - ' . $this->quantity[3] . ' ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[2], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[2] > 0 && ($this->quantity[3] < 1 )) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[2] . ' + ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[2], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[3] > 0 && ($this->quantity[4] > 0)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[3] . ' - ' . $this->quantity[4] . ' ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[3], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[3] > 0 && ($this->quantity[4] < 1)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[3] . ' + ' . '</td><td class='.$style.'> ' .  $currencies->display_price($this->price[3], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[4] > 0 && ($this->quantity[5] > 0)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[4] . ' - ' . $this->quantity[5] . ' ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[4], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[4] > 0 && ($this->quantity[5] < 1)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[4] . ' + ' . '</td><td class='.$style.'> ' .  $currencies->display_price($this->price[4], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[5] > 0 && ($this->quantity[6] > 0)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[5] . ' - ' . $this->quantity[6] . ' ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[5], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[5] > 0 && ($this->quantity[6] < 1)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[5] . ' + ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[5], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[6] > 0  && ($this->quantity[7] > 0)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[6] . ' - ' . $this->quantity[7] . ' ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[6], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[6] > 0 && ($this->quantity[7] < 1)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[6] . ' + ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[6], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[7] > 0 && ($this->quantity[8] > 0 )) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[7] . ' - ' . $this->quantity[8] . ' ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[7], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[7] > 0 && ($this->quantity[8] < 1)) {$lc_text .= '<tr><td class='.$style.'>'. $this->quantity[7] . ' + ' . '</td><td class='.$style.'> ' . $currencies->display_price($this->price[7], tep_get_tax_rate($this->taxClass)) .'</td></tr>';}
if($this->quantity[8] > 0) {$lc_text .= '<tr><td class='.$style.'>'. $this->$this->quantity[8] . ' + </td><td class='.$style.'>' . ' ' . $currencies->display_price($this->price[8], tep_get_tax_rate($this->taxClass)) .'
</td></tr>';}
//end mod

Edited by mids1999
Link to comment
Share on other sites

My includes/classes/PriceFormatter.php code looks different from the above. How can I implement that function in my PriceFormatter.php?

<?php
/*
 $Id: PriceFormatter.php,v 1.6 2003/06/25 08:29:26 petri Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

/*
PriceFormatter.php - module to support quantity pricing

Created 2003, Beezle Software based on some code mods by WasaLab Oy (Thanks!)
*/

class PriceFormatter {
 var $hiPrice;
 var $lowPrice;
 var $quantity;
 var $hasQuantityPrice;

 function PriceFormatter($prices=NULL) {
$this->productsID = -1;

$this->hasQuantityPrice=false;
$this->hasSpecialPrice=false;

$this->hiPrice=-1;
$this->lowPrice=-1;

for ($i=1; $i<=8; $i++){
  $this->quantity[$i] = -1;
  $this->prices[$i] = -1;
}
$this->thePrice = -1;
$this->specialPrice = -1;
$this->qtyBlocks = 1;

if($prices)
  $this->parse($prices);
 }

 function encode() {
$str = $this->productsID . ":"
	   . (($this->hasQuantityPrice == true) ? "1" : "0") . ":"
	   . (($this->hasSpecialPrice == true) ? "1" : "0") . ":"
	   . $this->quantity[1] . ":"
	   . $this->quantity[2] . ":"
	   . $this->quantity[3] . ":"
	   . $this->quantity[4] . ":"
	   . $this->quantity[5] . ":"
	   . $this->quantity[6] . ":"
	   . $this->quantity[7] . ":"
	   . $this->quantity[8] . ":"
	   . $this->price[1] . ":"
	   . $this->price[2] . ":"
	   . $this->price[3] . ":"
	   . $this->price[4] . ":"
	   . $this->price[5] . ":"
	   . $this->price[6] . ":"
	   . $this->price[7] . ":"
	   . $this->price[8] . ":"
	   . $this->thePrice . ":"
	   . $this->specialPrice . ":"
	   . $this->qtyBlocks . ":"
	   . $this->taxClass;
return $str;
 }

 function decode($str) {
list($this->productsID,
	 $this->hasQuantityPrice,
	 $this->hasSpecialPrice,
	 $this->quantity[1],
	 $this->quantity[2],
	 $this->quantity[3],
	 $this->quantity[4],
	 $this->quantity[5],
	 $this->quantity[6],
	 $this->quantity[7],
	 $this->quantity[8],
	 $this->price[1],
	 $this->price[2],
	 $this->price[3],
	 $this->price[4],
	 $this->price[5],
	 $this->price[6],
	 $this->price[7],
	 $this->price[8],
	 $this->thePrice,
	 $this->specialPrice,
	 $this->qtyBlocks,
	 $this->taxClass) = explode(":", $str);

$this->hasQuantityPrice = (($this->hasQuantityPrice == 1) ? true : false);
$this->hasSpecialPrice = (($this->hasSpecialPrice == 1) ? true : false);
 }

 function parse($prices) {
$this->productsID = $prices['products_id'];
$this->hasQuantityPrice=false;
$this->hasSpecialPrice=false;

$this->quantity[1]=$prices['products_price1_qty'];
$this->quantity[2]=$prices['products_price2_qty'];
$this->quantity[3]=$prices['products_price3_qty'];
$this->quantity[4]=$prices['products_price4_qty'];
$this->quantity[5]=$prices['products_price5_qty'];
$this->quantity[6]=$prices['products_price6_qty'];
$this->quantity[7]=$prices['products_price7_qty'];
$this->quantity[8]=$prices['products_price8_qty'];

$this->thePrice=$prices['products_price'];
$this->specialPrice=tep_get_products_special_price($prices['products_id']);
$this->hasSpecialPrice=tep_not_null($this->specialPrice);

$this->price[1]=$prices['products_price1'];
$this->price[2]=$prices['products_price2'];
$this->price[3]=$prices['products_price3'];
$this->price[4]=$prices['products_price4'];
$this->price[5]=$prices['products_price5'];
$this->price[6]=$prices['products_price6'];
$this->price[7]=$prices['products_price7'];
$this->price[8]=$prices['products_price8'];


 /*
   Change support special prices
   If any price level has a price greater than the special
   price lower it to the special price
*/
if ($this->hasSpecialPrice == true) {
	for($i=1; $i<=8; $i++) {
		if ($this->price[$i] > $this->specialPrice)
			$this->price[$i] = $this->specialPrice;
	}
}
//end changes to support special prices

$this->qtyBlocks=$prices['products_qty_blocks'];

$this->taxClass=$prices['products_tax_class_id'];

if ($this->quantity[1] > 0) {
  $this->hasQuantityPrice = true;
  $this->hiPrice = $this->thePrice;
  $this->lowPrice = $this->thePrice;

  for($i=1; $i<=8; $i++) {
if($this->quantity[$i] > 0) {
  if ($this->price[$i] > $this->hiPrice) {
	$this->hiPrice = $this->price[$i];
  }
  if ($this->price[$i] < $this->lowPrice) {
	$this->lowPrice = $this->price[$i];
  }
}
  }
}
 }

 function loadProduct($product_id, $language_id=1)
 {
$sql="select pd.products_name, p.products_model, p.products_image, p.products_id," .
	" p.manufacturers_id, p.products_price, p.products_weight," .
	" 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_pri
ce4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_pri
ce8_qty," .
	" p.products_qty_blocks," .
	" p.products_tax_class_id," .
	" IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price," .
	" IF(s.status, s.specials_new_products_price, p.products_price) as final_price" .
	" from " . TABLE_PRODUCTS_DESCRIPTION . " pd," .
	"	  " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id," .
	"	  " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id" .
	" where p.products_status = '1'" .
	"   and p.products_id = '" . (int)$product_id . "'" .
	"   and pd.products_id = '" . (int)$product_id . "'" .
	"   and pd.language_id = '". (int)$language_id ."'";

$product_info_query = tep_db_query($sql);
$product_info = tep_db_fetch_array($product_info_query);
$this->parse($product_info);

return $product_info;
 }

 function computePrice($qty)
 {
$qty = $this->adjustQty($qty);

$price = $this->thePrice;

//if ($this->hasSpecialPrice == true)
//	$price = $this->specialPrice;
//else
	for ($i=1; $i<=8; $i++)
		if (($this->quantity[$i] > 0) && ($qty >= $this->quantity[$i]))
			$price = $this->price[$i];

return $price;
 }

 function adjustQty($qty) {
// Force QTY_BLOCKS granularity
$qb = $this->getQtyBlocks();
if ($qty < 1)
	$qty = 1;

if ($qb >= 1)
{
	if ($qty < $qb)
		$qty = $qb;

	if (($qty % $qb) != 0)
		$qty += ($qb - ($qty % $qb));
}
return $qty;
 }

 function getQtyBlocks() {
return $this->qtyBlocks;
 }

 function getPrice() {
return $this->thePrice;
 }

 function getLowPrice() {
return $this->lowPrice;
 }

 function getHiPrice() {
return $this->hiPrice;
 }

 function hasSpecialPrice() {
return $this->hasSpecialPrice;
 }

 function hasQuantityPrice() {
return $this->hasQuantityPrice;
 }

 function getDiscountSaving($original_price, $discount_price) {

  $difference = $original_price - $discount_price;
$saving = round (($difference / $original_price) * 100) . '%';

return $saving;
 }

 function getPriceString($style='productPriceInBox') {
global $currencies;

//Change support special prices
//don't display special prices.....
if (false == true) {
  $lc_text = '?<s>'
. $currencies->display_price($this->thePrice,
				 tep_get_tax_rate($this->taxClass))
. '</s>??<span class="productSpecialPrice">'
. $currencies->display_price($this->specialPrice,
				 tep_get_tax_rate($this->taxClass))
. '</span>?';
}
else {

  // If you want to change the format of the price/quantity table
  // displayed on the product information page, here is where you do it.

  if($this->hasQuantityPrice == true) {
$lc_text = '<table border="0" cellspacing="0" cellpadding="0" class="infoBox" align="center">
			<tr valign="top">
			<td>
			<table border="0" cellspacing="1" cellpadding="5" class="infobox">';
	$lc_text .= '<tr valign="top"><td width="100" class="infoBoxHeading">Qty. Discount</td>'
//			 . $currencies->display_price($this->thePrice,
//					   tep_get_tax_rate($this->taxClass))
		   . '</td>';

for($i=1; $i<=8; $i++) {
  if($this->quantity[$i] > 0) {
	$lc_text .= '<td align="center" width="50" class="infoBoxHeading">'
	  . $this->quantity[$i]
	  .'+?</td>';
  }
}
//			<tr valign="top"><td width="150" class="infoBoxContents">M1P102</td><td align="center" width="50" class="infoBoxContents">'
//		  . $currencies->display_price($this->price[$i],
//					   tep_get_tax_rate($this->taxClass))

$lc_text .= '<tr valign="top"><td width="100" class="infoBoxContents">Price each</td>';

for($i=1; $i<=8; $i++) {
  if($this->quantity[$i] > 0) {
	$lc_text .= '<td align="center" width="50" class="infoBoxContents">'
	  . $currencies->display_price($this->price[$i],
				   tep_get_tax_rate($this->taxClass))
			  .'</td>';
  }
}
$lc_text .= '</tr>';

// Begin saving calculation
$lc_text .= '<tr valign="top"><td width="100" class="infoBoxContents">Saving %</td>';

for($i=1; $i<=8; $i++) {
  if($this->quantity[$i] > 0) {
	$lc_text .= '<td align="center" width="50" class="infoBoxContents">'
	  . $this->getDiscountSaving($this->price[1], $this->price[$i])
			  .'</td>';
  }
}
$lc_text .= '</tr></table></td></tr></table>';
  }
  else {
$lc_text = '?'
  . $currencies->display_price($this->thePrice,
				   tep_get_tax_rate($this->taxClass))
  . '?';
  }
}
return $lc_text;
 }

 function getPriceStringShort() {
global $currencies;

if ($this->hasSpecialPrice == true) {
  $lc_text = '?<s>'
. $currencies->display_price($this->thePrice,
				 tep_get_tax_rate($this->taxClass))
. '</s>??<span class="productSpecialPrice">'
. $currencies->display_price($this->specialPrice,
				 tep_get_tax_rate($this->taxClass))
. '</span>?';
}
else {
  if($this->hasQuantityPrice == true) {
$lc_text = '?'
  . $currencies->display_price($this->lowPrice,
				   tep_get_tax_rate($this->taxClass))
  . ' - '
  . $currencies->display_price($this->hiPrice,
				   tep_get_tax_rate($this->taxClass))
  . '?';
  }
  else {
$lc_text = '?'
  . $currencies->display_price($this->thePrice,
				   tep_get_tax_rate($this->taxClass))
  . '?';
  }
}
return $lc_text;
 }
}

?>

Any help would be appreciated.

Thanks in advance.

Link to comment
Share on other sites

Hello,

I have manually installed the Full package 6 May 2005, the problem I have is that it displays the information correctly from the customer side but I have who's online enhancement installed and it doesnt seem to calculate the information correctly on this page.

 

Is anyone having any problems with special not being overrided?

Does anyone else have any problems with this additional mod installed?

Many thanks

Regards,

Clive

Link to comment
Share on other sites

does anyone know how to change the size/style of the text as indicated

 

screen.gif

 

also I have a products on special the product has NO price break per product assigned only special offer but it adds to cart with the standard price as if not on special!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...