Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity Price Breaks


jpweber

Recommended Posts

Update:

 

I have now managed to get it working correctly but I have hit ONE bug which i cannot seem to narrow down to a cause.

 

what happens is when I ADD an item to the cart from product_listing the price displayed in product_listing becomes ZERO (the correct price is shown in the cart and checkout) it just loses the price on any item that is in the cart but only in the Product_listing page.

 

I have checked all my currency settings etc are correct (besides it works okay from product_info).

 

Here is the code i have inserted into product_listing.php

 

 }
$pf->loadProduct((int)$_GET['products_id'], (int)$languages_id);
$products_price=$pf->getPriceString();
 $prod_list_contents = '<div class="ui-widget infoBoxContainer">' .
					'  <div class="ui-widget-header ui-corner-top infoBoxHeading">' .
					'	<table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListingHeader">' .
					'	  <tr>';

 

$no_of_listings = tep_db_num_rows($listing_query);
while ($_listing = tep_db_fetch_array($listing_query)) {
 $_listing['discount_categories_id'] = NULL;
$listing[] = $_listing;
$list_of_prdct_ids[] = $_listing['products_id'];
  }
  $list_of_prdct_ids = array_unique($list_of_prdct_ids);
$price_breaks_query = tep_db_query("select products_id, products_special_price_2, products_qty from  " . TABLE_PRODUCTS . " where products_id in (" . implode(',', $list_of_prdct_ids) . ") order by products_id, products_qty");
while ($price_break = tep_db_fetch_array($price_breaks_query)) {
	  $price_breaks_array[$price_break['products_id']][] = array('products_price' => $price_break['products_special_price_2'], 'products_qty' => $price_break['products_qty']);
}
$discount_category_query = tep_db_query("select p.products_id, p.products_quantity, p.products_weight, discount_categories_id from " . TABLE_PRODUCTS ." p left join " . TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES . " using(products_id) where p.products_id in (" . implode(',', $list_of_prdct_ids) . ")");
  while ($dc_array = tep_db_fetch_array($discount_category_query)) {
 $discount_categories[] = array ('products_id' => $dc_array['products_id'], 'products_quantity' => $dc_array['products_quantity'], 'products_weight' => $dc_array['products_weight'], 'discount_categories_id' => $dc_array['discount_categories_id']);
  }
for ($x = 0; $x < $no_of_listings; $x++) {
// add discount categories to the listing array
  if(!empty($discount_categories)) {
	for ($i = 0; $i < count($discount_categories); $i++) {
	 if ($listing[$x]['products_id'] == $discount_categories[$i]['products_id'] ) {
	  $listing[$x]['discount_categories_id'] = $discount_categories[$i]['discount_categories_id'];
	  $listing[$x]['products_quantity'] = $discount_categories[$i]['products_quantity'];
	  $listing[$x]['products_weight'] = $discount_categories[$i]['products_weight'];
	}
   }
 } // end if(!empty($discount_categories)
  }
//	while ($listing = tep_db_fetch_array($listing_query)) { (was original code)
for ($x = 0; $x < $no_of_listings; $x++) {
  $rows++;

 

	  case 'PRODUCT_LIST_PRICE':
		if (isset($price_breaks_array[$listing[$x]['products_id']])) {
		  $price_breaks_from_listing = $price_breaks_array[$listing[$x]['products_id']];
		 if (tep_not_null($listing['specials_new_products_price'])) {
		  $prod_list_contents .= '		<td align="left"><del>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></td>';
		} else {		  
}
	$pf->loadProduct($listing[$x]['products_id'], $languages_id, $listing[$x], $price_breaks_from_listing);
		  $prod_list_contents .= '		<td align="right">' . $pf->getPriceStringShort() . '</td>';
}
 break;

 

Can anyone see why it is losing the prices once the item is added to the cart?

Edited by ShaGGy
Link to comment
Share on other sites

	  case 'PRODUCT_LIST_PRICE':
		if (isset($price_breaks_array[$listing[$x]['products_id']])) {
		  $price_breaks_from_listing = $price_breaks_array[$listing[$x]['products_id']];
		 if (tep_not_null($listing['specials_new_products_price'])) {
		  $prod_list_contents .= '		<td align="left"><del>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></td>';
		} else {		  
}
	$pf->loadProduct($listing[$x]['products_id'], $languages_id, $listing[$x], $price_breaks_from_listing);
		  $prod_list_contents .= '		<td align="right">' . $pf->getPriceStringShort() . '</td>';
}
 break;

 

Can anyone see why it is losing the prices once the item is added to the cart?

 

No, but to me a number of things looks suspicious in the above piece of code. In the line:

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

it looks like the [$x] is missing. Also there is a "del" tag in the html-code. I assume most browsers will display it as text with a line through it but the appropriate way to do it is probably using CSS like:

<span style="text-decoration: line-through;">

Link to comment
Share on other sites

No, but to me a number of things looks suspicious in the above piece of code. In the line:

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

it looks like the [$x] is missing. Also there is a "del" tag in the html-code. I assume most browsers will display it as text with a line through it but the appropriate way to do it is probably using CSS like:

<span style="text-decoration: line-through;">

 

 

Hi Jan, yes i fixed the [$x] after posting, as for the del that is part of the special price feature (built into OSC) and is default 2.3.1 code which just puts a strike through on the original price if the item is on special offer.

 

 

as a temporary (fix) i have put

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

if ($products_price > 0){

return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);

}else{

return "Already in your Cart";

}

}

}

 

