500 Internal server error jquery when clicking add to cart in mobile

Post 500 (Internal Server Error) jquery-3.5.1.min.js

I use Unitheme2.
I have this problem after changing from php7.4 to php8.1.
The problem only occurs on mobile.
This is probably because the version of unitheme is low.
Anyone know how to solve it?
Sometimes I could see this error as well in debug mode.

Identifier “ajax” Is Not Defined


This is a known issue and was already fixed. The fix will be included into 4.18.1 version of CS-Cart.

In order to apply the fix in the current version, please use the attached .diff file.
954aba813d1a922509359df19d2197bdef78f7c7.diff (4.6 KB)

hello. thank you
However, an error occurs in the diff file and it is not applied.
When I tried to apply the diff manually, the relevant part was not in the file this part.
My version is 4.17.1.

  •    $added_product_ids = fn_add_product_to_cart($product_data, $cart, $auth);
  •    $added_product_ids = fn_add_product_to_cart($_REQUEST['product_data'], $cart, $auth);
       $previous_state = md5(serialize($cart['products']));
       $cart['change_cart_products'] = true;

@@ -139,7 +127,7 @@
} elseif (
&& !in_array(

  •                array_keys($added_product_ids, key($product_data)),
  •                array_keys($added_product_ids, key($_REQUEST['product_data'])),
           ) {

Thank you.

I applied some of it, but it doesn’t work.
It looks like there are more changes in the meantime.
please checking.
Thank you.

Either there is something theme related causes the issue, or the changes were applied incorrectly. Please check the error logs for the full error and please, provide it here.

If you check the diff file provided, These two files will be modified.
/app/controllers/frontend/checkout.php b/app/controllers/frontend/checkout.php

The file was extracted from the default file of 4.17.1.
This does not apply because the contents of checkout.php are different.
This file captures what was extracted from the default store. It’s the same as the file in my store.
These two parts do not match the diff file.

In this case, you will need to upgrade your store to version 4.17.2 and then try to apply the changes, as this fix is for version 4.17.2 and does not include changes made between 4.17.1 and 4.17.2.