VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: koaconsulting on July 25, 2018, 21:38:50 PM

Title: Unable to add or remove product categories
Post by: koaconsulting on July 25, 2018, 21:38:50 PM
Our client has just reported a very strange issue.  If we add or remove a category from a product, everything looks like it works... but when we click the Save button (or even Save and Close) it then seems like the changes did NOT take effect.  The page is reloaded without any of the categories changed.  However if we empty our browser cache and then reload that page the changes DO take effect.

It seems like the solution could be to simply tell the browser to not cache that page...?

Any help you can offer would be greatly appreciated!

We are using the latest version of Virtuemart (3.2.14) and Joomla (3.8.8).
Title: Re: Unable to add or remove product categories
Post by: AH on July 26, 2018, 10:58:50 AM
Try version .15

Title: Re: Unable to add or remove product categories
Post by: koaconsulting on July 31, 2018, 00:02:04 AM
Thanks for your reply.  Unfortunately, I don't see any newer versions on the Virtuemart website.  Or did you mean to just wait until the next release comes out?
Title: Re: Unable to add or remove product categories
Post by: Jörgen on July 31, 2018, 05:59:56 AM
Hello try here.
http://dev.virtuemart.net/projects/virtuemart/files (http://dev.virtuemart.net/projects/virtuemart/files)
Regards
Jörgen @ Kreativ Fotografi
Title: Re: Unable to add or remove product categories
Post by: koaconsulting on August 02, 2018, 01:02:42 AM
Thanks for the suggestion and link to the upgrade file.  I applied the VM update.  Unfortunately, that did not fix the issue.  We still can't add/edit product categories for any product and get them to display unless we empty the browser cache.  Any other suggestions for a fix?
Title: Re: Unable to add or remove product categories
Post by: Studio 42 on August 02, 2018, 03:35:35 AM
If you upgraded, the old javascript is perhaps in cache.
Si refresh browser, and test again.
If it's not solved, clear the Joomla cache and test again.
Title: Re: Unable to add or remove product categories
Post by: koaconsulting on August 02, 2018, 05:03:38 AM
Thanks for your help.  Unfortunately, I have tried the same thing on various browsers (Chrome, Firefox, and Safari), each with the browse cache emptied.  Still no luck.  I've also emptied the Joomla cache several times.  I have verified that the Virtuemart update has run to completion and the "Extensions: Manage" area shows version 3.2.15 (June 14, 2018) as the latest version.

Any other ideas?

FYI: We are using the latest versions: Joomla 3.8.11 and Virtuemart 3.2.15.
Title: Re: Unable to add or remove product categories
Post by: hellorain on August 02, 2018, 07:41:54 AM
Hello,

Provide me your site details. I can start work.

Best Regards,
hellorain.
Title: Re: Unable to add or remove product categories
Post by: koaconsulting on August 02, 2018, 08:03:33 AM
I tried sending you a PM but it was blocked.  Are you offering help to troubleshoot the issue?  I am signing off for the day but can Skype you tomorrow if that works.  Thanks!
Title: Re: Unable to add or remove product categories
Post by: Studio 42 on August 02, 2018, 13:22:57 PM
Check your browser console, if the dont see an error displayed in the categories list.
This break the render.
You can full disable php error reporting/display, to prevent this case.
Title: Re: Unable to add or remove product categories
Post by: koaconsulting on August 02, 2018, 22:25:47 PM
I already had error reporting disabled so that doesn't help.  There is one Javascript error: TypeError: t.fn.tooltip.Constructor is undefined.  I've uploaded this as an attachment so you can see it.

I found one other instance where someone had a similar issue in the VM forums but there was no resolution.  Milbo asked if they were using a custom admin template (we are not).

UPDATE:
I also setup a completely NEW Joomla and Virtuemart installation and the problem still exists!!!  No other 3rd party extensions or templates installed.  Just Joomla 3.8.11 and VM 3.2.15.  I still can't add categories to a product and have the list update UNLESS I empty the browser cache.  No special .htaccess file either.  The only thing I can think of if it's not a VM issue is that perhaps my client's host (HostGator) has a strange setting causing the issue...?