into includes/classe/currencies.php to show Already in your Cart in place of the £0.00 it wants to display :(

Link to comment
Share on other sites

Hi Everybody!

 

First of all big-big thanks for the feedback for every person who sended especially for Mr. Jan Zonjee and for the GREAT contirb!

 

After trying lots of hours unsuccessfully manage my problem I am trying to ask some help for my problem.

 

My problem details:

Everything works great (minimum order quantity, rounding, volume discounts etc) except one half thing.

 

I am selling products in different colors and of course I setted up for every product a discount category (if someone orders 5 red and 10 black thing from the same product it would count as it would be 15).

 

The problem is with the price calculation. It doesn't corrects the price after adding 2-3 colors from the same product (of course after reaching a volume discount category) JUST when the customer cicks on the update cart or if the customers logs in-out.

 

I have already went through 2-3 times if it is everything correct or not, and to tell you the truth I am fully disappointed...

I really really hope that somebody could help me out.

Link to comment
Share on other sites

  • 2 weeks later...

Hi firstly I am a complete newbie to OSC so allow for errors:/

 

 

Can some one please tell me if this updated add-on can be used with products which have 2 attributes ie. size and colour and can it be used along side the QTPro???

 

 

 

Also is there a working site with it working, so I can have a peak.

 

 

Thanks in advance

 

 

A

Link to comment
Share on other sites

I am trying unsucessfully to install this addon into a fresh install of oscommerce 2.3.1 with sppc already installed.

 

I am having trouble with the admin/categories page. I have tried 3 times to get it working, and each time have failed.

 

Does anyone have a working copy of this mod with sppc that i could have please

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

hello

 

first of all many thanks for this great contribution i have installed it together with sppc.

 

the problem is that i would like to update the gross and net price of all price breaks prices similar to the solution which was

mentioned on page 38 ( http://www.oscommerce.com/forums/topic/220794-quantity-price-breaks/page__st__740 )

 

but i can get it working.

 

can someone give met the right code for this problem ?

 

many thanks

eric

Link to comment
Share on other sites

In my previous posts i have said i am trying to integrate SPPc and quantity price breaks in a clean install of 2.3.1. and have been getting page errors.

 

I have narrowed it down to the following javascript code

 

<script language="javascript" src="includes/general.js"></script>
<!-- BOF QPBPP for SPPC - Javascript for Tabs //-->
<link rel="stylesheet" href="includes/tabs.css" type="text/css" media="screen">
<script src="includes/javascript/jquery-1.2.6.js" type="text/javascript"></script>
<script src="includes/javascript/ui.core.js" type="text/javascript"></script>
<script src="includes/javascript/ui.tabs.js" type="text/javascript"></script>
<script type="text/javascript">
 $(document).ready(function(){
/* Tabs for Languages */
   $("#langtabs > ul").tabs();
/* Tabs for Customer Groups */
   $("#qpbpp > ul").tabs();
 });
 </script>

 

I have tried removing this bit of the code

 

<script src="includes/javascript/jquery-1.2.6.js" type="text/javascript"></script>

 

but still the page does not load correctly. there are no errors, its just that the buttons do not load correctly and the delete image text is always highlighted and i an then unable to add extra images. Can anyone shed any light on this.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

In my previous posts i have said i am trying to integrate SPPc and quantity price breaks in a clean install of 2.3.1. and have been getting page errors.

 

I have narrowed it down to the following javascript code

 

<script language="javascript" src="includes/general.js"></script>
<!-- BOF QPBPP for SPPC - Javascript for Tabs //-->
<link rel="stylesheet" href="includes/tabs.css" type="text/css" media="screen">
<script src="includes/javascript/jquery-1.2.6.js" type="text/javascript"></script>
<script src="includes/javascript/ui.core.js" type="text/javascript"></script>
<script src="includes/javascript/ui.tabs.js" type="text/javascript"></script>
<script type="text/javascript">
 $(document).ready(function(){
/* Tabs for Languages */
$("#langtabs > ul").tabs();
/* Tabs for Customer Groups */
$("#qpbpp > ul").tabs();
 });
 </script>

 

I have tried removing this bit of the code

 

<script src="includes/javascript/jquery-1.2.6.js" type="text/javascript"></script>

 

but still the page does not load correctly. there are no errors, its just that the buttons do not load correctly and the delete image text is always highlighted and i an then unable to add extra images. Can anyone shed any light on this.

 

Problem sorted.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

  • 3 weeks later...

Hello. Also installed and did seem to go smoothly. I have 2.3.1 store.

 

But I am unable to see price breaks in admin also menu on left side is messed up, two buttons appear on product info page, etc...

 

Has anyone had multiple errors? Thanx.

Link to comment
Share on other sites

  • 2 weeks later...

Hey

 

I have got a problem when I need to make changes in the application_top.php file.

It says, find this:

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

 

And replace with this code:

//BOF qpbpp
							//$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
							$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']);
//EOF qpbpp

 

But my code looks like this:

$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);

 

Becourse of other adons.

Can anyone see how my code should look when I replace it?

Edited by Blondinen
Link to comment
Share on other sites

Hey I have got a problem when I need to make changes in the application_top.php file. It says, find this:
 $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); 

