0

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?

1 Answer 1

1

So if I understand correctly you want a quantity box for each option. That sounds more like a grouped product.

quantities per option

This way the user can add a quantity per product option and add them to the cart all at once. You can read more on grouped products on this Magento knowledge base page.

As an added bonus for Grouped products, the HTML output is easier to modify allowing you to, for example, show the picture of the simple product per item

5
  • Yes this is exactly what we're after but this is a multi store and all the configurable products are currently shared between both stores. Store 1 needs them as a drop down list (configurable) and store 2 needs them as a list with qty field per option (we'd have to duplicate all parent products so each store could have a different product type for the parent) - was hoping we could just modify the configurable product type for just store 2 to use. Thanks.
    – zigojacko
    Commented Sep 17, 2013 at 7:42
  • 1
    Using templating/js could, and I'm saying this from experience, become messy. You can still share the simple products between stores and just create new grouped products. I understand it's a bit more work on the administration level but in the long run it'll be a more stable solution in my opinion Commented Sep 17, 2013 at 7:48
  • @GeoffJackson is there any more information I could provide on your answer or are you looking for another solution? Commented Sep 20, 2013 at 12:08
  • In the end, we've actually gone for a complete restructure duplicating all parent products and converting the duplicates to grouped products and then using these grouped products on store two only. It does a present a number of other downfalls such as, by default, prices in the product listings to say 'starting from' for example so a lot of template changes are underway to completely modify this solution to suit the scenario. As a result, I'll mark your answer as correct.
    – zigojacko
    Commented Sep 20, 2013 at 14:14
  • Wow, sounds like a huge undertaking. I you think this will be interesting to the community please post what you did as an answer and some explanation why you went for that solution Commented Sep 20, 2013 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.