Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Quantity as a drop-down
 
josep99
Jr. Member
 
Total Posts:  12
Joined:  2008-11-16
 

This (or something similar) has been asked before, but I haven’t seen a precise answer.

I would like to have Quantity as a drop-down, rather than an open text box.

The idea is to preset different options (Box of 6 units, box of 12 units, box of 18 units...) and let the user choose, but only those predefined options.
I have seen at least two pages that would need modification: product page and cart page, both have the quantity field.

Where would you start? What do I need to modify?

thanks,
josep

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageParts
Guru
 
Avatar
Total Posts:  415
Joined:  2007-11-18
 

These are the files you will need to edit first hand.
app/code/core/Adminhtml/Block/Catalog/Product/Edit/Tab/Inventory.pp <- Contains code used by the template
app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml <- Template (checkout line 52-53 and 34-48)

In case you receive any problem saving the data you should find your answer here.
app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php <- line 533-593 saveAction()

You may also want to take a look at the collection file (which is used for gathering data).
app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item/Collection.php

Additional files can be found through out the app/code/core/Mage/CatalogInventory folder. Hope this gets you on the right track mate cool smirk.

 
Magento Community Magento Community
Magento Community
Magento Community
 
josep99
Jr. Member
 
Total Posts:  12
Joined:  2008-11-16
 

Thank you!

I’ll try and post back if I succeed, since several people have asked for this.

I’m new to magento but have some expierence with PHP; I hope I can manage.

 
Magento Community Magento Community
Magento Community
Magento Community
 
TanRambun
Sr. Member
 
Avatar
Total Posts:  93
Joined:  2008-11-16
Bangkok, Thailand
 

Hallo josep99,

i did not tried this out, i just want to inform you, that the development of a basic module for this requirement is explained in the book PHP|Architect’s Guide to E-Commerce Programming with Magento in Chapter 6 “CustomModules”. Maybe you know someone who owns this book, so you can take a look into it.

The basic steps suggested in this book are:

- Create a new product attribute (text field) for the count of units (e.g. 6, so the select filed offers 6, 12, 18, ...) and assign it to the products you want to have this feature.

- Do the needed changes in the templates (e.g. template/catalog/product/view/type/simple.phtml) to create and show/hide the select field dynamically.

- Create a Block where you can place the needed display logic.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Micromecca
Jr. Member
 
Total Posts:  19
Joined:  2009-01-08
Durham, UK
 

any luck with this? I too need to be able to preset quantities available in multiples of X

 
Magento Community Magento Community
Magento Community
Magento Community
 
amine2005
Jr. Member
 
Total Posts:  23
Joined:  2008-09-11
 

any idea please????????????????????,

 
Magento Community Magento Community
Magento Community
Magento Community
 
Micromecca
Jr. Member
 
Total Posts:  19
Joined:  2009-01-08
Durham, UK
 

I now have this working after paying for a coder to create this for us, I’ll see if I can get this wrapped up into a plugin for the community

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top