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

Add quantity attribute for custom options
 
richardlapes
Member
 
Avatar
Total Posts:  43
Joined:  2011-07-04
 

Hello guys,

I am currently doing a project that requires simple products with custom options. Easy to do, then suddenly my client ask if he can monitor the inventory of that custom option.

I\’ve search for hours and reach some dead end.

So far the closest I did was with this forum:
http://www.magentocommerce.com/boards/viewthread/73036/P0/

I followed the instructions there and which are:

1. add new field to the database:
log into phpmyadmin
select the table: catalog_product_option_type_value
click \’SQL\’ and insert

ALTER TABLE  `catalog_product_option_type_valueADD  `qtyDECIMAL12) DEFAULT  \'0\' AFTER  `option_id` ;
click \’go\’

2. add new column in the admin area
app/design/adminhtml/default/default/template/catalog/product/edit/options/type/select.phtml

after this line:

\'<th class=\"type-type\"><?php echo Mage::helper(\'catalog\')->__(\'Price Type\') ?></th>\'+
insert:
\'<th class=\"type-weight\"><?php echo Mage::helper(\'catalog\')->__(\'Qty\') ?></th>\'+

after this line:

<td><?php echo $this->getPriceTypeSelectHtml() ?>{{checkboxScopePrice}}</td>\'+
insert:
\'<td><input type=\"text\" class=\"input-text validate-number product-option-weight\" id=\"product_option_{{id}}_select_{{select_id}}_qty\" name=\"product[options][{{id}}][values][{{select_id}}][qty]\" value=\"{{qty}}\"></td>\'+

3. add the qty to the array
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Options/Option.php
after this line:

\'price_type\' => $_value->getPriceType(),
insert:
\'qty\' => $_value->getQty(),

4. add custom qty to the main product when added to the cart
app/code/core/Mage/Sales/Model/Quote/Item.php
BEFORE this line:

$this->setData(\'product\'$product)
insert
$options $this->getOptions();
        if (
is_array($options)) {
            
unset($options[0]);unset($options[1]); 
            
            
$read Mage::getSingleton(\'core/resource\')->getConnection(\'core_read\');
            foreach (
$options as $option{
                
                  $temp 
$read->fetchRow(\'SELECT * FROM `catalog_product_option_type_value` WHERE `option_type_id` = \'.$option->getValue().\' LIMIT 0, 1\');
                  
                  
$tempQty = ($temp[\'qty\']>0)?$temp[\'qty\']-1:0;
                  
                  
$write =  Mage::getSingleton(\'core/resource\')->getConnection(\'core_write\');
                  
                  
$updateQuery  \'UPDATE `catalog_product_option_type_value` SET qty = \'.$tempQty.\' WHERE `option_type_id` = \'.$option->getValue();
                  
                  
$write->query($updateQuery); 
                
}
        }

It is close But.. when I try add the product to the cart with qty greater than 1, the option qty is still subtracted by 1 and I know that the code is still not complete because there is no update when I delete products in the cart.

Can somebody point me to the right direction here?
What are the things needed to be done?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nicedayvince
Member
 
Total Posts:  56
Joined:  2011-02-10
 

I also need a solution for Inventory Control with Custom Options.... selling T-Shirts.

For example…

“Skate Or Die T-Shirt”

SELECT SIZE
Small
Medium
Large
XLarge

SELECT COLOR
Black
White
Blue

I have 5 in small of each color. 20 of Medium in each color. 25 in Large of each color. and 5 in XL of each color.

I need the cart to keep track of my inventory for each size and color as the shirts are sold.

PLEASE RECOMMEND AN EXTENSION OR SOME SOLUTION IN PLAIN ENGLISH THAT I CAN HACK MYSELF.

Thank you so much Magento Community!

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagePsycho
Mentor
 
Avatar
Total Posts:  1702
Joined:  2009-06-23
 

Take a look at Bundled Product which may fulfill your requirement.

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
frankteddy
Jr. Member
 
Total Posts:  1
Joined:  2012-04-30
 

hi, adedoy

I am looking for the same thing, differently, I don’t need the inventory control since it is virtual product. 

Have you found the solution already? 

Any suggestion is greatly appreciated !

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageWorxcom
Guru
 
Avatar
Total Posts:  410
Joined:  2009-06-03
Washington DC Metro Area, US
 

Hello Guys,

The Advanced Product Options extension allows tracking the inventory of custom options. It has quite flexible functionality.

Let us know if it works for you. We will be glad to help you.

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