Add qty box
in custom option row:
By default Magneto only provide custom options without ant
qty, if you want to customize with Qty then you must change in following files:
1.
app\design\adminhtml\default\default\template\catalog\product\edit\options\type\select.phtml
·
Find the below code:
'<th
class="type-sku"><?php echo
Mage::helper('catalog')->__('SKU') ?></th>'+
Add these after just after
'<th
class="type-qty"><?php echo
Mage::helper('catalog')->__('Qty') ?></th>'+
·
Find the below code:
'<td><input
type="text" class="input-text" name="product[options][{{id}}][values][{{select_id}}][sku]"
value="{{sku}}"></td>'+
Add these after just after
'<td><input
type="text" class="input-text" name="product[options][{{id}}][values][{{select_id}}][qty]"
value="{{qty}}"></td>'+
2.
app\code\core\Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Options\Option.php
·
Find the below code:
$value['sku'] =
$this->htmlEscape($option->getSku());
Add these code just after
$value['qty'] =
$this->htmlEscape($option->getQty());
·
Find the below code:
'sku' =>
$this->htmlEscape($_value->getSku()),
Add these code just after
'qty' =>
$this->htmlEscape($_value->getQty()),
3.
Add field in “catalog_product_option_type_value”
table
`qty` int(11) unsigned NOT NULL DEFAULT '0'
COMMENT 'Qty',
That’s all….
Great work Bhaskar, thanks for sharing this. What would be better though is if the quantity field was linked to the quantity for the SKU's in the custom option.
ReplyDeleteSo rather than displaying an independent quantity field, grab the quantity field from the product that is already set in the database.
Any ideas? :)
I have added a decsription field to the custom option now i want to display that description on the order detail page..Can you help me out .
ReplyDeletei have added qty filed but data is not saving in db
ReplyDeletehttp://screencast.com/t/tEKOQtgaZ
Great - thank you.
ReplyDeleteBut how can i show same qty on frontend. I need it shown in a dropdown.
when i save the form,that shows error Indexer model is not defined
ReplyDeleteNice work Bhaskar,But this qty will get decremented each time an order is placed with some value for this custom option ?
ReplyDeleteyes i need qty will get decrement once order placed
DeleteHi... Kindly reply this,If custom option product has purchased the qty is not reduced from the custom option qty field???
ReplyDeletehi
ReplyDeletei followed al steps but i am stuck in last step
kindly guide me on this please how to i add this
Add field in “catalog_product_option_type_value” table
`qty` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Qty',
my database name is Database: yourstyl_eoutlet »Table: catalog_product_option_type_value
please help
ALTER TABLE catalog_product_option_type_value ADD `qty` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Qty'
ReplyDeleteVery Nice... thanks for sharing this useful information.
ReplyDeleteEcommerce web Development in mumbai
thanks
DeleteHi Bhaskar,
ReplyDeleteI am stuck on the last step. Could you guide me through it please.
Thanks
Hello,
DeleteFind below steps to add qty in table:
1. open database and fine table "catalog_product_option_type_value"
2. click on table then you show the data grid
3. Add new Column 'qty'
OR
open a query window and add below query :
ALTER TABLE catalog_product_option_type_value ADD `qty` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Qty'
Now qty add in your database table.
this is really very useful, thank you.
DeleteBut when we place an order, we need that decrement the custom otion qty, which is not happening .
How can we fix it please ?
Hi Bhaskar,
ReplyDeleteFirst of all i would like to thanks for this informational article its really help me. Can you please guide me how can I show the qty box on front-end as well for the same.
Thanks in Advance !!
Hi,
ReplyDeleteI want to decrease quantity from database when we place order . how can i do that?
hi,
ReplyDeleteThanks :)
It is a good article , but without frontend control then it is not useful, could you please add the front end section
ReplyDeleteThank you in advanced
Hi,
ReplyDeleteI want to decrease quantity from database when we place order . how can i do that?
Thank you for sharing excellent information. Your website is very cool. Fully useful your blog post... Online Shopping Websites In India
ReplyDelete