Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity Price Breaks


jpweber

Recommended Posts

I tried changing from 744 to 755 and then to 777. Nothing's changed. Argh... this is so frustrating! What am I doing wrong?

 

Try saving the following as a file called test.php and place it in your shop root (where catalog/index.php lives).

 

<?php
require_once 'includes/application_top.php';
if( is_readable(DIR_WS_INCLUDES . 'database_tables.php') ){
 echo 'File: ' . DIR_WS_INCLUDES . 'database_tables.php is perfectly fine and can be read<br />' . "\n";
} elseif( file_exists(DIR_WS_INCLUDES . 'database_tables.php') ){
 echo 'File ' . DIR_WS_INCLUDES . 'database_tables.php exists but is not readable .. you need to change the file permissions<br />' . "\n";
} elseif(!file_exists(DIR_WS_INCLUDES . 'database_tables.php')) {
 echo DIR_WS_INCLUDES . 'database_tables.php is not in the required location<br />' . "\n";
} else {
 echo 'I\'m officially stumped, I haven\'t got a clue what the problem is!';
}
require_once 'includes/application_bottom.php';  
?>

 

browse to the file and see what it reports.

Edited by FWR Media
Link to comment
Share on other sites

Has anyone come across this error after clicking on "Update" when adding or editing a product?

 

Fatal error: Call to undefined function qpbpp_insert_update_discount_cats() in C:\wamp\www\osc\admin\categories.php on line 283

 

Here is the section of code the error refers to:

          $current_discount_category = (int)$_POST['current_discount_cat_id'];
         $new_discount_category = (int)$_POST['discount_categories_id'];
         $discount_category_result = qpbpp_insert_update_discount_cats($products_id, $current_discount_category, $new_discount_category);
         if ($discount_category_result == false) {
           $messageStack->add_session(ERROR_UPDATE_INSERT_DISCOUNT_CATEGORY, 'error');
         }

 

I am using OSC 2.2 RC2a and the module version I downloaded and installed is September 7, 2008 (version 1.3.5 / osC 2.2 RC2a)

 

Andy

Link to comment
Share on other sites

Has anyone come across this error after clicking on "Update" when adding or editing a product?

 

Fatal error: Call to undefined function qpbpp_insert_update_discount_cats() in C:\wamp\www\osc\admin\categories.php on line 283

You were supposed to add that function to your admin/includes/functions/general.php. If you don't do that ....

Link to comment
Share on other sites

You were supposed to add that function to your admin/includes/functions/general.php. If you don't do that ....

 

It is there. I compared the supplied files with my files using Winmerge. This allowed me to make sure I did not overwirte any code that I had to add when I installed the CanadaPost Shipping Module.

 

I even went through every file again to verify that the required code was indeed inputted and it is.

 

Andy

Link to comment
Share on other sites

It is there. I compared the supplied files with my files using Winmerge. This allowed me to make sure I did not overwirte any code that I had to add when I installed the CanadaPost Shipping Module.

 

I even went through every file again to verify that the required code was indeed inputted and it is.

I can only think of two reasons.

A. You put the function after the last PHP closing mark ?>

B. You added it to the catalog file instead of the admin file.

 

If it not either one of those I don't know what's wrong.

Link to comment
Share on other sites

Hello,

 

I've installed QPBPP successfully and it's working nicely with the price breaks.

 

However, when viewing individual products on the products_info.php page, i don't see a table displaying the quantity and price breaks. Am i supposed to? In the admin system there is a nice table that displays the breaks, i'd like to have this on the front end too.

 

Can you tell me how i can achieve this please?

 

 

Thanks,

 

 

James

Link to comment
Share on other sites

jgalley, you must have missed the step where you add the code for the QPB table... OR you put it in the wrong place.. open that file and take a look in the instructions where they tell you the edit product_into.php

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

jgalley, you must have missed the step where you add the code for the QPB table... OR you put it in the wrong place.. open that file and take a look in the instructions where they tell you the edit product_into.php

 

 

Yeah, i've double checked the new code snippets for the product_info.php file - according to the instructions, there's 3 sections of new code at line 72, 77 and 213. My product_info.php file has all 3 of these snippets in the right places. I might go back to my backup and try it over again, just to make sure.

 

Is there another file that is called at this point that i might need to double check? Or is it dealt with solely by the product_info.php file?

 

Thanks,

 

 

James

Link to comment
Share on other sites

yes, i do believe that the QPB table calls for the class that you might not have added as well...

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

yes, i do believe that the QPB table calls for the class that you might not have added as well...

 

 

