VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: zprint on December 29, 2017, 08:00:12 AM

Title: State dropdown or add to cart
Post by: zprint on December 29, 2017, 08:00:12 AM
I'm having a problem with a site using a JoomlaShine V2 template and VirtueMart.

I'm only shipping in the US. In the user details form, once US is selected, the state dropdown does not populate with states.
If I turn off "javascript compression" in the JoomlaShine template, the states populate fine, but the "add to cart" function no longer works.

There is an option to exclude individual files from the javascript compression, but I have not yet found a file that to exclude that fixes this problem.

Title: Re: State dropdown or add to cart
Post by: GJC Web Design on December 29, 2017, 10:42:36 AM
This question should be directed to the people that sold you the template
Title: Re: State dropdown or add to cart
Post by: zprint on December 29, 2017, 18:28:54 PM
This question has been directed to the people who sold me the template.

I was, however, hoping to gain some insights from people who work every day with VirtueMart.

Can anyone possibly tell me which file(s) is responsible for populating the US state drop down list in the registration area?

Any help is much appreciated.
Title: Re: State dropdown or add to cart
Post by: jenkinhill on December 29, 2017, 20:00:05 PM
That would normally be a version of chosen.js but the function of that script depends on the relevant jQuery being loaded before. It is almost always best not to use js compression, or to exclude all VM js files from being compressed.
Title: Re: State dropdown or add to cart
Post by: zprint on December 30, 2017, 03:06:29 AM
Thank you for your response, Kelvyn.

What I'm finding is with js un-compressed, the states populate, but the "add to cart" function ceases to work.

Kind of between a rock and a hard place: customers can either add a product to their cart, or they can successfully add their state to their profile, but no both!
Title: Re: State dropdown or add to cart
Post by: jenkinhill on December 30, 2017, 11:27:10 AM
Then you have another issue, probably also with with your template.
Title: Re: State dropdown or add to cart
Post by: GJC Web Design on December 30, 2017, 11:41:23 AM
1st check that everything is working with the std templates..  protostar

if so then check for JS errors on your template in the browser tools -  is the templater not providing any support for this problem?
Title: Re: State dropdown or add to cart
Post by: zprint on December 31, 2017, 08:01:27 AM
Kelvyn-

Yes- it is a problem with the template, but in order to keep everything in the template operable, I have to sacrifice the "state" drop down in the Virturemart registration.

I've found that disabling the js compression fixes the US state drop down list, but breaks both "add to cart" and another Joomlashine component, "Image Show".

If I alter the VM "add to cart" function to skip the pop-up window, I can successfully turn off the js compression, and still be able to add products to the cart.

But!!! The the Joomlashine image show component breaks.

I understand well that I should be getting help from Joomlashine for this, but I'm at a place in time that this site needs to go live, and their tech help is off probably until Tuesday.

The only thing that breaks with js compressed by the Joomlashine template is the VirtueMart US state drop down in the cart/registration area.

I apologize that my knowledge of jquery and js is lacking, but that's where I'm at.

It appears in the Joomlashine template that I can exclude files from js compression, so I'm hoping that maybe that might be a solution.
Try as I might, however, I cannot find the VirtueMart file that might fix this problem if I exclude from the template's js compression.

I've been doing this for some time now, but my code knowledge has some big holes in it. Any help is much appreciated.

Chris
Title: Re: State dropdown or add to cart
Post by: jenkinhill on December 31, 2017, 12:16:10 PM
Probably best to exclude all VM js files from compression. If you check the page source code with compression turned off then you can see h=what VM js files are being loaded. Alternatively look in the components/com_virtuemart/assets/js direcctory on the server to see the full list of scripts VM may use.

You should also check the settings in VM Configuration/Templates/Activate Css Styles & Javascripts  - I usually select all options except the last one (external jQuery).
Title: Re: State dropdown or add to cart
Post by: GJC Web Design on December 31, 2017, 12:16:49 PM
exclude the VM JS files

basically all in components\com_virtuemart\assets\js\

vmsite.js  handles the states

vmprices.js the add to cart etc
Title: Re: State dropdown or add to cart
Post by: zprint on January 05, 2018, 08:02:13 AM
Thank you for the information and suggestions, guys.

After trying a bunch of things, I tried disabling jquery easy, where I had previously excluded a line of code regarding the state dropdown.

Excluding it had previously made it work; after a few updates, apparently it broke it.

After disabling the plug in all worked as intended.
Title: Re: State dropdown or add to cart
Post by: Studio 42 on January 06, 2018, 02:23:00 AM
Try to not use plugin that modify the javascripts, this most time break your site(a day).