We've used the AttributeIcons extension to convert our configurable product options from drop downs to radio buttons and we now wish to implement a quantity field against each option (as can be set with grouped product types).
The extension includes it's own configurable.js
override and the template override for inserting the radio buttons is:-
this.radioTemplate = new Template('<div><input type="radio" name="#{name}" onclick="$(\'#{element}\').setValue(#{value});" id="#{id}" value="#{value}">#{label}</input></div>');
I'd like to modify this to include the quantity inputs (using the grouped type template as a guide). I have this so far...
this.radioTemplate = new Template('<div><input type="radio" name="#{name}" onclick="$(\'#{element}\').setValue(#{value});" id="#{id}" value="#{value}">#{label}</input><!-- Start of QTY inputs --><input type="text" name="super_group_#{name}" maxlength="12" value="<?php echo $_item->getQty()*1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" /></input></div>');
I'm struggling to convert the value
and the title
to something that will work in this file however. The $_item
variable is not declared in the configurable type template whereas it is in the grouped, specifically:-
<?php foreach ($_associatedProducts as $_item): ?>
How can I get the default quantity and display the quantity input against each product option within the configurable template? I've tried loading associated products in the configurable type template from the below but it didn't like that...
<?php $_associatedProducts = $this->getAssociatedProducts(); ?>
<?php $_hasAssociatedProducts = count($_associatedProducts) > 0; ?>
Can I use something else other than $_item
to get the quantity of each product option (associated product) or do I have to find a way of loading these into the configurable type template?