Ah! I've found the problem.

 

The QPB table is echoed from $products_price in the code:

 

<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>

 

I had removed this line to fit with my page design... and hence the QPB table wasn't showing up!

 

 

Always the simple things....

 

 

Cheers!

 

 

James

Link to comment
Share on other sites

Hello guys, is this module configurable in v2.2 MS2 ?? if yes then plz let me know how.

Why wouldn't it be? Actually, you would run into a change added in RC1 that uses the function calculate_price (a new function in the class currencies). You could add only those changes from RC1 to your installation but a number of security issues were added to osC 2.2 over the years too. Also you might not need the changes for PHP5 and more particular for MySQL5 at this moment but one day your hosting provider will upgrade and then you have to do it anyway (and might lose business while the shop is not working properly).

 

It's a pain in the butt to upgrade but it has it advantages so I would suggest to do it.

Link to comment
Share on other sites

Hello All,

 

I have installed this add-on and love it. I have zero problems with it. Everything actually worked correctly right from the start with no bug chasing. :)

 

Anyhoo, here's my question and I have searched the entire thread but not really found this info. I have a "Discount Category" set up for a number of my products. So, 3pc of part A, 6pc of part B and 1pc of part C will get you the 10pc qty discount for that "Discount Category". All works as it should with discount being calculated when the customer gets to the checkout confirmation page. The only issue(used loosely) that I see, is that customer doesn't know he/she is gonna get that discount when they are first shopping and selecting items for their cart.

 

I suppose I can add a bit of text to those particular product descriptions to inform the customer that this item belongs to a "Discount Category". That is no biggie. I wasn't sure if there was a more automated way of handling this? Maybe I have missed something? Sorry if this is petty.

 

Thanks again Jan for a fantastic contribution and the way you "maintain" it.

 

Cheers, Jeff

Link to comment
Share on other sites

I installed this today, but when I log into the admin and go to my products page, I get the error "1146 - Table 'databasename.products_to_discount_categories' doesn't exist.

 

I read in another thread that it could be cause by excluding a few lines from database_tables.php, but this is not the case here, nor did I leave out any lines of code in general, as I overwrote the original files, as to save myself from installing this manually.

 

So, is there another explanation for this aside from leaving a few lines out of database _tables.php?

Link to comment
Share on other sites

I installed this today, but when I log into the admin and go to my products page, I get the error "1146 - Table 'databasename.products_to_discount_categories' doesn't exist.

 

I read in another thread that it could be cause by excluding a few lines from database_tables.php, but this is not the case here, nor did I leave out any lines of code in general, as I overwrote the original files, as to save myself from installing this manually.

 

So, is there another explanation for this aside from leaving a few lines out of database _tables.php?

If you left out the definition of the table in database_tables.php I would expect to see the error to read Table 'databasename.table_products_to_discount_categories' doesn't exist. or Table 'databasename.TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES' doesn't exist.. Did the included price_break.sql ran OK? In other words do you see that table (plus the table discount_categories) when you check your database?

Link to comment
Share on other sites

I suppose I can add a bit of text to those particular product descriptions to inform the customer that this item belongs to a "Discount Category". That is no biggie. I wasn't sure if there was a more automated way of handling this? Maybe I have missed something? Sorry if this is petty.

The question hasn't come up before but it is a valid one IMO.

Perhaps you can look at one of the cross-sell contribution (xsell) that uses a includes/modules/xsell_products.php and adapt that for this. Or perhaps a box in the right column to show other items if there is a discount category for the product shown.

PriceFormatter.php contains a method to get the discount categories id by the way. To use in product_info.php:

$discount_category = $pf->get_discount_category();

Link to comment
Share on other sites

The question hasn't come up before but it is a valid one IMO.

Perhaps you can look at one of the cross-sell contribution (xsell) that uses a includes/modules/xsell_products.php and adapt that for this. Or perhaps a box in the right column to show other items if there is a discount category for the product shown.

PriceFormatter.php contains a method to get the discount categories id by the way. To use in product_info.php:

$discount_category = $pf->get_discount_category();

Jan,

 

After your pointer, I investigated and came up with a solution. I create a table above the "also purchased" table if more than one product is in the same "Discount Category" as the product being viewed.

 

Take a look and tell me what you think. I don not have hundreds or thousands of products so it will work good for me. I'm sure the code can be cleaned up but it does function properly(so far). :)

 

Any of the "colored inserts" are in the same Discount Category. www.classicapi.com

 

Cheers, Jeff

Link to comment
Share on other sites

