VM 3.2.2 on custom field ajax request, page render wrong

GK User
Wed May 17, 2017 1:47 am
Hi! Today started migration. Currently I'm at VM 3.2.2, J! 3.7.0 and gk_storefront 3.22

Sadly my template migration didn't end up well. If I access a product details, and select an extra fields drop-down item, the page gets reloaded through Ajax but it only displays the product image.

I'm totally confused, because, for testing purposes, I have set Beez template to Spanish lang and set Storefront template to English. Above that, I copied html/com_virtuemart override folder from storefront to Beez template.

If I load a product in Spanish (Beez template), the custom field drop-down reloads the page just fine, no errors, no console errors, no PHP errors, nada!

If I try the same product with the gk_storefront template, it fails as described above, on custom field change, Ajax request, then displays product image only.

I know that given the above test the issue should be the template, but I can't find the source of the issue, because no errors are shown (JS nor PHP)

If you can take a look, please review this two URLs

Beez template, working just fine (try to change dropdown "Período de Soporte y Actualizaciones")
https://it.mgscreativa.com.ar/mgs/index ... 18&lang=es

Storefront template, doesn't work (try to change dropdown "Support and Updates Period")
https://it.mgscreativa.com.ar/mgs/index ... 38&lang=en

Thanks in advise!
User avatar
Expert Boarder

GK User
Wed May 17, 2017 1:35 pm
Well, I think I found a bug...

In my template, I have enabled display of related products, and after render I get related products blocks generated by /components/com_virtuemart/sublayouts/related.php like this:

Code: Select all
<div class="product-field product-field-type-R">
    <span class="product-field-display">
        <div class="product-container">
            <div class="vm-product-media-container">
                <a href="/mgs/index.php?option=com_virtuemart&amp;view=productdetails&amp;virtuemart_product_id=74&amp;virtuemart_category_id=12&amp;Itemid=1238&amp;lang=en" title="MercadoPago" target="_blank"><img src="/mgs/images/stories/virtuemart/product/resized/logo-mercadopago9_295x295.png" alt="logo-mercadopago9"  />
                    MercadoPago
                </a>
            </div>
        </div>
    </span>
</div>
<div class="product-field product-field-type-R">
    <span class="product-field-display">
        <div class="product-container">
            <div class="vm-product-media-container">
                <a href="/mgs/index.php?option=com_virtuemart&amp;view=productdetails&amp;virtuemart_product_id=156&amp;virtuemart_category_id=26&amp;Itemid=1238&amp;lang=en" title="XE" target="_blank"><img src="/mgs/images/stories/virtuemart/product/resized/logo-xe_295x295.png" alt="logo-xe"  />
                    XE
                </a>
            </div>
        </div>
    </span>
</div>


Notice the <div class="product-container">, that prevents /components/com_virtuemart/assets/js/dynupdate.js to work properly arround line 42 Virtuemart.container.html(el.html());, at this point jQuery found more than one el as stated on line 39 var el = $(data).find(Virtuemart.containerSelector);

I fixed it by renaming <div class="product-container"> to <div class="related-product-container"> in my /html/com_virtuemart/sublayouts/related.php override
User avatar
Expert Boarder

teitbite
Sat May 20, 2017 6:17 pm
Hi

It may be solving it, but the real problem must be in /html/com_virtuemart/sublayouts/rating.php That's the only related file in this case, a file which is not used in a different template than storefront. Please check that.
User avatar
Moderator


cron