Jump to content
jpweber

Quantity Price Breaks

Recommended Posts

There are contributions that will allow a minimum quantity per product, is there one that will work best with the Quantity Price Breaks contribution..

 

I know that I can specify the minimum quantity in the contribution but that will only allow a customer to order in the specified quantity amounts.

You should use those contributions because they work on the order_total. You shouldn't try to do this in QPBPP because then the customer would need to order a large amount of product first, add a second and only then will he/she be able to lower the amount of the first. Crazy.

Share this post


Link to post
Share on other sites
I have installed V1.2.3 of Quantity Price Breaks Per Product.

 

As illustrated here http://dev.melworks.com.au/catalog/acrylic...ads-p-1002.html

 

my formatting is not right.

 

The quantity box and the price table in the top right corner does not look good. Is it something I have to fix in stylesheet or I have messed up somewhere else.

 

Thanks

 

OK I have used the formatter contribution but I still cannot place the table in the middle of the product info.

 

Anyone know how to move the table from the top right corner to the middle of the product info page?

 

Thanks

 

sam

Share this post


Link to post
Share on other sites

Can Someone please help me out with this contribution. I have edited the files and everything seems to work okay until I try to checkout and I get this message: Warning: Cannot modify header information - headers already sent by (output started at /disk3/home2/web/unlimited/wjp1982/includes/application_top.php:515) in /disk3/home2/web/unlimited/wjp1982/includes/functions/general.php on line 33

 

Can someone please tell me what this means as I am by no means a programmer. This seems like a great contrib if I can just get it working. Thanks again for all your help.

Share this post


Link to post
Share on other sites
Can Someone please help me out with this contribution. I have edited the files and everything seems to work okay until I try to checkout and I get this message: Warning: Cannot modify header information - headers already sent by (output started at /disk3/home2/web/unlimited/wjp1982/includes/application_top.php:515) in /disk3/home2/web/unlimited/wjp1982/includes/functions/general.php on line 33

 

Can someone please tell me what this means as I am by no means a programmer. This seems like a great contrib if I can just get it working. Thanks again for all your help.

You did read information on this common problem and how it often can be solved?

Share this post


Link to post
Share on other sites

I have the quantity price breaks working great with the oscommerce. However, when I add sts template contribution I am having some problems.

 

Does anyone know how to get the quantity price breaks to show up in the sts template. I am not sure how to create a placeholder for Quantity Price Breaks per Product or how to to display them in a table.

 

I have tried the suggestions from previous post:

http://forums.oscommerce.com/index.php?sho...rt=#entry978760

 

but that has not worked. I have also tried Price Break and STS AIO and that has not worked either.

 

I am hoping someone can point me in the right direction...

Thanks.

Share this post


Link to post
Share on other sites
Seems to be there are plenty of reasons other than code errors that can crash with and Internal Server Error :(

It works pretty well for me now. :) I guess it was a problem with the rights.

Thanks for the contribution!

Share this post


Link to post
Share on other sites

got a small prob....

 

Kr12,00 for one

 

2 For Kr11,25

 

but it mutiply(x) them can i set it up to add up (+) insted

 

so the price for 2 is showing as total price and them being add up(+) in shopping basket

Share this post


Link to post
Share on other sites

OK gotta ask for some help here sadly but i hope someone knows a fix for this, or a solution, for starters everything on my site as far as quantity and price breaks works perfectly however... There is one page where we have like 20 different products all priced the same but for example lets say you order 10 of any of the products you get a discount not 10 of each but 10 of any or 20 of any in other words customers can choose from literally any of 20 different items and get a price break even if they order 1 of each of them its the same as them ordering 20 of the same one... please tell me that im sortof clear on this and if anyone cal help mych appreciated :D

Share this post


Link to post
Share on other sites
OK gotta ask for some help here sadly but i hope someone knows a fix for this, or a solution, for starters everything on my site as far as quantity and price breaks works perfectly however... There is one page where we have like 20 different products all priced the same but for example lets say you order 10 of any of the products you get a discount not 10 of each but 10 of any or 20 of any in other words customers can choose from literally any of 20 different items and get a price break even if they order 1 of each of them its the same as them ordering 20 of the same one... please tell me that im sortof clear on this and if anyone cal help mych appreciated :D
It is not available as a contribution, but it shouldn't be impossible. In the contribution there is a description on how to set it up to ignore attributes. That same kind of "grouping" could be used for your scenario. It would need an extra column in the table products. In it you would store either a unique code for the product (e.g. p1234 if the products_id is 1234) or the discount category (say c4) for the product.

 

