Jump to content

[FREE MODULE] Category Quantity Discount -Apply Quantity Discounts across all products in a category


Recommended Posts

Want to apply quantity discounts across multiple products?

You can assign all the products to a certain category, add it in the module and quantity discounts will apply to all those products.

Example: Product A and Product B both have a 20% discount starting from quantity of 10.
If you add 5X Product A and 5X Product B, the module will calculate the discount based on the quantity of both (5 + 5 = 10) and will qualify for the discount.

Screenshot: http://screencast.com/t/pWxo1K19pY0

Available at http://www.presto-ch...y-discount.html

 

Download link: http://www.presto-changeo.com/attachment.php?id_attachment=7

Tested on PrestaShop 1.4, 1.5

For earlier versions see http://www.prestasho...fault-category/


V1.0.2 Released
* Fix for products with a special price for 1 quantity (in the prices tab).


V1.0.3 released
* Support for PS 1.4.7
* Fix for error when cart object is not yet created.


V1.1 released
* Added support for PS 1.5 - 1.5.4
* Added support for PS 1.4.10 & 1.4.11

 

V1.2 released
* Added support for PrestaShop 1.5.5 - 1.5.6
 
V1.3 released
* Added support for PrestaShop 1.6
Demo added to product page. 
* Added support for PrestaShop 1.6
Demo added to product page. 
 
v1.4 released

* Added support for PrestaShop 1.6.1

  • Like 4

Share this post


Link to post
Share on other sites

Hi Tomerg,

 

What can I change to have this dicsount in ALL categories in shop, for all products?

This modul is working only when products are in one, this same categorie.

I have got presta 1.4.4.1.

 

Thanks in advance!

Share this post


Link to post
Share on other sites

Try changing the old function to the following (in categoryquantitydiscount.php)

 


public function getRealQuantity($id_product, $id_cart, $quantity)
{
   global $cart;
   return $cart->nbProducts();
}

Share this post


Link to post
Share on other sites

I was changed it in different place. Now I do it correct, modul is working.

 

But in admin/catalog the product doesn't show at all. Even if I searching products.

 

So something it's wrong. When I delate override/classes/product.php admin site is working, but modul don't :/

Share this post


Link to post
Share on other sites

Is it possible to change oryginal code to choose a few category to discount? Not only one.

This should be better way to have discount in all categories in shop without problems in admin.

Share this post


Link to post
Share on other sites
  • 3 weeks later...

Yes i'm sure, Its on a local server MAMP for macs the address reads localhost:8888/prestashop/ don't know if that would make a difference?

 

But I put product.php file into localhost:8888/prestashop/override/classes. I didn't have to replace anything as there was no product.php file in there to begin with.

Share this post


Link to post
Share on other sites

I would really like to have this module but I haven´t got a single clue on how to make it work.

I have downloaded and installed it but then what?

 

I don´t understand this:

  • The line below will appear in RED until you copy the modified file, it will turn GREEN after you copy the file and reload the page.
  • Copy /module/categoryquantitydiscount/modified_1.4.5/override/classes/Product.php to /override/classes/
  • If you already have Product.php in /override/classes/ you will need to copy or merge the "getPriceStatic()" function from our modified file.

 

Should I just give up?

Share this post


Link to post
Share on other sites

Lets say your Prestashop is installed in /home/xxxxx/public_html/

 

The module will be in /home/xxxxx/public_html/modules/categoryquantitydiscount/

 

You need to copy the override file from /home/xxxxx/public_html/modules/categoryquantitydiscount/modified_1.4.5/override/classes/Product.php

 

To the main Prestashop override folder /home/xxxxx/public_html/override/classes/

Share this post


Link to post
Share on other sites
  • 2 weeks later...

tomerg,

 

Could you please also post a code section that i can manually insert in classes/product.php for presta V1.3.1 (or something similar)?

I would be obliged if you could post such code since this is a very interesting module.

Thanks for any possible effort.

Share this post


Link to post
Share on other sites

Thanks very much Tomerg for immediate repsonce.

I tried the code and later the files atached in that forum message but didnt work. Perhaps i am doint something wrong (files were for Presta 1.3.2 & i have Presta 1.3.1).

