News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Dynamic Product Update Bug with Fix Code dynupdate.js

Started by niosme, April 27, 2022, 14:06:22 PM

Previous topic - Next topic

niosme

When a product have related products and dynamic update is enabled the dynamic update gets the Virtuemart.containerSelector which is the product-container class.
This class also exists in related products and not only in the outer class of the whole product.
So when a dynamic update hapens with related products it just replace all the html of the container with the false product container class of the related product.

The fix is to change from this we can ovewrite the sublayout of the related products witch is in the path components/com_virtuemart/sublayouts/related.php and change the product-container class to a more specific like related-product-container
from <div class="product-container">
to     <div class="related-product-container">

OR

change the components/com_virtuemart/assets/dynupdate.js
var el = $(data).find(Virtuemart.containerSelector");
to this
var el = $(data).find(Virtuemart.containerSelector+ (($(data).find(".product-related-products").length)?".productdetails":"") ); to be more specific

The first aproach will not change the performance and will keep it the same.
Thanks for fixing it in the next version.
Fullstack Developer and Joomla Expert

Milbo

Do we need this fix also for VirtueMart 4.0? I think I changed this area. Maybe even almost the same fix as you. Or we may can even merge it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

man.of.earth

The related products variants produce a recursive loop instead of just replacing the variant selected:

https://test.proxima-mundi.ro/vm/vm-product-1

VirtueMart 4.0.0 10645 on J 3.10.8 on PHP 7.4, vmbeez3 template.

Milbo

Btw niosme, in any case, good work. I am sorry that I forgot to write this in the first answer. Because the new strategy is to write the stuff with relative searches as you did. :-) and I should check the code against your solution.

Arcturus. I am not sure if this fits to this topic. Do you mean the new custom related? or the normal related.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

man.of.earth

#4
Quote from: Milbo on April 30, 2022, 23:00:02 PM
Arcturus. I am not sure if this fits to this topic. Do you mean the new custom related? or the normal related.

See the related products on this page - https://test.proxima-mundi.ro/produs-2 , below. Each of them has variants. Select a variant of a related product - select ,,produs 1.1" from the first related product (,,produs 1"). It loads the selected variant (,,produs 1.1") inside the related product space (as if on a new page, altogether with its variants). And so on.
It's recursive.

It seems to behave like that for multi variants products.

Milbo

Do I see that right, it works with the generic variants, but not with the multivariants?

what happens is something like that, the js must decide if it loads the productdetail layout, or the category browse layout. Looks like it does the product details layout for the multivariants, but should of course be the "category" layout..
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/