VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: artonweb on April 29, 2020, 20:25:08 PM

Title: count(): Parameter must be an array or an object
Post by: artonweb on April 29, 2020, 20:25:08 PM
Hello.
I am using Joomla 3.9.18 and Virtuemart 3.6.10
Today I checked my error.log file and I saw the error which  is described below:

PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /home/..../public_html/administrator/components/com_virtuemart/models/product.php on line 2351

if ((isset($pricesToStore['product_price']) and $pricesToStore['product_price']!='' and $pricesToStore['product_price']!=='0') || (isset($childPrices) and count($childPrices)>1)) { 

Is it crucial?If so, how can I get it fixed?
Title: Re: count(): Parameter must be an array or an object
Post by: Milbo on May 11, 2020, 23:11:33 PM
Hmm it is harmless, I would say.

Please update to the last version https://virtuemart.net/news/500-release-of-virtuemart-3-8-and-covid-support-campaign

But I must admit it is quite likely that it keeps there. I think it is a product without prices and you use php7.4?
Title: Re: count(): Parameter must be an array or an object
Post by: artonweb on May 12, 2020, 21:25:41 PM
Hello.
I am using PHP 7.3 and all products have prices.
Title: Re: count(): Parameter must be an array or an object
Post by: Milbo on June 15, 2020, 11:04:38 AM
Did you update?
Title: Re: count(): Parameter must be an array or an object
Post by: T.A. Garrison, LLC on April 19, 2022, 23:53:01 PM
I noticed that you didn't get a response from the poster.

I got the same error when attempting to "Ask a question" from a product page.
I have the ask a question set to registered members, so guests have to sign in or register.

When I am not logged in I get the error - The arguments must either be an event or an array
But that shouldn't happen.

The popup has the login screen, and above that there is the error. So visitors won't know why, and I see no reason that should appear there. It's not an error. It's just that the user needs to sign in.

If there was nothing but the prompt to log in, that would be enough.
But it seems that there is something more going on with that link.

Any thoughts?
I'm using VM 3.8.9 10622

When I'm logged in, it's fine...although the white background is not wide enough. In all the popups with the new VM I've noticed that the white background does not cover the back of the window. Most of the popup runs off the right side of the background.
Is that by design? Or is that something you plan to address when the package is stable?

It's the "Fancy Box Outer" that is not "containing" the popup. I'm using CSS to adjust / override, but that's not the final solution. Is it?

Thanks.
Title: Re: count(): Parameter must be an array or an object
Post by: Milbo on April 30, 2022, 23:06:28 PM
"Is that by design? Or is that something you plan to address when the package is stable?"
Sounds like your template.

How does it work on vm4?
Title: Re: count(): Parameter must be an array or an object
Post by: T.A. Garrison, LLC on May 14, 2022, 17:58:26 PM
Sorry for the delay. I didn't get a notification of a response.

After finding why Php 8.0 didn't work for J4 I fixed that and now run Php 8.0 for the site.
I just updated VM this morning. Prior to updating the several VM updates there were 2 errors about 2 VM plugins (which I have disabled because they are payment plugins I don't use) that could not be updated due to something with xml (sorry...I didn't copy the specific error before I updated).

I've updated to VM 4.0.2 10661 and the "Ask a question" popup works without errors, but only on 1 product at a time and then you must return to the main category or refresh the page in order to get the popup to work again.

If I go to any product, click "Ask a question", the popup works.
But if I click on the link to a different product from any 1 product details page, then click on "Ask a question", the popup doesn't work until I refresh the page or return to the category (same as refresh).

I also changed the fancy box settings in order not to have the background and foreground not match. I disabled "Fancy Box".
I enabled Fancy Box today to see if it's different in 4.0.2 10661, but it's not. The background for the text is still is not the same width as the box itself.
So I'll keep Fancy Box disabled, although the popup box is just black and white.

I then "Inspected" the popup with fancy box disabled and see there are several errors, each pointing to VM coding.

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help http://xhr.spec.whatwg.org/

Uncaught SyntaxError: redeclaration of const uriAttributes
    <anonymous> https://www.tagarrison.com/services/seo/seo-monthly-detail line 2 > injectedScript:1
    jQuery 11
    reveal https://www.tagarrison.com/components/com_virtuemart/assets/js/facebox.js?vmver=7aa44493:123
    jqxhr https://www.tagarrison.com/components/com_virtuemart/assets/js/facebox.js?vmver=7aa44493:263
    jQuery 4

Uncaught SyntaxError: redeclaration of let JFormValidator
    <anonymous> https://www.tagarrison.com/services/seo/seo-monthly-detail line 2 > injectedScript:1
    jQuery 11
    reveal https://www.tagarrison.com/components/com_virtuemart/assets/js/facebox.js?vmver=7aa44493:123
    jqxhr https://www.tagarrison.com/components/com_virtuemart/assets/js/facebox.js?vmver=7aa44493:263
    jQuery 4

Uncaught SyntaxError: redeclaration of const uriAttributes
    <anonymous> https://www.tagarrison.com/services/seo/seo-monthly-detail line 2 > injectedScript:1
    jQuery 11
    reveal https://www.tagarrison.com/components/com_virtuemart/assets/js/facebox.js?vmver=7aa44493:123
    jqxhr https://www.tagarrison.com/components/com_virtuemart/assets/js/facebox.js?vmver=7aa44493:263
    jQuery 4

Uncaught SyntaxError: redeclaration of let JFormValidator
    <anonymous> https://www.tagarrison.com/services/seo/seo-monthly-detail line 2 > injectedScript:1
    jQuery 11
    reveal https://www.tagarrison.com/components/com_virtuemart/assets/js/facebox.js?vmver=7aa44493:123
    jqxhr https://www.tagarrison.com/components/com_virtuemart/assets/js/facebox.js?vmver=7aa44493:263
    jQuery 4

That's not me repeating the copy and paste. That's the same error appearing twice.

And finally...

Some cookies are misusing the recommended "SameSite" attribute 2


Everything seems to work, other than the requirement to refresh in order for Ask a question to work when clicking to another product from any product details page.
Title: Re: count(): Parameter must be an array or an object
Post by: Milbo on June 17, 2022, 11:24:46 AM
I just see the ask a question layout is not loading the new fancybox version 1.3.4.2. Thank you for the report, fixed next version