After your pointer, I investigated and came up with a solution. I create a table above the "also purchased" table if more than one product is in the same "Discount Category" as the product being viewed.

Good idea.

 

Any of the "colored inserts" are in the same Discount Category.

I tried combining products 58, 61, and 75 but the discount category didn't seem to work <_<

Link to comment
Share on other sites

Good idea.

 

 

I tried combining products 58, 61, and 75 but the discount category didn't seem to work <_<

Jan,

 

You are sort of right. Well, completly right. It clearly doesn't work perfectly. I was so proud of myself and you found a bug that I haven't seen yet. :blush:

 

I must have a small issue somewhere. Check out the 2 screen shots. The first one I clicked "cart contents" after adding my 3rd item to the cart. The discount is 21+ so this total should be 21*.18=$3.78, not 21*.20=$4.20...not correct. For the 2nd screen shot, I clicked "check out" which directed me to log-in, the back to shopping cart...now it's correct!

 

Any pointers on where to look??

 

I really didn't think this would turn into a support post. :(

screenshot1.jpg

screenshot2.jpg

Cheers, Jeff

Link to comment
Share on other sites

I must have a small issue somewhere. Check out the 2 screen shots. The first one I clicked "cart contents" after adding my 3rd item to the cart. The discount is 21+ so this total should be 21*.18=$3.78, not 21*.20=$4.20...not correct. For the 2nd screen shot, I clicked "check out" which directed me to log-in, the back to shopping cart...now it's correct!

 

Any pointers on where to look??

Start with adding to e.g. the footer.php somewhere in between the PHP tags:

echo '<pre>';
print_r($pfs);

If you see the correct discount category for the products than that part is covered.

If that is OK then you should look at the function calculate in includes/classes/shopping_cart.php. As far as I can recall that is the one that does the calculation with the other items (calling on a function in includes/classes/PriceFormatter.php but I assume you left that alone):

		  $products_price = $pf->computePrice($qty, $nof_other_items_in_cart_same_cat);
// EOF qpbpp

Link to comment
Share on other sites

If you left out the definition of the table in database_tables.php I would expect to see the error to read Table 'databasename.table_products_to_discount_categories' doesn't exist. or Table 'databasename.TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES' doesn't exist.. Did the included price_break.sql ran OK? In other words do you see that table (plus the table discount_categories) when you check your database?

I fixed my problem -- I had just forgotten to upload the SQL databases. Thanks for the replay, though.

Link to comment
Share on other sites

Hi people, this is my first post here so i want to say sorry about my english.

 

I was installed the Quantity Price Breaks Per Product (QPBPP) MOD to my oscommerce site and i has this error

 

"Fatal error: Call to a member function getPriceFormatterData() on a non-object in /home/gala/htdocs/includes/classes/shopping_cart.php on line 285"

 

This is the line in /home/gala/htdocs/includes/classes/shopping_cart.php:

 

"// BOF qpbpp

 

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

 

if ($product = $pfs->getPriceFormatterData($products_id)) { //line 285

 

$prid = $product['products_id'];

 

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

 

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

 

// EOF qpbpp"

 

So, i need to fix this problem as soon as posible, so thanks to all who can help me.

 

See you soon...

Link to comment
Share on other sites

Sorry for this post but i can't find the edit buttom

 

I forgot to say that i can't made one step in the instalation process

 

i dont find this line global $currencies; in the \catalog\includes\classes\shopping_cart.php

 

and i need to remplace to this line: global $currencies, $languages_id, $pfs; // for qpbpp added: $languages_id, $pfs

 

maybe here is the error, but where i must put this line????

Link to comment
Share on other sites

Start with adding to e.g. the footer.php somewhere in between the PHP tags:

echo '<pre>';
print_r($pfs);

If you see the correct discount category for the products than that part is covered.

Yes Jan. That looks correct.

 

If that is OK then you should look at the function calculate in includes/classes/shopping_cart.php. As far as I can recall that is the one that does the calculation with the other items (calling on a function in includes/classes/PriceFormatter.php but I assume you left that alone):

		  $products_price = $pf->computePrice($qty, $nof_other_items_in_cart_same_cat);
// EOF qpbpp

All intact. I did not touch anything here in shopping_cart.php or in PriceFormatter.php.

 

I went thru includes/classes/shopping_cart.php to double check all code modifications, and all are spot on.

 

In doing more testing, if I am at the shopping_cart page, with correct discounts showing, refreshing the page maintains the proper discounts. If I click the "update cart" button, the prices then are incorrect, without discount quantities being applied.

 

Any other ideas? :rolleyes:

 

Regards, Jeff

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