JS Error on Product Comparison page - on local XAMPP development environment - caused by code on this module [with code solution] #5

Closed
opened 2019-09-16 03:27:39 -05:00 by Acer-ZA · 2 comments
Acer-ZA commented 2019-09-16 03:27:39 -05:00 (Migrated from github.com)

On TB 1.1.0, local XAMPP development environment:
Product Comparison page throws the following JS errors, causing "removing product from column" to not work:

Uncaught Syntax Error: Invalid Hexadecimal escape sequence 
Uncaught Reference Error: baseUri is not defined

Problem is solved by making the following code change in
/modules/socialsharing/socialsharing.php line 243

change

_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL', null, null, $this->context->shop->id), "'"
into
str_replace("\\","/",_PS_IMG_DIR_).Configuration::get('PS_LOGO_MAIL', null, null, $this->context->shop->id), "'"

Related TB Forum Post:
https://forum.thirtybees.com/topic/3466-solved-product-comparison-error-when-trying-to-remove-product-30bz-110-local-dev-xampp/

As this is one of my first issue posts, please point out any issues or improvements that I can make on future issue posts. Thanks :)

On TB 1.1.0, local XAMPP development environment: Product Comparison page throws the following JS errors, causing "removing product from column" to not work: ``` Uncaught Syntax Error: Invalid Hexadecimal escape sequence Uncaught Reference Error: baseUri is not defined ``` Problem is solved by making the following code change in /modules/socialsharing/socialsharing.php line 243 change `_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL', null, null, $this->context->shop->id), "'"` into ` str_replace("\\","/",_PS_IMG_DIR_).Configuration::get('PS_LOGO_MAIL', null, null, $this->context->shop->id), "'"` Related TB Forum Post: https://forum.thirtybees.com/topic/3466-solved-product-comparison-error-when-trying-to-remove-product-30bz-110-local-dev-xampp/ As this is one of my first issue posts, please point out any issues or improvements that I can make on future issue posts. Thanks :)
musicpanda commented 2019-09-19 22:23:57 -05:00 (Migrated from github.com)

You have to wonder whether the problem here really is Windows. It is highly unusual (and considered a bit of a security risk) to expose the full path on the server in the code that is served to the customers. That is one of the reasons why we don't display error messages unless in debug mode. A javascript file is less visible but one still has to wonder why.

This may not be a problem with cloud servers. In the TB demo the js file looks like this:
sharing

This is an error that also happens in Prestashop 1.6. In Prestashop 1.7 the compare function seems to have disappeared.

You have to wonder whether the problem here really is Windows. It is highly unusual (and considered a bit of a security risk) to expose the full path on the server in the code that is served to the customers. That is one of the reasons why we don't display error messages unless in debug mode. A javascript file is less visible but one still has to wonder why. This may not be a problem with cloud servers. In the TB demo the js file looks like this: ![sharing](https://user-images.githubusercontent.com/13930107/65297032-cdf45600-db66-11e9-8c9c-12283333785b.jpg) This is an error that also happens in Prestashop 1.6. In Prestashop 1.7 the compare function seems to have disappeared.
getdatakick commented 2022-12-13 06:34:59 -06:00 (Migrated from github.com)

fixed by 736acf8674

fixed by 736acf867426eeb4078bfdca341010361083f2a1
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-thirtybees/socialsharing#5
No description provided.