Note: The Red indication in you module config didnt dissapeared after inserting the code or files.

Share this post


Link to post
Share on other sites

The mod for 1.3.2 has nothing to do with this module.

 

It was an old contribution I made before PS 1.4 came it, it has no backoffice interface.

You will have to compare it to your 1.3.1 files to make sure it is compatible.

You can also upgrade to PS 1.4.

Share this post


Link to post
Share on other sites
  • 3 weeks later...

There seems to be a problem with special prices.

 

I don't know where exactly - but if I apply quantity discount rule to some category, special prices starting from 1 product stop working - no matter what kind of discount I set (percentage, ammount, or set manually).

 

I use quantity discount, special prices (starting from 1 product - those are the problem) and packs. Packs dont have quantity discount but consist of product that have quantity discount applied - maybe thats the case?

 

I doublechecked it - after I turn off your mod to a category, special prices are back. It behaves same way even if I change the code to apply quantity discounts to all products in a shop, not to certain categories.

 

Notice 1: It just doesn't display the price after discount in product list, details and blocks - but in cart the price shows up ok.

Notice 2: After I change the function to apply quantity discounts to all the products in a shop, packs disappear in the back office.

 

Prestashop v1.4.5.1

 

Despite that it's a fantastic mod. Thank you!

 

Now notice: When I make the chcange for all the products as you suggested here, a couple of lines earlier - it works for the front-end - fixes all the problems. But it causes problems in the back office - theres no way to display any product.

Edited by weiser78 (see edit history)

Share this post


Link to post
Share on other sites
  • 2 weeks later...

version 1 & 1.0.1 Work on localhost on a Mac with Mamp Pro the signal is green

 

Don't Work on this french pro host AQUARAY : http://www.aquaray.fr/

 

always red signal do you have a solution ? i can't change my production host.

 

 

Informations sur votre serveur Aquaray

Version de Prestashop: 1.4.6.2

Informations sur votre serveur: Darwin Darwin Kernel Version 10.6.0: Wed Nov 10 18:11:58 PST 2010; root:xnu-1504.9.26~3/RELEASE_X86_64 x86_64

Version du logiciel serveur: Apache

Version de PHP: 5.3.6

Version de MySQL: 5.1.60-3-log

Paramètres requis: OK

Paramètres optionnels: OK

Share this post


Link to post
Share on other sites

I am having a problem with the current version.

 

I have specific price discount for x6 of a product on all products in the one category. There is one product in the same category that is on sale and has a specific price discount starting a x 1 item (x 6 does not apply to this product). However on the product page and the category page the product price is unchanged (The x 1 discount is not applied). Adding the product to the cart shows it at the discounted price but the price is not changed otherwise.

Share this post


Link to post
Share on other sites
  • 1 month later...

Hi want to know if there is a modules for discounts for instance like this:

 

first object (full price)

on each second object (-5%)

on each third object (-10%)

 

Thanks for reply,

Imp

Share this post


Link to post
Share on other sites
  • 1 month later...

Good day Tomerg3,

 

Thank you for the great module however I am having trouble getting it to work on Prestashop v.1.4.7.0

 

I've downloaded the latest version on your website, added the module via the admin panel, copied over the products.php to webroot/override/classes; cleared my cached and the compile files for smarty just to make sure it's cleared.

Refreshed the module page on the admin panel but still it doesn't go green.

 

Is there anything else I might have missed besides just installing the mod and copying that one file?

 

Look forward to hearing from you.

 

Regards,

Jhorene

Share this post


Link to post
Share on other sites

1) Test if it works (even if the line still shows in red), if it does, don't worry about it.

 

2) You can check that the file size is the same between /override/classes/Product.php and /modules/categoryquantitydiscount//override/classes/Product.php

Sometimes when you copy it the file transfer type is wrong, and the filesize will change a bit, and they will not match (but would still work).

Share this post


Link to post
Share on other sites

Hi there Tomerg3,

 

Thank you so much for your quick reply. I copied the file via my Cpanel/File Manager instead of using FileZilla and FTP and it seems to have solved my problem. It's turning green and working !!

 

Awesome - thanks again.

 

Kind regards,

Jhorene

Share this post


