Post by hawk007 » Sun Jul 26, 2020 6:53 pm

Hi, I am getting this error on the front end of a new install of OC. I have the marketplace and marketplace membership module installed. And the porto theme. Any ideas what the cause it. I am not a developer so not sure how to fix it.

Warning: array_key_exists() expects parameter 2 to be array, boolean given in public_html/domain.com/store/system/library/themeoptions.php on line 449

line 449 is:

if(array_key_exists($product_id, $this->getLatestProducts($product_id))){

Full code for the few lines is:

public function isLatestProduct($product_id)
{
if(array_key_exists($product_id, $this->getLatestProducts($product_id))){
return true;
}
return false;
}

I am not a coder as I said so have no idea what all that means.

And guidance to solve this appreciated, thanks

New member

Posts

Joined
Tue Aug 02, 2016 8:53 pm

Post by hawk007 » Sun Jul 26, 2020 6:54 pm

I am also getting an efrror on the product page on the front end:

Warning: Please check the form carefully for errors!

there is no form?

Any ideas appreciated. Thanks

New member

Posts

Joined
Tue Aug 02, 2016 8:53 pm

Post by xxvirusxx » Sun Jul 26, 2020 7:03 pm

hawk007 wrote:
Sun Jul 26, 2020 6:53 pm
And the porto theme.
You have tried to contact theme support?

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by hawk007 » Sun Jul 26, 2020 7:31 pm

Thanks for the response. The developer doesn't support it. I didn't realize this when I purchased it. So its kinda my bad. I got it from themeforest and theres basically no way to get a refund or anything like that. Not that I want one, I would prefer the errors got fixed.

Thanks again

New member

Posts

Joined
Tue Aug 02, 2016 8:53 pm

Post by letxobnav » Sun Jul 26, 2020 7:33 pm

bad template.
My guess is that:

Code: Select all

$this->getLatestProducts($product_id)
returns false instead of an empty array when no products are found.
and this:

Code: Select all

array_key_exists($product_id, $this->getLatestProducts($product_id)
expects an array there.

Get your money back.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by xxvirusxx » Sun Jul 26, 2020 8:06 pm

hawk007 wrote:
Sun Jul 26, 2020 6:53 pm

Code: Select all

 if(array_key_exists($product_id, $this->getLatestProducts($product_id))){
I think that code should be:

Code: Select all

if (is_array($product_id, $this->getLatestProducts($product_id)) && array_key_exists($product_id, $this->getLatestProducts($product_id))) {
LE. If theme support can't help you, you can post anytime in Commercial section for paid support

viewforum.php?f=88

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by letxobnav » Sun Jul 26, 2020 9:20 pm

I think it would be much more structured if

Code: Select all

$this->getLatestProducts($product_id)
would always return an array.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by paulfeakins » Mon Jul 27, 2020 6:32 pm

hawk007 wrote:
Sun Jul 26, 2020 7:31 pm
Thanks for the response. The developer doesn't support it. I didn't realize this when I purchased it. So its kinda my bad. I got it from themeforest and theres basically no way to get a refund or anything like that.
Yeah some of the code on there is shocking.

If you can't get it fixed you could pay a developer such as ourselves or post a job in the Commercial Support Forum.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: Axlagusti, niagato and 596 guests