And replace with this code:

 //BOF qpbpp //$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); $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']); //EOF qpbpp 

But my code looks like this:

 $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false); 

Becourse of other adons. Can anyone see how my code should look when I replace it?

 

not relevant any more.. I gave up

Link to comment
Share on other sites

G"Day All

Updating our website to the V2.3.1

On our current (old) website we can upload Quantity Price breaks through Easypopulate

Through my testing so far we can not do this with the current version.

Is this correct?

Thank you

Ray

Link to comment
Share on other sites

  • 1 month later...

Problem sorted.

In my previous posts i have said i am trying to integrate SPPc and quantity price breaks in a clean install of 2.3.1. and have been getting page errors.

 

I have narrowed it down to the following javascript code

 

<script language="javascript" src="includes/general.js"></script>
<!-- BOF QPBPP for SPPC - Javascript for Tabs //-->
<link rel="stylesheet" href="includes/tabs.css" type="text/css" media="screen">
<script src="includes/javascript/jquery-1.2.6.js" type="text/javascript"></script>
<script src="includes/javascript/ui.core.js" type="text/javascript"></script>
<script src="includes/javascript/ui.tabs.js" type="text/javascript"></script>
<script type="text/javascript">
 $(document).ready(function(){
/* Tabs for Languages */
$("#langtabs > ul").tabs();
/* Tabs for Customer Groups */
$("#qpbpp > ul").tabs();
 });
 </script>

 

I have tried removing this bit of the code

 

<script src="includes/javascript/jquery-1.2.6.js" type="text/javascript"></script>

 

but still the page does not load correctly. there are no errors, its just that the buttons do not load correctly and the delete image text is always highlighted and i an then unable to add extra images. Can anyone shed any light on this.

 

CAn you indicate what your solution was in the end

Link to comment
Share on other sites

Try removing

 

<script src="includes/javascript/jquery-1.2.6.js" type="text/javascript"></script>

<script src="includes/javascript/ui.core.js" type="text/javascript"></script>

<script src="includes/javascript/ui.tabs.js" type="text/javascript"></script>

 

The code is already called in your includes/template_top as it is now part of the jquery files in your ext/jquery/ui/jquery-ui-1.8.6.min.js.

 

I think that was all i had to do.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

  • 2 weeks later...

I'd like to install this contrib but I'm confused. Reviewing the install.html file it says: Quantity Price Breaks Per Product (QPBPP) for osC 2.3.1 Following that just below, it states:

 

- This document describes updates to files based on the full package dated July 22, 2009 (version 1.3.6 / osC 2.2 RC2a)

- The following contents is ONLY valid for oscommercial 2.3.1

 

Does this mean this package (as uploaded) only changes files based on the 2.2 install, or is this a full package for 2.3? I never had this on my 2.2 site, so not sure how to proceed...

Link to comment
Share on other sites

  • 3 weeks later...

Does this mean this package (as uploaded) only changes files based on the 2.2 install, or is this a full package for 2.3? I never had this on my 2.2 site, so not sure how to proceed...

It's been converted to work with 2.3. There are some mistakes in it but they won't revent it from working.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

OSC newbie here....

 

I have installed qpbpp sucessfully but I am unable to figure out how to change the product list page from the regular price to the lowest qpbpp price. I would like it to read "as low as $xx.xx".

 

Could anyone point me in the right directions as to which file to edit and what variable I use?

 

Any help would be greatly appreciated!!!

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I use Easy Populate to add products since I've lots of them (672 and counting). Can I ask you to help QPB integrated into EP?

 

A few suggestions, if you don't mind:

  • since QPB integrates a quantity box, you could mention what the minimum order quantity is (if it has been set) there as well.
  • And move the add to cart button and quantity box to the left under the available options (I think it would make more sense that way).
  • Use jQuery for the table so it could easily integrate if the jQuery UI themes are changed
  • Display the single quantity's (or the minimum quantity) price as it is done on default osC (big font and everything) within the table, with the rest of the price/quantity differences described below.

By the way, where is the box to define the price for the first quantity block? Neither adding or editing prodcuts shows that box: products existing before installing the addon retains the original price and creating new products only lists the price as 0.

Edited by oxwivi
Link to comment
Share on other sites

  • 5 weeks later...

Hi

 

I have this contribution working great on one site thanks to all the suggestions made in this forum, however my second site has the Option Type Feature contribution installed and I’m struggling to get both to work together. Does anybody have these 2 contributions working successfully on their site and if so how would I go about editing the includes/classes/shopping_cart.php file?

 

Thanks

Andy

Link to comment
Share on other sites

Does anyone have a working version of this Module for 2.31? I cant get this module to work on 2.2 .

 

error mysite.com/admin/categories.php

 

Fatal error: Call to undefined function tep_hide_session_id() in /home/web/public_html/mysite.com/admin/categories.php on line 917

 

Error: mysite.com/admin/discount_categories.php

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20, 20' at line 1

 

select dc.discount_categories_id, dc.discount_categories_name from discount_categories dc order by dc.discount_categories_name ASC limit -20, 20

 

Please Help Im lsot on this Ive searched forum

Link to comment
Share on other sites

  • 3 weeks later...

It's been converted to work with 2.3. There are some mistakes in it but they won't revent it from working.

 

I just spent a long time installing the one that is for 2.3.1 and you are correct. Lots of mistkaes. One file at least has not been updated for 2.31, it still calls in header and footer instead of template top and bottom. ( I still have a table offset that is bugging me)

 

I have headers tags from Jack installed, so there was plenty of merging. One thing I did not see was the p products price 1, p products price 2, etc when modifying admin/categories.php like it had years ago when i installed in 2.2 shop. When i finally finished the entire install, there are no places in admin to input the price breaks. I wonder if the code was that wrong, or did I miss a step somewhere. Hopefully I can go back through the whole thing tomorrow, ugh, and double check my work.

 

Funny thing is, aside from the discount categories page being wrong in the add on, all other admin pages work. Just nowhere to input the price breaks when creating or editing a product. Before i slog through all that code again, I was hoping somebody has seen this already. Is it wrong in the addon? What file controls the price break input boxes? I do not see all the queries in admin/categories.php like it used to have.

 

Tim

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...