Link to post
Share on other sites
  • 1 month later...
  • 1 month later...

Hi tomerg3,

i have prestahop version 1.4.8.2 with module category quantity discount V1.0.4.

If I apply quantity discount rule to some category, special prices starting from 1 product stop working.

 

But V1.0.4 has not Fix for products with a special price for 1 quantity (in the prices tab)?

 

I'm sorry for my english.

 

Thank you

Share this post


Link to post
Share on other sites

Try changing the old function to the following (in categoryquantitydiscount.php)

 


public function getRealQuantity($id_product, $id_cart, $quantity)
{
global $cart;
return $cart->nbProducts();
}

 

This worksgreat. However, I can not list the products in BO..is there a workaround?

 

Fatal error: Call to a member function nbProducts() on a non-object in /storage/content/90/108490/missretro.se/public_html/modules/categoryquantitydiscount/categoryquantitydiscount.php on line 123

Share this post


Link to post
Share on other sites

The module simply combines the total of products from a category when calculating quantity discounts, you still need to create all the discounts from Prestashop (prices tab in the product editor)

Share this post


Link to post
Share on other sites

I have created one quantity discount in one product, and this module is installed and with green text, so, How to apply this discount to the category that I want? Where can I configure it? (selecting the discount and applying it to the category). Thnks

Share this post


Link to post
Share on other sites
  • 2 months later...

I have submitted this question as a support request from the vendor, but ask again here in case anyone knows, will this mod work when the product is in multiple catagorys ? Just to complicate matters further all the products are listed in a 'master catagory' with various products being also listed in a number of sub catagories and that I am suspecting is causing the conflict,

Share this post


Link to post
Share on other sites

I installed it, with the products in a single catagory it worked fine. However since adding the products to multiple catagories it has stopped working. Multiples of the same items works fine, but not across the catagory.

 

Currently running 1.4.8.3

Share this post


Link to post
Share on other sites

I think you are still missing the point of this module.

Try to read the description carefully, as well as my last post.

 

Well, where is yout "last post"? Can you add a link?

I simply installed the module, but I can't find how to add some discount to some categories...

Share this post


Link to post
Share on other sites

I don't understand... But thanks...

 

You said "The module simply combines the total of products from a category when calculating quantity discounts, you still need to create all the discounts from Prestashop (prices tab in the product editor)"

In module, I put the category "300".

In one product "a", I put the quantity discounts in the price tab of the product editor)

Now: How to add this quantity discount of "a" to the category "300"?

Share this post


Link to post
Share on other sites

add the discount to all products one by one?

 

If I do that I don't need the module, where is the advantage?

 

I I thought this module allowed to apply a discount to an Entire category, if I have to put in each product, why use the module?

 

I think something is lost in my procedure, but I can't know what is it...

 

You mean simply to apply the discount to each product, or should be some editing box in the category edit page if I have the module enabled?

 

Because I have the same options with and without the module... At the product and category pages...

Edited by rastreator (see edit history)

Share this post


Link to post
Share on other sites

You are clearly missing the point of the module.

 

If you add the discount to each product, it will work ONLY for those products, if you set the discount for 10, it will only apply when you buy 10 or more from a product, not 5 from product a and 5 from product b

Share this post


Link to post
Share on other sites