Then in the admin you would need an extra page to setup the discount categories (in a separate MySQL table) and in admin/categories.php you should be able to add/change/remove the discount category for a product.

 

That is all B)

Share this post


Link to post
Share on other sites

I'm new to OS Commerce, and with PHP.

 

I downloaded the Quantity Price Breaks. According to the install.html doc it instructs me to make changes to specific files, i.e. Find/Replace or Insert

 

I did all the replace/insert steps, but I don't understand the first part of this doc which states:

 

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

Use a database editor (e.g., phpMyAdmin) to alter your database

(or use the included sql file price-break_v1_2_0.sql instead):

 

alter table products add column products_price1 decimal(15,4) not null default 0.0;

alter table products add column products_price2 decimal(15,4) not null default 0.0;

alter table products add column products_price3 decimal(15,4) not null default 0.0;

alter table products add column products_price4 decimal(15,4) not null default 0.0;

alter table products add column products_price5 decimal(15,4) not null default 0.0;

alter table products add column products_price6 decimal(15,4) not null default 0.0;

alter table products add column products_price7 decimal(15,4) not null default 0.0;

alter table products add column products_price8 decimal(15,4) not null default 0.0;

alter table products add column products_price1_qty int not null default 0;

alter table products add column products_price2_qty int not null default 0;

alter table products add column products_price3_qty int not null default 0;

alter table products add column products_price4_qty int not null default 0;

alter table products add column products_price5_qty int not null default 0;

alter table products add column products_price6_qty int not null default 0;

alter table products add column products_price7_qty int not null default 0;

alter table products add column products_price8_qty int not null default 0;

alter table products add column products_qty_blocks int not null default 1;

 

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

 

Where is this information to alter? If I use the included sql file price-break_v1_2_0.sql instead, where do I put the file?

 

 

At this point, when I click on Categories in the Admin control, I see this:

 

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

Categories / Products Status Action

 

 

1054 - Unknown column 'p.products_price1' in 'field list'

 

select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, 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_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from products p, products_description pd, products_to_categories p2c where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = '0' order by pd.products_name

 

[TEP STOP]

 

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

 

 

 

Any ideas what to do next?

 

Wayne

Share this post


Link to post
Share on other sites
Where is this information to alter? If I use the included sql file price-break_v1_2_0.sql instead, where do I put the file?

:'(

In case you haven't figured this out yet, an osCommerce shop is a database driven website. Products descriptions, prices, names of images that go with a product etcetera are all stored in a database, a MySQL database to be precise.

 

The database that is set up when you install a store does not contain the database fields necessary to store the price breaks. Therefore these have to be added to the database and that is where the sql file is for.

 

Most hosting companies install phpMyAdmin for their clients to tinker with their database(s). Check that and if so read the docs on the phpMyAdmin site on how to use an sql file to do something with a MySQL database. Some pictures on how phpMyAdmin looks can be found in this thread too.

Share this post


Link to post
Share on other sites

I keep getting an error when I load up my store. Admin seems to be intact and working fine. Any ideas on the cause?

 

Fatal error: Cannot redeclare class priceformatter in /web/osc/includes/classes/PriceFormatter.php on line 19

Edited by lishen

Share this post


Link to post
Share on other sites

I figured my above question out...but now i've got this error message:

Parse error: syntax error, unexpected T_ELSEIF in /web/osc/includes/modules/product_listing.php on line 110

 

This is my code. I've added another mod..call for pricing so I'm not sure how to update it as per the install instructions.

Instructions say:

Find (around line 109):

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

Replace With:

$pf->parse($listing);
		$lc_text = $pf->getPriceStringShort();

 

This is the code that I have and am not sure how to update it. Any help would be great.

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> '; 
		} 
   elseif ($listing['products_price'] == 999999){ 
		  $lc_text = TEXT_CALL_FOR_PRICE; 
		} else { 
		  $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' '; 
		} 
		break; 
		case 'PRODUCT_LIST_QUANTITY':
		$lc_align = 'right';
		$lc_text = ' ' . $listing['products_quantity'] . ' ';
		break;

