close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Few Question

Thread begun 5/20/2024 5:21 am by Raza | Last modified 7/09/2024 5:34 am by Raza | 1179 views | 23 replies |

Raza

Few Question

hi
which row I should add to display product image on catalogue page? ProductImag or ProductThumbnail?

Sign in to reply to this post

Mags

Probably ProductImage if it's the standard eCart database structure you're using.

Sign in to reply to this post

Raza

ok btw I am practicing on eCart locally

Sign in to reply to this post

PatriceWebAssist

If working in PowerStore, I think I recall that the thumbnail is an auto result of the product image. I don't recall having to enter anything other than the main image. Can you share the link?

Sign in to reply to this post

Raza

I am practicing on eCart locally. I downloaded database file from this link http://www.webassist.com/tutorials/Free-eCommerce-MySQL-Database

Sign in to reply to this post

Raza

I need a tutorial how to add "Add to Cart" button

Sign in to reply to this post

Mags

There are several tutorials at https://webassist.com/tutorials - type "add to cart" in the keyword search box. Also here: https://webassist.com/tutorials/eCommerce-Overview-eCommerce-Series. There also used to be a walkthrough video available but the link doesn't work any more - Patrice might know if it can still be accessed. The old link was http://connect.webassist.com/p53882011/

Sign in to reply to this post

Raza

Thanks a lot

Sign in to reply to this post

Raza

hi Mags
I have created Add To Cart button but when I click to test it its showing error I am attaching error snapshot kindly check it

Sign in to reply to this post

Mags

I don't know enough about eCart to help with this, sorry. I did however upload your error message image to ChatGPT v4 and it came back with this:

The PHP error in the image indicates that the sizeof() function is being called with a null argument. This function requires a parameter that is either an array or a countable object, but in this case, it appears to be receiving a null value, which is causing the error.

Here’s a breakdown of the error message and the steps to fix it:

Error Details:
Error Type: TypeError
Error Message: sizeof(): Argument #1 ($value) must be of type Countable|array, null given
File: C:\wamp64\www\shopping-cart\WA_eCart\MyeCart_PHP.php
Line: 14
Steps to Fix:
Identify the Problem Line:
The error occurs on line 14 of MyeCart_PHP.php. You need to examine the code on this line to understand why a null value is being passed to sizeof().

Check the Code:
Open the MyeCart_PHP.php file and navigate to line 14. Look for the sizeof() function call and identify the variable being passed to it.

Validate the Variable:
Ensure that the variable being passed to sizeof() is properly initialized and is either an array or a countable object before the sizeof() function is called. If it's possible for the variable to be null, add a check to handle this case.

Example Fix:
Here's an example of how you might modify the code to prevent the error:

Original Code (Line 14 of MyeCart_PHP.php):

$cart_size = sizeof($items);



Modified Code:

$cart_size = is_array($items) ? sizeof($items) : 0;



In this modification, is_array($items) checks if $items is an array before calling sizeof(). If $items is not an array (which includes being null), it assigns 0 to $cart_size.

Additional Considerations:
Initialize Variables:
Ensure that $items is always initialized as an array or a countable object before it's used.
Debugging:
Add debugging statements to log the value of $items before line 14 to understand why it might be null.

Example Debugging:

if (!is_array($items)) {
error_log("Warning: \$items is not an array. Value: " . print_r($items, true));
}
$cart_size = is_array($items) ? sizeof($items) : 0;



By following these steps, you can resolve the TypeError and ensure that sizeof() is called with a valid argument. If you provide the relevant code snippet from MyeCart_PHP.php, I can offer more specific guidance tailored to your code.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...