Headertags - product schema error

Open to all! Ask other shopowners for help.
Post Reply
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Headertags - product schema error

Post by 14Steve14 »

Version 1.0.9.0 PHP8.0

I have the following error in my error logs.
[18-Jun-2024 10:14:57 Europe/London] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in /home/####/####/includes/modules/header_tags/ht_product_schema.php:30
Stack trace:
#0 /home/####/####/includes/system/versioned/1.0.8.4/template.php(79): ht_product_schema->execute()
#1 /home/railways/public_html/templates/override/includes/components/template_top.php(13): Template->build_blocks()
#2 /home/####/####/templates/default/includes/pages/product_info.php(13): require('/home/railways/...')
#3 /home/####/####/product_info.php(25): require('/home/railways/...')
#4 {main}
thrown in /home/####/####/includes/modules/header_tags/ht_product_schema.php on line 30
Line 30 is the following

Code: Select all

        $products_image = ( count($images) > 0 )
Does this mean that somewhere on the site I have one or more products without images.

Can anyone help.


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Headertags - product schema error

Post by ecartz »

This means that $product->get('images') is not working properly.

Do you have a column in your products table named products_images? Note that you should have a column named products_image -- that's fine. It's products_images that would be problematic. If so, why do you have that column?
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Headertags - product schema error

Post by 14Steve14 »

@ecartz Thanks for taking the time to reply.

In the products table I have a column named products_image and also one called products_images. the products_images seems to be empty. This is probably from a long old addon for something as the database has been upgraded several times possibly from really old oscommerce.

I have backed up the database using the store admin setting and also exported a copy using sql. I will delete the empty column and see what happens. Looking there are also a few other old columns from long forgotten addons so may have a bit of a tidy in the database and remove the rubbish files from addons that are no longer used.

I will let you know if the problem goes away.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply