Jump to content


Corporate Sponsors


Latest News: (loading..)

* - - - - 3 votes

Quantity Price Breaks


846 replies to this topic

#741 vinrita

  • Community Member
  • 7 posts
  • Real Name:Vin

Posted 20 April 2010, 16:42

I finally fixed it. I buried my head in product_info.php, but the issue was with the cart->addcart in application_top.php

Thank you for your great effort in releasing such a great contribution and the support forum.



View Postvinrita, on 20 April 2010, 08:35, said:

Hi Carie,
I am having the same problem with adding item to cart from th product_info page. When i add 1 item, the Cart will show 2. If i add 2, It will show 3 and so on. But if i update the quantity in shopping cart, it works fine. Otherwise, everything works great!!

Have anyone encounter this problem?


#742 briankellett

  • Community Member
  • 4 posts
  • Real Name:Brian Kellett

Posted 20 April 2010, 16:55

Hi,

I have just installed QPBPP V1.3.5 using AutoInstaller 2.14. Everything works perfectly except the prices are not being displayed at all on index.php when a category is selected but are displayed on index.php if I click HOME.

My OsCommerce installation is a version 2.2 RC2a template. The products are displayed in a grid not a list.

Please help ASAP this is driving me mad.

#743 profimag

  • Community Member
  • 5 posts
  • Real Name:Imre Mihaly

Posted 19 May 2010, 04:53

I have installed the contribution, and it's working just fine.
But I have run into a problem. I have set different attributes for some of my products. So the product has a different price if the attribute changes.
For example if I set the attribute "deluxe", the price goes up with 1$.
The only problem is that QPB doesn't recognize this new price. The price in the QPB table is still the same.
Also in the shopping cart when I try to check out, the price it's unchanged (product attribute is not calculated).

Another issue is that subtotal is not calculated and displayed in shopping cart. The text appears, but the value doesn't.

Of course these are minor problems. I can live with them, but it would be more elegant if these were working as well in my page www.profimag.ro

Can anyone help me?

Thanks

#744 bad3000

  • Community Member
  • 13 posts
  • Real Name:badou

Posted 21 May 2010, 14:54

Hello to everyone.
I tried to add the qpbpp table into the shopping cart 'catalog/shopping_cart.php'. But I did not manage. I think this would be very handy to see the possible reduction in the cart.
Could someone please help me?
Thank you

#745 sml

  • Community Member
  • 63 posts
  • Real Name:steve

Posted 29 May 2010, 15:30

Hello everyone,

I tried to execute Quantity price break per product and I got this error:
Error
SQL query:

ALTER TABLE products ADD COLUMN products_qty_blocks int NOT NULL default 1;



MySQL said:

#1060 - Duplicate column name 'products_qty_blocks'

Can anyone can help me how to fix this so it't not duplicate, I am looking forward to your answer. Thank you!

Steve

#746 Jan Zonjee

  • Team Member
  • 7,001 posts
  • Real Name:Jan Zonjee
  • Gender:Male
  • Location:the Netherlands

Posted 29 May 2010, 15:58

View Postsml, on 29 May 2010, 15:30, said:

I tried to execute Quantity price break per product and I got this error:
Error
SQL query:

ALTER TABLE products ADD COLUMN products_qty_blocks int NOT NULL default 1;



MySQL said:

#1060 - Duplicate column name 'products_qty_blocks'
No, you already run the sql commands once and now that field is already there...

#747 sml

  • Community Member
  • 63 posts
  • Real Name:steve

Posted 29 May 2010, 18:22

View PostJan Zonjee, on 29 May 2010, 15:58, said:

No, you already run the sql commands once and now that field is already there...

I know that the "column products_qty_blocks int not null default 1" is in the Products table already, but I want to adds on "quantity price break per products" so how can I modify this sql so it's not duplicate name:

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

DROP TABLE IF EXISTS `products_price_break`;
CREATE TABLE `products_price_break` (
`products_price_break_id` int NOT NULL auto_increment,
`products_id` int(11) NOT NULL,
`products_price` decimal(15,4) NOT NULL default 0.0,
`products_qty` int(11) NOT NULL default 0,
PRIMARY KEY (products_price_break_id)
);

DROP TABLE IF EXISTS `discount_categories`;
CREATE TABLE `discount_categories` (
`discount_categories_id` int NOT NULL auto_increment,
`discount_categories_name` varchar(255) NOT NULL,
PRIMARY KEY (discount_categories_id)
);

DROP TABLE IF EXISTS `products_to_discount_categories`;
CREATE TABLE `products_to_discount_categories` (
`products_id` int NOT NULL,
`discount_categories_id` int NOT NULL,
PRIMARY KEY (products_id)
);

INSERT INTO configuration_group (configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible)
VALUES ('73', 'Price breaks', 'Configuration options for price breaks', 73, 1);
INSERT into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function)
VALUES ('Maximum number of price break levels', 'PRICE_BREAK_NOF_LEVELS', '10', 'Configures the number of price break levels that can be entered on admin side. Levels that are left empty will not be shown to the customer', '73', '1', now(), now(), NULL, NULL);

Edited by sml, 29 May 2010, 18:25.


#748 Jan Zonjee

  • Team Member
  • 7,001 posts
  • Real Name:Jan Zonjee
  • Gender:Male
  • Location:the Netherlands

Posted 29 May 2010, 18:53

View Postsml, on 29 May 2010, 18:22, said:

I know that the "column products_qty_blocks int not null default 1" is in the Products table already, but I want to adds on "quantity price break per products" so how can I modify this sql so it's not duplicate name:

alter table products
add column products_qty_blocks int not null default 1;
So what contribution added that then?

#749 profimag

  • Community Member
  • 5 posts
  • Real Name:Imre Mihaly

Posted 31 May 2010, 12:53

View Postprofimag, on 19 May 2010, 04:53, said:

I have installed the contribution, and it's working just fine.
But I have run into a problem. I have set different attributes for some of my products. So the product has a different price if the attribute changes.
For example if I set the attribute "deluxe", the price goes up with 1$.
The only problem is that QPB doesn't recognize this new price. The price in the QPB table is still the same.
Also in the shopping cart when I try to check out, the price it's unchanged (product attribute is not calculated).

Another issue is that subtotal is not calculated and displayed in shopping cart. The text appears, but the value doesn't.

Of course these are minor problems. I can live with them, but it would be more elegant if these were working as well in my page www.profimag.ro

Can anyone help me?

Thanks
Problems solved, not the one with the attributes.
I think I have to add the products in category list with different attributes, and price.

#750 ceelow

  • Community Member
  • 14 posts
  • Real Name:Cleo
  • Gender:Male
  • Location:US

Posted 01 June 2010, 23:09

Is there a way to merge Quantity Price Break and Header Tags SEO in admin/categories.php?

Running 2.2 RC2A

Edited by ceelow, 01 June 2010, 23:12.


#751 sml

  • Community Member
  • 63 posts
  • Real Name:steve

Posted 02 June 2010, 04:24

I tried to add Quantity price break distributor, yesterday it ran fine, today I got this error message. I don't what I did. I checked the sql table and I saw Products_to_discount_categories there. Can anyone help me please. Thanks

1146 - Table 'sml2005.TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES' doesn't exist

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, p.products_quantity, p.products_qty_blocks, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, ptdc.discount_categories_id from products p left join specials s on p.products_id = s.products_id left join TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES ptdc on p.products_id = ptdc.products_id, products_description pd where p.products_status = '1' and pd.products_id = p.products_id and p.products_id = '40' and pd.language_id = '1'

#752 Jan Zonjee

  • Team Member
  • 7,001 posts
  • Real Name:Jan Zonjee
  • Gender:Male
  • Location:the Netherlands

Posted 02 June 2010, 05:24

View Postsml, on 02 June 2010, 04:24, said:

1146 - Table 'sml2005.TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES' doesn't exist
Classic error of not adding the define for that table (database_tables.php?)

#753 Jan Zonjee

  • Team Member
  • 7,001 posts
  • Real Name:Jan Zonjee
  • Gender:Male
  • Location:the Netherlands

Posted 02 June 2010, 05:26

View Postceelow, on 01 June 2010, 23:09, said:

Is there a way to merge Quantity Price Break and Header Tags SEO in admin/categories.php?
Should be possible but I agree it often becomes a bit of a puzzle after adding several contributions in that file.

#754 jvigilia

  • Community Member
  • 3 posts
  • Real Name:John F Vigilia

Posted 30 July 2010, 04:54

This is an excellent contribution. Thank you.

Im looking to insert a % discount rather than a price discount for some discount catagories.
Also, the field im looking to also sort by is size.
Ex.
The discount pools go as follow
Sizes - Amounts - %
1.5 - 6 bottle case - 15%
.750 - 12 bottle case - 15%
3.0 - 4 bottle case - 15%
5.0 - 4 per case - 15%

Any suggestions?

Edited by jvigilia, 30 July 2010, 04:56.


#755 uneeeq

  • Community Member
  • 4 posts
  • Real Name:Genie
  • Gender:Male

Posted 23 August 2010, 12:35

In process of testing this contribution I found if you have Option Type Features or any product attributes that have comma (for example customer who enters imprint text such as wedding date : August 23, 2010) the add to cart breaks and customer cannot see anything on the site but SQL error till they purge their cookies.

Here is a fix for that:

in

catalog/includes/classes/PriceFormatterStore.php

change this line
$product_id_list_temp_array = explode(",", $product_id_list);

to this

$product_id_list_temp_array = explode(">", $product_id_list);

That changed the separator from comma to a character that is not used in your option/attributes and that seemed to have fixed the issue. Looks like you can use any character or symbol that is not used in the attributes of your products. So you can make it look like

$product_id_list_temp_array = explode("*", $product_id_list);
or
$product_id_list_temp_array = explode("|", $product_id_list);

Genie Livingstone
thanks for not spamming the forums

#756 bonester1981

  • Community Member
  • 13 posts
  • Real Name:Thomas

Posted 28 August 2010, 17:47

In version QPBPP_v1_3_5 you can only add net prices. I was looking for a way to put gross prices in and that is the way you do it:

admin/categories.php

After: (in the javascript section of categories.php)
function updateNet() {
  var taxRate = getTaxRate();
  var netValue = document.forms["new_product"].products_price_gross.value;

  if (taxRate > 0) {
    netValue = netValue / ((taxRate / 100) + 1);
  }

  document.forms["new_product"].products_price.value = doRound(netValue, 4);
}
insert:
<?php 
  for ($count = 0; $count <= (PRICE_BREAK_NOF_LEVELS - 1); $count++) {
?>
function updateGross<?php echo $count; ?>() {
  var taxRate = getTaxRate();
  var grossValue = document.forms["new_product"].products_price<?php echo $count; ?>.value;

  if (taxRate > 0) {
    grossValue = grossValue * ((taxRate / 100) + 1);
  }

  document.forms["new_product"].products_price_gross<?php echo $count; ?>.value = doRound(grossValue, 4);
}

function updateNet<?php echo $count; ?>() {
  var taxRate = getTaxRate();
  var netValue = document.forms["new_product"].products_price_gross<?php echo $count; ?>.value;

  if (taxRate > 0) {
    netValue = netValue / ((taxRate / 100) + 1);
  }

  document.forms["new_product"].products_price<?php echo $count; ?>.value = doRound(netValue, 4);
}
<?php } ?>

Replace:
                if(is_array($price_breaks_array) && array_key_exists($count, $price_breaks_array)) {
                  echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price' . $count, $price_breaks_array[$count]['products_price'], 'size="10"');
                  echo tep_draw_separator('pixel_trans.gif', '24', '15') . TEXT_PRODUCTS_QTY;
                  echo tep_draw_separator('pixel_trans.gif', '24', '15') . tep_draw_input_field('products_qty' . $count, $price_breaks_array[$count]['products_qty'], 'size="10"');
                  echo tep_draw_separator('pixel_trans.gif', '24', '15') . tep_draw_checkbox_field('products_delete' . $count, 'y', false) . TEXT_PRODUCTS_DELETE;
                } else {
                  echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price' . $count, '', 'size="10"');
                  echo tep_draw_separator('pixel_trans.gif', '24', '15') . TEXT_PRODUCTS_QTY;
                  echo tep_draw_separator('pixel_trans.gif', '24', '15') . tep_draw_input_field('products_qty' . $count, '', 'size="10"');
                }

