Description
Magento 2 (Community Edition) standard for selection type checkbox of bundle options is that customers can not change the quantity of the selections.
I'm trying to implement that customers can change the quantity of each selection within an option of selection type checkbox -- as you can see here for Magento 1.
I followed the tutorial above and was able to rewrite the back-end blocks and the front-end blocks and view files (step 1 and 2) of Magento 2. Now I'm stuck at modifying the Javascript part (step 3).
Actually the quantity input fields of the checkbox selections are implemented like in the tutorial above (see step 2).
If I change the quantity of a selection, the function _onQtyFieldChanged(event)
of Magento_Bundle/js/price-bundle.js is called.
Inside this function field.data('option')
is called. This usually returns an instance of the option (e.g. for selection type radio), which is used later in the function.
My problem is, that the field.data('option')
call for the checkbox quantity field returns undefined
.
Debugging
- Dumping the
field
Object to the browsers console and callingfield.data()
returns an empty Object. - Other
field.data
Objects (e.g. of selection type radio) have the attributesoption
,optionId
andoptionValueId
. You can find this by inspecting the Object of the specific ID in thecache
Object in line 3686 of thejquery.js
. - If I change the value of a checkbox quantity field and search for a radio quantity
field.data
Object in the mentionedcache
Object, it has the attributesoptionContainer
andquantityField
. - If I change the value of a radio quantity field and search for a checkbox quantity
field
Object in the mentionedcache
Object, it doesn't contain adata
Object.
Question
Has anyone an idea where the field.data
Object is constructed and filled with the above mentioned attributes?