VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: outbreak198x on July 18, 2016, 19:59:04 PM

Title: [solved;template issue]Add to cart not working in Product Details list
Post by: outbreak198x on July 18, 2016, 19:59:04 PM
Hello,

i've searched a lot, but did not find the fault of the website...

When i select a product with "add to cart" - or "in den Warenkorb" in the categroy view... - everything is normal, popup with addad to cart
But if i go in details page and try the same - nope - just redirect to "Empty cart"

i do not know what happened, because the site just relaunched, and everything works great, the version before uploading on the webserver is still working great, so i thought i copy back the product details php file, but same problem.
i tried also some settings with jquery in configuration, but still same issue.

Live Shop:
http://www.red-ring.at/shop-redring

I will be happy if anyone has some suggestions :)
Title: Re: Add to cart not working in Product Details list
Post by: Jumbo! on July 18, 2016, 22:38:52 PM
Just checked your site. It seems to be working perfectly fine to me.
Title: Re: Add to cart not working in Product Details list
Post by: outbreak198x on July 19, 2016, 10:38:05 AM
I tested it on many computers, and phones, not working on detail page ;)

for e.g. http://www.red-ring.at/shop-redring/zubeh%C3%B6r-f%C3%BCr-ventilatoren/filterboxen/lfb-100-detail
you can press add to cart, and you'll be redirected to an empty cart.

You have also to empty the cart before....

What i've seen is that the quantity Buttons not working, so it will be a JS conflict, but which one... i don't know :(
Title: Re: Add to cart not working in Product Details list
Post by: jenkinhill on July 19, 2016, 10:48:32 AM
You are loading the VirtueMart JavaScript files on the category page, but not on the product details page for some reason, so there is no VM function.
Title: Re: Add to cart not working in Product Details list
Post by: outbreak198x on July 19, 2016, 11:01:27 AM
So the question is.. why it is on the Live shop, but not in local testshop - php version? - the fault is in database, because i tried a new backup, replacing all files with my working config, and it does not work too... - so maybe there is a plugin or module killing this?  - or can there be something in virtuemart config - compared all things with my local thing, and seems to be the same.
Title: Re: Add to cart not working in Product Details list
Post by: Studio 42 on July 19, 2016, 12:28:03 PM
If you use a modified template, it's possible that he overide this view and the instruction is missing.
You need to have echo vmJsApi::writeJS(); at end of file
YOURSITE\templates\YOURTEMPLATE\html\com_virtuemart\productdetails\default.php

All old templates break because this. But  you don't have many instruction about this from VM team.
Title: Re: Add to cart not working in Product Details list
Post by: outbreak198x on July 19, 2016, 13:03:30 PM
There is an override yes, but not in this folder, and thats not the reason why it does not work, because it works on same Joomla and VM Version locally.

i tried to add the line, but nothing changed :(
Title: Re: Add to cart not working in Product Details list
Post by: Studio 42 on July 19, 2016, 15:49:38 PM
I think, you have really a problem with the template.
I cehcked jquery events for the add to cart button. You have 28 event on click "add to cart" button when you come from category view.
You have too much javascript loaded.
The submit form is minified in your warp javascript.
SO the problem is in your jmf corporate template, and should be upgraded, check with the template developpers, none can help you here.
Title: Re: Add to cart not working in Product Details list
Post by: StefanSTS on July 19, 2016, 17:17:24 PM
Hello,

looking at your head tag and what is inbetween there is a lot more to do than just getting the quantity to work.

CSS is loaded, JS is loaded, CSS is loaded again, again JS. This will slow down the site like crazy. JQuery loaded two times, if I see that right.
Maybe it should be considered to throw out some extensions too, and optimize the delivery of the scripts.

Two times loading of JQuery could be a starting point to get the script on the product page running again.

So short
Stefan


Title: Re: Add to cart not working in Product Details list
Post by: outbreak198x on July 20, 2016, 11:25:09 AM
yes that's all correct, JS and so on...

but.... why i can not just copy all files from the working backup over the live shop... - the problem is still there if i do that?
so it can not really be a template issue in my eyes?
Title: Re: Add to cart not working in Product Details list
Post by: Milbo on July 20, 2016, 11:51:45 AM
Quote from: Studio 42 on July 19, 2016, 12:28:03 PM
If you use a modified template, it's possible that he overide this view and the instruction is missing.
You need to have echo vmJsApi::writeJS(); at end of file
YOURSITE\templates\YOURTEMPLATE\html\com_virtuemart\productdetails\default.php

All old templates break because this. But  you don't have many instruction about this from VM team.

Yes, I just notice it is missing here, http://docs.virtuemart.net/tutorials/development/175-code-adjustments-for-virtuemart-3.html

Your work would much more apreciated, when you would just suggest to add it. So, added now
Title: Re: Add to cart not working in Product Details list
Post by: StefanSTS on July 20, 2016, 12:16:31 PM
Sorting that out can be quite a long process, the template or extensions are mostly the reason for problems, so starting there is normally the first step.

Guess I would go on now with switching off all extra extensions and using the Protostar so see if that combination is working.

What differences are there between your developement system and the live system? PHP versions are the same?

Title: Re: Add to cart not working in Product Details list
Post by: outbreak198x on July 20, 2016, 12:50:02 PM
Lol, i'm such an iditot... - last time testing it, i wrote something wrong - thx to all, added this, now working great.

Still do not know, why it works in local backup copy, but thats not really interesting for me.

Maybe i'll renew the template, it's not really a difficult one.

Thx again