Share this post


Link to post
Share on other sites
I figured my above question out...but now i've got this error message:

Parse error: syntax error, unexpected T_ELSEIF in /web/osc/includes/modules/product_listing.php on line 110

 

This is my code. I've added another mod..call for pricing so I'm not sure how to update it as per the install instructions.

I would add that piece of code of that mod to the function getPriceStringShort() in the class PriceFormatter and replace that whole stuff between $lc_align= 'right'; and break; with the $pf-> etcetera.

 

  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> ';
}
   elseif ($this->thePrice == 999999) { 
		  $lc_text = TEXT_CALL_FOR_PRICE; 
} else {
  if($this->hasQuantityPrice == true) {
etcetera

Share this post


Link to post
Share on other sites

I get a similar error. As I understand it, there might be an error in how the "else" statements are used.

 

My error says:

Parse error: parse error, unexpected T_ELSE in /catalog/admin/categories.php on line 927

 

This is what I have. Line

 $products_count = 0;
if (isset($HTTP_GET_VARS['search'])) {
		$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price,	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_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name");

THIS IS LINE 927

} else {
  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, 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_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name");
} else {
  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name");
}
while ($products = tep_db_fetch_array($products_query)) {
  $products_count++;
  $rows++;


If you have a serious problem but it can be solved, why worry about it? If you have a serious problem but it can't be solved, then why worry about it?

Share this post


Link to post
Share on other sites
I get a similar error.
But in a totally different file. You might have accidently added/deleted a { or }. Your line numbers seem to be almost the same as an original categories.php with only QPBPP added. If that is the only contribution you have added, why not use the one from the package?

 

Another option is try to follow which parenthesis (}{) corresponds with which. The } before the else { in your second code block is supposed to partner the one in your first code block (the one in if (isset($HTTP_GET_VARS['search'])) {). PHP editors (like the FOSS JEdit) can show you that (saved me a lot of searching :) ).

Share this post


Link to post
Share on other sites

Hi:

 

I deleted all I had and installed the contribution on a clean install of OSC and all works fine.

 

Thanks for the JEdit suggestion, it's really cool.


If you have a serious problem but it can be solved, why worry about it? If you have a serious problem but it can't be solved, then why worry about it?

Share this post


Link to post
Share on other sites

I have a small problem and haven't been able to figure it out.

 

When a customer enters the quantity on the product info page, the quantity doesn't show up on the shopping cart page. I can select 25 as my quantity, but on the next page it shows up as a quantity of 1. It seems I can only set the quantity on the order on the shopping cart.

 

Is there some code that I need to change in the PriceFormmater.php or any other page for this to work?

 

I was trying to figure it out and thought that maybe the catalog/product_info.php page might be where the problem is. See code below, from line 217:

 

<table border="0" align="right">
				<tr><td align="center">
				  <?php echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>
				</td></tr>
				<tr><td align="center">
				  <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>
				</td></tr>
		  </table>

 

I have installed the QPBPP in three stores and they all have the same problem... Any thoughts?

 

Best Regards,

Chris

Share this post


Link to post
Share on other sites
This is done in application_top.php, in the functions that handle the shopping cart actions like add_cart. Either you didn't add the code for the quantlty field in product_info.php correctly (e.g. outside of the form tags) or you didn't make the required changes in application_top.php.

 

Regards, Jan

 

Thanks Jan. That was the problem.

Share this post


Link to post
Share on other sites

I have installed QPBB 1.2.1 and its working fine great mod, but since i have installed it and want to add new products to the catalog when i add the single product price in the

 

Tax Class: taxable goods

Products Price (Net): 1.00

Products Price (Gross): 1.75

 

this single unit price now shows up as £0.00 can someone please help.

Share this post


Link to post
Share on other sites
I have installed QPBB 1.2.1 and its working fine great mod, but since i have installed it and want to add new products to the catalog when i add the single product price in the

 

Tax Class: taxable goods

Products Price (Net): 1.00

Products Price (Gross): 1.75

 

this single unit price now shows up as £0.00 can someone please help.

You are not really clear about this. Does this mean the product price is not added to the database when you insert a new product, or does it only show up on the catalog side as 0.00. Does this mean that you can update products with the another price? Do the price breaks get added to the database or not?

 

If it only goes wrong when you add a new product there probably went something wrong when you added this contribution to admin/categories.php.

Share this post


Link to post
Share on other sites

I have found the problem i was missing this piece of code at line 218 - 227 approx in admin/categories.php

 

'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),

 

Thanks for your help

Share this post


Link to post
Share on other sites

I was wondering if anyone who uses QPBPP has figured out a way to display the lowest price on boxes such as the "What's New" box or the "New Products for *Month*" box.

 

An example would be:

 

I'm selling pens. If a customer buys only 1 pen, it will cost them $3.00 for the one pen, but if they buy 1000 pens, it will cost them $1.00 each. I would like to display the pens price as $1.00 on the "What's New" box.

 

Is it about adding function getLowPrice to each box? Where specifically would I change the code in the "What's New" box, as an example:

 

if (tep_not_null($random_product['specials_new_products_price'])) {
  $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
  $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
} else {
  $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));

 

I'm still new to PHP, so it's taking me time to figure all this stuff out. Thanks in advance for any help!

Share this post


Link to post
Share on other sites

Hi, I'm trying to get QPBPP 1.2.3 to work with File Upload .77. The file upload part is successful, but when I enter any quantity over my minimum quantity and click 'add to cart,' only my minimum quantity shows up in the shopping cart. For example, I have my site set up to only sell in quantities of 25. So, if I enter 50 or 150 on the product info page, it only shows up as only 25 in the shopping cart.

 

After researching the forums, I believe the problem has to do with my application_top.php file, specifically the part about "// customer adds a product from the products page." So here's the code for that section:

 

// customer adds a product from the products page
case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
$qty = preg_replace('/[^0-9]/i', '', $HTTP_POST_VARS['quantity']);
// iii 030813 added: File uploading: save uploaded files with unique file names
$real_ids = $HTTP_POST_VARS['id'];
if ($HTTP_POST_VARS['number_of_uploads'] > 0) {
require(DIR_WS_CLASSES . 'upload.php');
for ($i = 1; $i <= $HTTP_POST_VARS['number_of_uploads']; $i++) {
if (tep_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]]) and ($_FILES['id']['tmp_name'][TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]] != 'none')) {
$products_options_file = new upload('id');
$products_options_file->set_destination(DIR_FS_UPLOADS);
if ($products_options_file->parse(TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i])) {
if (tep_session_is_registered('customer_id')) {
tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . tep_session_id() . "', '" . $customer_id . "', '" . tep_db_input($products_options_file->filename) . "')");
} else {
tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . tep_session_id() . "', '" . tep_db_input($products_options_file->filename) . "')");
}
$insert_id = tep_db_insert_id();
$real_ids[TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
$products_options_file->set_filename("$insert_id" . $products_options_file->filename);
if (!($products_options_file->save())) {
break 2;
}
} else {
break 2;
}
} else { // No file uploaded -- use previous value
$real_ids[TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]] = $HTTP_POST_VARS[TEXT_PREFIX . UPLOAD_PREFIX . $i];
}
}
}
$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids))+($qty == '' || $qty < 1 ? '1' : $qty), $real_ids);
// iii 030813 end of changes.
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;

 

Any thoughts on how to fix it, so, when the quantity is entered on the product info page, this quantity will show up correctly in the shopping cart, and not just the minimum quantity?

 

By the way...I think this might be answered here but I don't read German.

 

Thanks,

Jill

Share this post


Link to post
Share on other sites
$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids))+($qty == '' || $qty < 1 ? '1' : $qty), $real_ids);

 

Any thoughts on how to fix it, so, when the quantity is entered on the product info page, this quantity will show up correctly in the shopping cart, and not just the minimum quantity?

 

By the way...I think this might be answered here but I don't read German.

Actually, it is Dutch. I'm pretty sure that if you replace the lines at the end of your posted code (see above) with the one in that post:

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

you should be fine (I assume you also need to change one of the lines that establishes $qty is exchanged for the Price Break version. (new $pf, $qty = ... etcetera).

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

×