Jump to content

Purchases Limited To Fixed Quantities


Recommended Posts

I am setting up a store where products are sold in fixed quantities. For example one product is available in quantities of 25/50/100/250/500/750/1000/2500/5000. Other products will be sold in fix quantities but not the same ones.

 

The obvious solution is to just add quantity as an attribute but that then leaves the issue that the hardwired quantity option will still be there. I would need to edit tpl files to remove that but since the built-in quantity shows up in quite a few places I figure that involves editing at least a half-dozen tpl files.

 

1) Is there are more elegant solution for this? Maybe a module I could just buy?

 

2) If no then does anyone have a list of what files I would need to edit? (using most recent version of 1.6)

 

 

Link to comment
Share on other sites

The ideal solution would be to implements a "quantity increment" system, but that would require using override files, as PrestaShop was not really designed for this.

 

I am not familiar with a module for that.

 

The file / function you should start with is updateQty() in Cart.php as it handles both additions to the cart, and quantity changes (you will need to make sure thatr even if someone adds 500 to the cart, the -+ quantity update buttons comply with your increments)

Link to comment
Share on other sites

I considered trying that but while all the products have fixed quantities that they are sold in those fixed numbers are not the same between products. It would get really messy to do this with product ids determining the list of acceptable quantities. Also customers don't necessarily know the fixed quantities offered so it would need to be a pull down selection 

 

 

I think I'm stuck with the using an attribute for quantity and trying to decide between two options.

 

1) Delete all reference to the Quantity in every relevant file so the real quantity is always at 1 but irrelevant since it is never displayed / printed on anything.

 

2) Figure out a way to disable the customer's ability to edit the real quantity but have it update based on the choice in the attribute quantity.

 

#2 is the much more elegant solution and on the face of it seems like it shouldn't be that hard but I don't know enough about how PrestaShop is coded to say that with any confidence.  

Edited by Naldinho (see edit history)
Link to comment
Share on other sites

We did something similar to a full website we developed, and we ended up setting up a minimum quantity for each product, and set the increments to work based on the minimum quantity (to avoid any hard coding of product IDs).

Another option would be to add a new filed to the product editor, or to simple "re-purpose" one of the existing fields that you do not use (IE UPC).

 

 

Even with your attribute solution, you will still have a problem with quantity change on the cart summary / checkout.

Link to comment
Share on other sites

You're welcome.

 

Just to be clear, I wasn't trying to offer our services (we're fully booked anyway), simply trying to give an example that it can be done without using attributes, and probably requires less changes.

 

DIY is often the way to go, if you have the patience and desire to learn ;)

Link to comment
Share on other sites

Sorry I didn't think you were either but I know you do custom work and I'm quite happy with the modules I've bought from you so you'd naturally be a starting point for when I need custom work -- especially since some of that work will be modifying one of your own modules. 

Edited by Naldinho (see edit history)
  • Like 1
Link to comment
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
×
×
  • Create New...