VirtueMart Forum

VirtueMart 2 + 3 => Virtuemart Development and bug reports => Topic started by: markjansen_nl on November 27, 2021, 20:21:07 pm

Title: No add to cart in category, but works from both sub-category and productpage
Post by: markjansen_nl on November 27, 2021, 20:21:07 pm
Hi all. I ran into this strange problem and I'm running out of options to check. Hopefully you have any suggestions.

The issue can be quite easily summarized:

The error raised after clicking the order button is (according to the browser inspect feature) as follows:
Code: [Select]
Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.
jquery-migrate.min.js?0d074817dd3fafe8e8ee480b5bb425eb:2 JQMIGRATE: Migrate is installed, version 1.4.1
soepshop.html:1316
       
       Uncaught TypeError: jQuery(...).vm2front is not a function
    at HTMLDocument.<anonymous> (soepshop.html:1316)
    at u (jquery.min.js?0d074817dd3fafe8e8ee480b5bb425eb:2)
    at Object.fireWith [as resolveWith] (jquery.min.js?0d074817dd3fafe8e8ee480b5bb425eb:2)
    at Function.ready (jquery.min.js?0d074817dd3fafe8e8ee480b5bb425eb:2)
    at HTMLDocument._ (jquery.min.js?0d074817dd3fafe8e8ee480b5bb425eb:2)
(anonymous) @ soepshop.html:1316
u @ jquery.min.js?0d074817dd3fafe8e8ee480b5bb425eb:2
fireWith @ jquery.min.js?0d074817dd3fafe8e8ee480b5bb425eb:2
ready @ jquery.min.js?0d074817dd3fafe8e8ee480b5bb425eb:2
_ @ jquery.min.js?0d074817dd3fafe8e8ee480b5bb425eb:2
DevTools failed to load source map: Could not load content for https://www.jubalvarsseveld.nl/media/gantry5/assets/js/main.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
(https://www.jubalvarsseveld.nl/images/vm_screenshot.png)

I already tried disabling the jQuery features of Virtuemart itself, but that doesn't help. Given the difference in categorys and subcategory's it almost feels like I should move the products into a (virtual) subcategory, but that yet again also feels rather ackward move to make (like avoiding a bug instead of adressing it).

Any thoughts here? Thanks.


We use:
[/list]
Title: Re: No add to cart in category, but works from both sub-category and productpage
Post by: GJC Web Design on November 27, 2021, 21:43:52 pm
Quote
vm2front is not a function

this normally occurs when all the required VM js files are not loaded ...

go thru the inspector network tab for the 2 situations and check all js is loading and in the correct order
Title: Re: No add to cart in category, but works from both sub-category and productpage
Post by: markjansen_nl on November 27, 2021, 21:49:12 pm
Quote
vm2front is not a function

this normally occurs when all the required VM js files are not loaded ...

go thru the inspector network tab for the 2 situations and check all js is loading and in the correct order

I only see status code 200 (so ok) in that screen. So which JS should be missing to cause this error?
Title: Re: No add to cart in category, but works from both sub-category and productpage
Post by: Jörgen on November 28, 2021, 17:38:34 pm
Maybe your template interferes with routing. try with vmbeez3 template and turn sef.

Jörgen
Title: Re: No add to cart in category, but works from both sub-category and productpage
Post by: GJC Web Design on November 28, 2021, 21:51:35 pm
Quote
I only see status code 200 (so ok) in that screen. So which JS should be missing to cause this error?

what has 200 got to do with it .. if it isn't called it isn't there -- as one works and the other doesn't there must be some difference somewhere.... logic

have u done this!!!!  ->>>>> go thru the inspector network tab for the 2 situations and check all js is loading and in the correct order
compare!
Title: Re: No add to cart in category, but works from both sub-category and productpage
Post by: markjansen_nl on November 29, 2021, 21:53:16 pm
Maybe your template interferes with routing. try with vmbeez3 template and turn sef.

Jörgen
Thank you for the suggestion. There is no vmbeez3 template however. All templates are set to default (which is Gantry5 Hydrogen).

And why would the template interfere with just one category? All other product categories works just fine.
Title: Re: No add to cart in category, but works from both sub-category and productpage
Post by: markjansen_nl on November 29, 2021, 21:59:25 pm
Quote
I only see status code 200 (so ok) in that screen. So which JS should be missing to cause this error?

what has 200 got to do with it .. if it isn't called it isn't there -- as one works and the other doesn't there must be some difference somewhere.... logic

have u done this!!!!  ->>>>> go thru the inspector network tab for the 2 situations and check all js is loading and in the correct order
compare!

The only difference seems to be update_cart.js to be missing in the empty cart situation. See screenshots.

(https://www.jubalvarsseveld.nl/images/network_cart_empty.png)
(https://www.jubalvarsseveld.nl/images/network_cart_full.png)

So any thoughts on why this script would not be loaded in one particular category?

Thank you for any assistance.
Title: Re: No add to cart in category, but works from both sub-category and productpage
Post by: GJC Web Design on November 30, 2021, 11:49:38 am
Quote
update_cart.js to be missing

so there is your answer ...  now u need to trace how that file is called by your template and why it is not calling it when on a root category
Title: Re: No add to cart in category, but works from both sub-category and productpage
Post by: markjansen_nl on December 02, 2021, 20:39:05 pm
Fyi, I reinstalled vmbeez template from the package on the website, applied it to the category but with no effect (besides of course a totally different layout). So I wonder whether it's really a template issue.

Right now I'm doing a CTRL/F on where this JS-file is called.
Title: Re: No add to cart in category, but works from both sub-category and productpage
Post by: markjansen_nl on December 02, 2021, 21:29:55 pm
And even forcing https://www.jubalvarsseveld.nl/modules/mod_virtuemart_cart/assets/js/update_cart.js to be loaded on every page does not work

Reinstalling VM does not solve the issue

Reinstalling templat manage Gantry neither

Any suggestions are welcome

Title: Re: No add to cart in category, but works from both sub-category and productpage
Post by: GJC Web Design on December 02, 2021, 22:01:13 pm
I wouldn't compare the cart pages .. I would compare the product pages that aren't adding to the product pages that are