Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Reload custom product options/ product detail view via Ajax update
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

Hi All,

I’m about to determine the best approach to reloading the select options (custom product options) onChange for a specific attribute within the product detail view.

Any recommendations on reusing Magentos core functions rather than writing a custom Ajax script to do this?

Thanks for all input!

Lee

 
Magento Community Magento Community
Magento Community
Magento Community
 
leetaylordoes
Sr. Member
 
Total Posts:  227
Joined:  2008-02-05
San Diego, CA
 

Hi All,

I’ve had the chance to write a custom module which allows me to use Ajax.updater to reload a specific block within a page (thanks for the help @Lee Saferite: http://www.magentocommerce.com/extension/933/modular-routers )

The only problem I’m having is running into re-loading the attributes that get loaded just above the product’s custom options block. As soon as it loads the Attributes select dropdown (without any options), a Javascript error(s) get thrown:
+ element is null
+ spConfig is undefined
+ optionsPrice is undefined

Here’s my Ajax.updater code getting called within a function onChange from any Attribute select:

<script type="text/javascript">
            function 
resetOptions()
            
{
                
//AJAX Update "refresh" of all product options
                
new Ajax.Updater(
                    
"product-options-wrapper",
                    
"<?php echo $this->getUrl('*/*/options', array('id' => $this->getProduct()->getId())); ?>"
                    
{
                        method
:'get',
            
insertion:'none',
                        
evalScripts:true,
                        
parameters:{'qty':$('attribute454').value}
                    }
                
);
            
}
    </script>

Any ideas as to how I can stop the javascript errors from occurring (to enable the data to get loaded into the attribute select dropdowns)?

I’ll post my findings here.

Thanks!
Lee

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top