jeudi 2 juin 2016

Magento 2 CE: Implement User Defined Quantity per Selection for Bundle Option of Select Type Checkbox

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 results in the field does not has a function named data. Thus, calling field.data() even returns undefined.

Has anyone an idea of what the problem is? What am I missing?




Aucun commentaire:

Enregistrer un commentaire