OK, now I understand that the module only combine the existing discounts of the products... This is not what I need... (I expected other way to import one kind of discount to a lot of products... When I can do this, maybe I'll need your module...)

 

Thank you for your rapidity and for your answers.

Share this post


Link to post
Share on other sites

tomerg3 you can just update here like others do!! have you read the rules of the forum yet?? i would!! i dont trust giving my information on a website to anyone that has products like you have and there are many more people out there like me so if you are going to give free products (( by the way i thank you for that )) please just follow the rules HERE!!

 

Thank You.

Edited by agentok (see edit history)

Share this post


Link to post
Share on other sites

hi!

 

excelent module but i have a question: how can I limite this module effects just to one kink od user? (based on user groups)

 

I need to check if that user is logged as VIP CUSTOMER group (for example) and so go on with the discounts...

Share this post


Link to post
Share on other sites

You'll need to edit getRealQuantity()

Add "global $cookie;", and based on $cookie->id_customer, check if the customer is in the group you want to allow this change.

If they are not, "return $quantity"

Share this post


Link to post
Share on other sites

You'll need to edit getRealQuantity()

Add "global $cookie;", and based on $cookie->id_customer, check if the customer is in the group you want to allow this change.

If they are not, "return $quantity"

 

Thank you very much for your fast response! Im gonna try this probably just tomorrow and I`ll say you if it worked.

 

Thanks again

Share this post


Link to post
Share on other sites
  • 3 weeks later...

This is a amazing module and its free. nice work.

 

There is just one little thing that I am not able to make work.

 

This module apply discounted price to cart but not show anywhere else on the site specially in browse category page or product description page.

 

For example: If I have added 10% discount to order of 10+ items.

When user put 10+ quantity in quantity txtbox and click add to cart, It reduces the price of product and add to cart. When I refresh the page, it doesn't change price on that page or any other page related to same category. I was expecting this not sure if this is included in its main features. just wondering, if there is a way.

 

Prestashop v 1.4.8

module v 1.0.4

 

Thanks

tomerg3, Any help is very much appreciated.

Share this post


Link to post
Share on other sites

I also checked the 'Quantity Discounts' module of your too. It seems to me this module should does exactly what I need but It didn't work either.

 

Is there anything I am doing wrong?

Share this post


Link to post
Share on other sites

In fact we do not need this module in Prestashop 1.5 as you can achieve the same thng (and more) with the new promotion commands.

 

However I want to warmly thank the Presto Changeo team for making this available and FREE, before the 1.5 version.

Share this post


Link to post
Share on other sites

I'm sure the rest of the members here would love to know the exact steps to do the same thing on PS 1.5, it would be great if you could share it here.

Share this post


Link to post
Share on other sites

How to create a discount on a category?

  • In the administration select menu "Price Rules" then "Catalog Price Rules"

  • Then click on icon "Add new"

  • Give a name to your rule in the "Name" field

  • Indicate in the field "From Quantity" from which quantity the discount will apply

  • With the "Reduction type" dropdown I selected percentage (but you can select an amount from which the discount will be applied).

  • In the "Reduction" field, type the amount of percentage (or the amount from which the discount will apply)

Then you have to add the condition on how the discount will apply. In our case we want the categories to drive the discount.

  • Go below in the "Conditions" section, select with the "Categories" Dropdown menu the category you want the discount be applied to, then click on the button next to it "Add condition".

Look up and you will see that the condition is now listed in the section "Condition group 1"

  • Click on the save button (on the right top of the page) and you are done....

What I'm describing here is what we got before with "CategoryQuantityDiscount", but you can achieve much more with this module as you can have more than one criteria and also you can have more consecutive conditional rules.

 

I strongly suggest that you experience it, it is great... :)

Edited by PatriceVigier (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Hi !

 

Thank you for this very usefull module.

I'm on 1.4.8.2 and I meet a little problem with prices display.

All my products prices are set with prestashop's specific prices , quantities set to 1, because my shop is a clearance sale outlet, and I need the price before, after and the reduction.

So whereas my prices are exacts when I add to cart, they're displayed as "0" in each product details page.

How could I edit getPriceStatic() in the override class Product to retrieve this price ?

 

Thanks in advance

Edited by Pauloscorps (see edit history)

Share this post


Link to post
Share on other sites

There seems to be an issue with that (prices for quantity 1).

I am not sure why exactly, and with PS 1.5 being out, we are busy upgrading all our modules for it.

 

I will try to look into this, but it will likely take a few good weeks, as it will only happen after all our modules have been upgraded.

Share this post


Link to post
Share on other sites

How to create a discount on a category?

  • In the administration select menu "Price Rules" then "Catalog Price Rules"

  • Then click on icon "Add new"

  • Give a name to your rule in the "Name" field

  • Indicate in the field "From Quantity" from which quantity the discount will apply

  • With the "Reduction type" dropdown I selected percentage (but you can select an amount from which the discount will be applied).

  • In the "Reduction" field, type the amount of percentage (or the amount from which the discount will apply)

Then you have to add the condition on how the discount will apply. In our case we want the categories to drive the discount.

  • Go below in the "Conditions" section, select with the "Categories" Dropdown menu the category you want the discount be applied to, then click on the button next to it "Add condition".

Look up and you will see that the condition is now listed in the section "Condition group 1"

  • Click on the save button (on the right top of the page) and you are done....

What I'm describing here is what we got before with "CategoryQuantityDiscount", but you can achieve much more with this module as you can have more than one criteria and also you can have more consecutive conditional rules.

 

I strongly suggest that you experience it, it is great... :)

 

Hi,

 

I have tested the category rule discount as you explained with PS 1.5.0.17 but it does not behave like tomerg3 module.

It does apply the discount to all the product in the category but the quantity discount does not count if you buy two different products in the category.

It only applies when you buy two units of the same product.

With the Category Quantity Discount module the discount is apllied when you buy any two products of that category.

Have you checked how is this possible with PS 1.5??

Thanks

Share this post


Link to post
Share on other sites

You are right !! I retested it with 1.5.1 and it does not cumulate the number of product in the groupe !

I wonder if I was light in my testing or if there is bug now.

It is disapointing

Share this post


Link to post
Share on other sites

Well ! I found why it was working....

I'm working on two servers and I found that on the server I made the test I did install quantitycategorydiscount and it worked because I had made some update to it!

 

If the author of quantitycategorydiscount give me the permission I will offer the updated module that work for 1.5.0 and 1.5.1

 

Otherwise all what you have to do is :

1) Copy the folder "modified_1.4.8" somewhere and rename it with the name of your version, like for Prestashop 1.5.1 "modified_1.5.1"

2) Copy it again in the category quantity discount folder

3) Open categoryquantitydiscount.php and go line 56 and modify

 

$ps_version3_array = array("1.4.0","1.4.1","1.4.2","1.4.3","1.4.4","1.4.5","1.4.6","1.4.7","1.4.8");

 

to

 

$ps_version3_array = array("1.4.0","1.4.1","1.4.2","1.4.3","1.4.4","1.4.5","1.4.6","1.4.7","1.4.8","1.5.0","1.5.1");

 

Save and now you can enjoy the soft as before

Edited by PatriceVigier (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Well I forgot there is also the product.php located in the override/classes to change, replace the code with :

<!--?php

/*

* 2007-2012 PrestaShop

*

* NOTICE OF LICENSE

*

* This source file is subject to the Open Software License (OSL 3.0)

* that is bundled with this package in the file LICENSE.txt.

* It is also available through the world-wide-web at this URL:

* http://opensource.org/licenses/osl-3.0.php

* If you did not receive a copy of the license and are unable to

* obtain it through the world-wide-web, please send an email

* to license@prestashop.com so we can send you a copy immediately.

*

* DISCLAIMER

*

* Do not edit or add to this file if you wish to upgrade PrestaShop to newer

* versions in the future. If you wish to customize PrestaShop for your

* needs please refer to http://www.prestashop.com for more information.

*

* @author PrestaShop SA <contact@prestashop.com-->

* @copyright 2007-2012 PrestaShop SA

* @version Release: $Revision: 14944 $

* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

* International Registered Trademark & Property of PrestaShop SA

*/

 

class Product extends ProductCore

{

/**

* Get product price

*

* @param integer $id_product Product id

* @param boolean $usetax With taxes or not (optional)

* @param integer $id_product_attribute Product attribute id (optional).

* If set to false, do not apply the combination price impact. NULL does apply the default combination price impact.

* @param integer $decimals Number of decimals (optional)

* @param integer $divisor Useful when paying many time without fees (optional)

* @param boolean $only_reduc Returns only the reduction amount

* @param boolean $usereduc Set if the returned amount will include reduction

* @param integer $quantity Required for quantity discount application (default value: 1)

* @param boolean $forceAssociatedTax DEPRECATED - NOT USED Force to apply the associated tax. Only works when the parameter $usetax is true

* @param integer $id_customer Customer ID (for customer group reduction)

* @param integer $id_cart Cart ID. Required when the cookie is not accessible (e.g., inside a payment module, a cron task...)

* @param integer $id_address Customer address ID. Required for price (tax included) calculation regarding the guest localization

* @param variable_reference $specificPri