khalilrumi Posted July 31, 2013 Share Posted July 31, 2013 In order to make may Magento template faster, i am trying to use jquery to load configurable products options. How can i fetch these attributes by using jquery. I want to show default options initially and then customers can change options as per their needs. Quote Link to comment Share on other sites More sharing options...
trq Posted July 31, 2013 Share Posted July 31, 2013 We are going to need a lot more information about exactly what it is you are doing. Quote Link to comment Share on other sites More sharing options...
khalilrumi Posted August 1, 2013 Author Share Posted August 1, 2013 Allright, the thing is that, with products like tables, chair and other decoration items, customers can select different colors before they buy. The first option is that i would have to create configurable options for each product and load them when the template loads. It can make loading slow. Few options can be shown and then users can select other options if they like. thanks Quote Link to comment Share on other sites More sharing options...
trq Posted August 1, 2013 Share Posted August 1, 2013 And you are stuck where? Can we see your code and as description of the problem? Quote Link to comment Share on other sites More sharing options...
khalilrumi Posted August 5, 2013 Author Share Posted August 5, 2013 (edited) Resolved, i was using the following code, <?php foreach($_attributes as $_attribute): ?><dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt><dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>><div class="input-box"><select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select"><option><?php echo $this->__('Choose an Option...') ?></option></select></div></dd><?php endforeach; ?> Now i will fetch these options from spConfig.config.attributes, i will use following code: <script type="text/javascript"> var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);for(var i=spConfig.settings.length-1;i>=0;i--) {spConfig.settings[i].selectedIndex = 1;}spConfig.reloadPrice();</script> Thanks, Edited August 5, 2013 by khalilrumi Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.