With:
                if(is_array($price_breaks_array) && array_key_exists($count, $price_breaks_array)) {
                  echo tep_draw_separator('pixel_trans.gif', '3', '15') . TEXT_PRODUCTS_PRICE_NET . '&nbsp;' . tep_draw_input_field('products_price' . $count, $price_breaks_array[$count]['products_price'], 'onKeyUp="updateGross'.$count.'()"');
                  echo '<br>' . tep_draw_separator('pixel_trans.gif', '3', '15') . TEXT_PRODUCTS_PRICE_GROSS . tep_draw_input_field('products_price_gross' . $count, $price_breaks_array[$count]['products_price'], 'onKeyUp="updateNet'.$count.'()"');
                  echo tep_draw_separator('pixel_trans.gif', '3', '15') . TEXT_PRODUCTS_QTY;
                  echo tep_draw_separator('pixel_trans.gif', '3', '15') . tep_draw_input_field('products_qty' . $count, $price_breaks_array[$count]['products_qty'], 'size="10"');
                  echo tep_draw_separator('pixel_trans.gif', '3', '15') . tep_draw_checkbox_field('products_delete' . $count, 'y', false) . TEXT_PRODUCTS_DELETE;
                } else {
                  echo tep_draw_separator('pixel_trans.gif', '3', '15') . TEXT_PRODUCTS_PRICE_NET . '&nbsp;' . tep_draw_input_field('products_price' . $count, $price_breaks_array[$count]['products_price'], 'onKeyUp="updateGross'.$count.'()"');
                  echo '<br>' . tep_draw_separator('pixel_trans.gif', '3', '15') . TEXT_PRODUCTS_PRICE_GROSS . tep_draw_input_field('products_price_gross' . $count, $price_breaks_array[$count]['products_price'], 'onKeyUp="updateNet'.$count.'()"');
                  echo tep_draw_separator('pixel_trans.gif', '3', '15') . TEXT_PRODUCTS_QTY;
                  echo tep_draw_separator('pixel_trans.gif', '3', '15') . tep_draw_input_field('products_qty' . $count, '', 'size="10"');
                }

Directly below after:

                ?>
              </td>
            </tr>
            <?php
            }
            ?>

Insert:
<script language="javascript"><!--
<?php 
  for ($count = 0; $count <= (PRICE_BREAK_NOF_LEVELS - 1); $count++) {
?>
updateGross<?php echo $count; ?>();
<?php
}
?>
//--></script>

Now you can enter the price as net or gross. :)

#757 freelancement

  • Community Member
  • 14 posts
  • Real Name:freelancement

Posted 05 September 2010, 00:21

opening my admin login, no longer likes me

Quote

1146 - Table 'admin_mystore_com.TABLE_ADMIN_FILES' doesn't exist

select admin_files_id from TABLE_ADMIN_FILES where FIND_IN_SET( '1', admin_groups_id) and admin_files_is_boxes = '1' and admin_files_name = 'administrator.php'

[TEP STOP]

thoughts?

#758 Jan Zonjee

  • Team Member
  • 7,001 posts
  • Real Name:Jan Zonjee
  • Gender:Male
  • Location:the Netherlands

Posted 05 September 2010, 06:44

View Postfreelancement, on 05 September 2010, 00:21, said:

thoughts?
You obviously messed up your admin/includes/database_tables.php so now that define is missing/out of the PHP tags or something like that but what is the relation with QBPP?

#759 cherishedmoments

  • Community Member
  • 51 posts
  • Real Name:Jenny
  • Gender:Female
  • Location:West Virginia, United States

Posted 03 October 2010, 18:13

Knowing absolutely nothing about PHP, I should just give up! I'm so aggravated right now! Okay, first of all, I already had Option Types installed on my site as well as the security add-ons that were suggested in the forums. After installing Quantity Price Breaks I now have at least two problems so far....

1) When I go to www.mysite.com, it says, "Parse error: syntax error, unexpected T_RETURN, expecting T_FUNCTION in /home2/myusername/public_html/includes/classes/shopping_cart.php on line 464
When I go to that file and look at line 464, it says, "return $products_array;". I HAVE NOT A CLUE what that means or how to fix it!

2) When I go to my admin and click on Catalog and then "Categories / Products", it says "1146 - Table 'myusername_osc1.products_to_discount_categories' doesn't exist"
When I go admin/includes/database_tables.php the last "define" line defines this table so I don't understand why it's saying that it doesn't exist!

Thank god I backed up all of my files right before I installed this. If I've learned nothing else, I've learned to back up.....back up.....and back up again! I'll try to fix this (with your help) but, I guess I'll restore my store and give up if I don't get anywhere. It's a shame, too, because I really need this add-on!

Will someone please help?!

#760 cherishedmoments

  • Community Member
  • 51 posts
  • Real Name:Jenny
  • Gender:Female
  • Location:West Virginia, United States

Posted 03 October 2010, 18:22

In regards to my last post, I'm using OSCommerce v2.2 RC2 and the last 7 lines of my catalog/includes/database_tables.php file reads as follows:

define('TABLE_ZONES', 'zones');
// BOF qpbpp
define('TABLE_PRODUCTS_PRICE_BREAK', 'products_price_break');
define('TABLE_DISCOUNT_CATEGORIES', 'discount_categories');
define('TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES', 'products_to_discount_categories');
// EOF qpbpp
?>

I copied and pasted it directly to this post.