Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Virtuemart Template - CleanMart (SKU# FLEX-00015)

TOPIC: AJAX Child Product load doesn't work.

AJAX Child Product load doesn't work. 10 years 2 months ago #8434

Hi!

Great template! Just installed in the latest version of VM and so far everything works fine e except for the AJAX loading of Child Products on the "Product details" page.

Here's the link:

Part of the message is hidden for the guests. Please log in or register to see it.

The only SelectBox you see, that's the Product's Child (see attachment also). When you change it it loads normally and not by AJAX.

In the attachment you can see the setup for the product, it's childs, the Template Plugin, and VM Config.

Worth nothing I'm using the latest Nano3 from YooTheme, however it doesn't seem to be a JQuery conflict. I tried Nano2 and still got the problem. I hope thats not he problem because both the AJAX loading feature and the fact that you can use CleanMart with other Joomla templates were 2 of the main reasons I purchased this template.

Thanks in advance and keep up the good work!
Attachments:
Last Edit: 10 years 2 months ago by Marco Antonio Aguilar de la Vega.
The topic has been locked.

AJAX Child Product load doesn't work. 10 years 2 months ago #8448

Hi,

The solution is very simple, make sure to list the "Genericl Child Variant" as the 1st custom field in the front-end.

Currently the 1st custom field (in here: chiquitos.com/mamas/ropa-para-lactancia/blusa-de-lactancia-detalles)
1st: type-S (radio selection)
2nd: Type-A (generic child variant)

Switch their order. Type-A should be the 1st.

Just try it. Everything will be just fine. BUT! if you insist that your generic child variant should stay as 2nd custom field (I don't think you would specifically want this but i am just saying) then let me know, i will provide you a coding patch to run the AJAX even though the generic child variant is presented as 2nd custom field.

Regards,
Support
Last Edit: 10 years 2 months ago by Support.
The topic has been locked.

AJAX Child Product load doesn't work. 10 years 2 months ago #8455

Hi!

Thank you for your response, just as I was reading this I found the solution, I haven't looked at "productUpdater.js".

What you say is right, the logical step here is to have the Child Variant first and I'm gonna do it that way, but just in case your're interested here is what I changed:
jQuery("#field0custom_value").removeAttr('onchange');
jQuery('#field0custom_value').change(function (event) {

For these:
jQuery(".product-field-type-A .product-field-display select").removeAttr('onchange');
jQuery('.product-field-type-A .product-field-display select').change(function (event) {

That way no matter the order of the type-A field the AJAX will work.

Thanks!
Last Edit: 10 years 2 months ago by Marco Antonio Aguilar de la Vega.
The topic has been locked.

AJAX Child Product load doesn't work. 10 years 2 months ago #8460

You got it right.

I was going to provide you similar patch based on Select by Class. I personally don't understand why the dev. teem used the ID over class though. Because ID's are dynamically changing, but the class names are always the same no matter the sorting is.

Maybe because it is always ideal to use ID's over class name, because it performs little faster. (it was much faster previously with ordinary JS, but there is no big difference nowadays)

I just found this article from google.com, take a look at it, very interesting:
jsperf.com/getelementbyid-vs-queryselector/25

But this performance different is very negligible in today's browsers and with jQuery.
Preferring selecting elements by ID is just a bad habit of the old-fashioned JavaScript coders ;)

Case solved. Topic is closed.

________________________________________________________________________________

If you like CleanMart and satisfied with the support you have received, please "write a review" on:
flexiblewebdesign.com/Virtuemart-2-Templates/CleanMart

Rate CleanMart and write a couple of sentences to share your experience with the support team. It won't take more than 2 minutes from you but it is extremely important for us. Thanks in advance!


Regards,
Support
Last Edit: 10 years 2 months ago by Support.
The topic has been locked.
Time to create page: 0.138 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo