Jump to content

Multiple Ajax Errors [Prestashop 1.6]


gbimp

Recommended Posts

I'm trying to fix the following errors. When attempting to add a product to the cart by clicking on the "+ add to cart" button, I get the following error:

Impossible to add the product to the cart.
textStatus: 'error'
errorThrown: ''
responseText:
{"products":[{"id":2721,"link":"https:\/\/420panda.ca\/en\/calibration\/2721-calibration-weight-200gr.html","quantity":3,"image":"https:\/\/420panda.ca\/7347-home_default\/calibration-weight-200gr.jpg","image_cart":"https:\/\/420panda.ca\/7347-cart_default\/calibration-weight-200gr.jpg","priceByLine":"14,97 $","name":"Calibration weight 200gr","price":"14,97 $","price_float":14.97,"idCombination":0,"idAddressDelivery":611,"is_gift":false,"hasAttributes":false,"hasCustomizedDatas":false,"customizedDatas":[]},{"id":8332,"link":"https:\/\/420panda.ca\/en\/silicone\/8332-7-three-eyed-monster-silicone-waterpipe.html","quantity":3,"image":"https:\/\/420panda.ca\/20271-home_default\/7-three-eyed-monster-silicone-waterpipe.jpg","image_cart":"https:\/\/420panda.ca\/20271-cart_default\/7-three-eyed-monster-silicone-waterpipe.jpg","priceByLine":"44,97 $","name":"4.7\" THREE EYED MONSTER SILICONE WATERPIPE","price":"44,97 $","price_float":44.97,"idCombination":0,"idAddressDelivery":611,"is_gift":false,"hasAttributes":false,"hasCustomizedDatas":false,"customizedDatas":[]},{"id":8542,"link":"https:\/\/420panda.ca\/en\/other-brands\/8542-zeus-grinder-bolt-2.html","quantity":2,"image":"https:\/\/420panda.ca\/20810-home_default\/zeus-grinder-bolt-2.jpg","image_cart":"https:\/\/420panda.ca\/20810-cart_default\/zeus-grinder-bolt-2.jpg","priceByLine":"39,98 $","name":"ZEUS GRINDER BOLT\u2122 2","price":"39,98 $","price_float":39.98,"idCombination":0,"idAddressDelivery":611,"is_gift":false,"hasAttributes":false,"hasCustomizedDatas":false,"customizedDatas":[]}],"discounts":[],"shippingCost":"0,00 $","shippingCostFloat":0,"wrappingCost":"0,00 $","nbTotalProducts":8,"total":"99,92 $","productTotal":"99,92 $","freeShipping":"0,00 $","freeShippingFloat":0,"free_ship":true,"isVirtualCart":false,"hasError":false}

If I check the cart, the product is added even if the error is thrown.

 

Another error: If I'm in the cart and try to modify the quantities, I get the following error:

TECHNICAL ERROR: unable to save update quantity Details: Error thrown: [object Object] Text status: error

If I refresh the page, the quantities are still updated. 

 

I have checked to make sure that debug mode is disabled. I can't seem to find anything wrong with the cartController.php file or anything in the blockcart module > ajax-cart.js. 

Any ideas?

Link to comment
Share on other sites

No, that's not doing much. Here's something that might help to solve this matter. Every page throws a 404 error in the console. The page still loads. 

ScreenShot2023-07-12at8_15_07AM.thumb.png.30c2ac25664feada9bbdac7c466afb3a.png

I checked the .htaccess and it seems fine 

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on


#Domain: www.420panda.ca
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]


#Domain: 420panda.ca
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType font/woff2 .woff2
AddType application/x-font-woff .woff
<IfModule mod_headers.c>
	<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">
		Header set Access-Control-Allow-Origin "*"
	</FilesMatch>
</IfModule>

<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresByType image/gif "access plus 1 month"
	ExpiresByType image/jpeg "access plus 1 month"
	ExpiresByType image/png "access plus 1 month"
	ExpiresByType text/css "access plus 1 week"
	ExpiresByType text/javascript "access plus 1 week"
	ExpiresByType application/javascript "access plus 1 week"
	ExpiresByType application/x-javascript "access plus 1 week"
	ExpiresByType image/x-icon "access plus 1 year"
	ExpiresByType image/svg+xml "access plus 1 year"
	ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
	ExpiresByType application/font-woff "access plus 1 year"
	ExpiresByType application/x-font-woff "access plus 1 year"
	ExpiresByType font/woff2 "access plus 1 year"
	ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
	ExpiresByType font/opentype "access plus 1 year"
	ExpiresByType font/ttf "access plus 1 year"
	ExpiresByType font/otf "access plus 1 year"
	ExpiresByType application/x-font-ttf "access plus 1 year"
	ExpiresByType application/x-font-otf "access plus 1 year"
</IfModule>

<IfModule mod_headers.c>
	Header unset Etag
</IfModule>
FileETag none
<IfModule mod_deflate.c>
	<IfModule mod_filter.c>
		AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript font/ttf application/x-font-ttf font/otf application/x-font-otf font/opentype image/svg+xml
	</IfModule>
</IfModule>


#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

Still can't seem to find the reason behind it. 

Link to comment
Share on other sites

Those classes are not overridden in this build. I also compared code with the original CartController.php and Cart.php, and they have not been changed from the 1.6.1.18 version. Here is the override folder structure:

  • Class
    • stock
      • StockAvailable.php
    • Carrier.php
    • CartRule.php
    • Category.php
    • ImageManager.php
    • Product.php
    • ProductSale.php
    • Search.php
    • controllers
      • admin
        • AdminCategoriesController.php
        • AdminProductsController.php
      • front
        • ContactController.php
        • NewProductsController.php
    • modules
      • blocklayered
        • blocklayered.php

I tried disabling all overrides from the performance page in the back office and clearing the cache (deleting class_index.php from the cache folder) but no changes on that side. 

 

Link to comment
Share on other sites

Thank you for your assistance. Although your Ajax troubleshooting method is accurate and recommended, this error was site wide and affected every HTTP GET and POST requests. It seems that someone had changed the code inside the root index.php file that was attempting CURL functions. I've reset the code to the basic index.php and the error has cleared.

It is also worth mentioning that the main problem is that there was a CRON job added to append the malicious code to the infected pages.

 

 

Edited by gbimp
added valuable missing information after malaware scan. (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...