Any other suggestions?  Thanks for your help!
Title: Re: Unable to add or remove product categories
Post by: Studio 42 on August 02, 2018, 23:56:54 PM
Your javascript can be the origin of the problem because Virtuemart load the categories by ajax javascript call.
So if you have any javascript error before, the script is not called, this is is the case for all javascript called affter the error in the dom.
Title: Re: Unable to add or remove product categories
Post by: koaconsulting on August 03, 2018, 01:01:49 AM
The problem can't be due to Javascript.  As I just said in my last post:

I also setup a completely NEW Joomla and Virtuemart installation and the problem still exists!!!  No other 3rd party extensions or templates installed.  Just Joomla 3.8.11 and VM 3.2.15.  I still can't add categories to a product and have the list update UNLESS I empty the browser cache.  No special .htaccess file either.  The only thing I can think of if it's not a VM issue is that perhaps my client's host (HostGator) has a strange setting causing the issue...?
Title: Re: Unable to add or remove product categories
Post by: Jörgen on August 03, 2018, 05:43:33 AM
Hello
Do your clients site have some caching software installed? These have a tendency to break e-commerce sites.
Jörgen @ Kreativ Fotografi
Title: Re: Unable to add or remove product categories
Post by: GJC Web Design on August 03, 2018, 10:52:54 AM
Have u fully investigated the ajax calls that provide the category displays?

administrator/index.php?option=com_virtuemart&view=product&type=getCategoriesTree&virtuemart_product_id=65&format=json&lang=en

does it render correctly and after saving are the correct cats selected?

e.g.

<option selected=\\\"selected\\\"  value=\"28\">PBC<\/option>

or only after clearing "cache"?

which cache?  joomla's, browser etc?

It must in some way be connected with the move to ajax cats and your host .. ajax can be cached and hard to get the latest .. is Hostgator ( imho one of the bad ones) caching this?
No one else is reporting problems with this
Title: Re: Unable to add or remove product categories
Post by: Studio 42 on August 03, 2018, 14:43:48 PM
Try to add in .htaccess
ExpiresByType application/json "access plus 0 seconds"
Certainly your hoster cache all json, i think that not only Vm have problems, but Joomla do not use many json response.
Title: Re: Unable to add or remove product categories
Post by: GJC Web Design on August 03, 2018, 16:35:14 PM
BTW - u will probably find on the FE - i.e. in the DB that the changes are being made..  it is just the return select isn't updated
Title: Re: Unable to add or remove product categories
Post by: koaconsulting on August 04, 2018, 03:00:35 AM
Thanks for your detailed suggestions. 

I was referring to the browser cache... if I empty the browser cache after adding/removing categories then the list IS populated correctly.

I ran the script URL you sent and it loads fine EXCEPT that the "selected" property has two extra backslashes around the word "selected".  Here's the output:

"<option   value=\"8\">Application Processing and Expediting</option><option selected=\\\"selected\\\"  value=\"6\">Books</option><option   value=\"13\"> - American Institute of Architects (AIA©)</option><option   value=\"18\"> - ASTM©</option><option   value=\"11\"> - Gainesville Independent Testing Services (GITS)</option><option   value=\"12\"> - International Code Council (ICC©)</option><option   value=\"16\"> - National Fire Protection Association (NFPA)</option><option   value=\"17\"> - National Roofing Contractors Association NRCA©</option><option   value=\"10\"> - Prometric©</option><option   value=\"9\"> - ProV©</option><option   value=\"15\"> - Sheet Metal Association Contractors of America (SMACNA©)</option><option   value=\"14\"> - Trane©</option><option   value=\"7\">Courses</option>"

Do you think that could be the problem?
Title: Re: Unable to add or remove product categories
Post by: koaconsulting on August 04, 2018, 03:11:17 AM
Problem Solved!!!  Turns out it was just the server caching the JSON request.  That addition to the .htaccess file fixed things!

Yeah, we do urge our clients to go with a more reputable host but they usually follow their budget and HostGator is a "lesser of evils" I suppose...

Thanks for all your help, it's greatly appreciated!