0

I Use a simple popup. When I click Popup, then popup open and Ajax load product details page. But When product details page load by Ajax then I remove head,header,left,right and footer block.

Now the problem is my css work properly with popup but JavaScript not work so my add to cart button and other option which depends with JavaScript that's are not work.

UPDATE


Config.xml

<config>
    <modules>
        <Abdus_Ajaxproduct>
            <version>1.0.0</version>
        </Abdus_Ajaxproduct>
    </modules>
    <frontend>
        <layout>
            <updates>
                 <ajaxproduct_productload module="Ajaxproduct_Productload">
                 <file>ajaxproduct.xml</file>
                 </ajaxproduct_productload>
            </updates>
       </layout>
    </frontend>
    <global>
        <events>
            <controller_action_layout_load_before>
                <observers>
                    <Abdus_Ajaxproduct_Model_Observer>
                        <type>singletone</type>
                        <class>Abdus_Ajaxproduct_Model_Observer</class>
                        <method>checkForQuickView</method>
                    </Abdus_Ajaxproduct_Model_Observer>
                </observers>
            </controller_action_layout_load_before>
        </events>
    </global>
</config>

observer.php

    <?php
class Abdus_Ajaxproduct_Model_Observer{
    public function checkForQuickView($observer){
        $update = Mage::getSingleton('core/layout')->getUpdate();
        if ($product = Mage::registry('current_product')) {
            $update->addHandle('ajaxproduct_loadproduct_getbysku2');
        }
        return;
    }
}

ajaxproduct.xml

<layout version="0.1.0">
    <ajaxproduct_loadproduct_getbysku translate="label">
        <remove name="head" />
        <remove name="header" />
        <remove name="left" />
        <remove name="right" />
        <remove name="footer" />
    </ajaxproduct_loadproduct_getbysku>
</layout>
1

If you removed head for your popup, add to cart functionality will not work. You will need to keep your JS files in head of your popup if your popup is using iframe or if it's simple html.

Without JS files it will not work.

  • If not remove head then same things. But when i direct hit my Ajax URL then all functionality work properly. That means Ajax loading JavaScript not workable when it load by Ajax. – Abdus Salam Oct 31 '15 at 5:42
  • you will need to initialize java-script after ajax call. check this link for how to load javascript in ajax call. – Akhilesh Patel Oct 31 '15 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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