Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fatal error when updating discounts as guest #470

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Roxayl
Copy link

@Roxayl Roxayl commented Oct 2, 2023

A fatal error is raised when a discount code is added or removed from cart (stack trace below):

[PrestaShopException]
Fatal error
at line 1182 in file classes/Tools.php
ToolsCore::displayError - [line 3612 - classes/Product.php]
ProductCore::getPriceStatic - [line 371 - modules/ps_facebook/classes/Repository/ProductRepository.php] - [11 Arguments]
PrestaShop\Module\PrestashopFacebook\Repository\ProductRepository->getSalePrice - [line 311 - modules/ps_facebook/classes/Provider/EventDataProvider.php] - [3 Arguments]
PrestaShop\Module\PrestashopFacebook\Provider\EventDataProvider->getAddToCartEventData - [line 132 - modules/ps_facebook/classes/Provider/EventDataProvider.php]
PrestaShop\Module\PrestashopFacebook\Provider\EventDataProvider->generateEventData - [line 90 - modules/ps_facebook/classes/Dispatcher/EventDispatcher.php] - [2 Arguments]
PrestaShop\Module\PrestashopFacebook\Dispatcher\EventDispatcher->dispatch - [line 368 - modules/ps_facebook/ps_facebook.php] - [2 Arguments]
Ps_facebook->hookActionCartSave - [line 1007 - classes/Hook.php] - [1 Arguments]
HookCore::coreCallHook - [line 431 - classes/Hook.php] - [3 Arguments]

This pull request makes sure to ignore any cart updates that are related to discounts (since no product ID is provided in those cases), and just take into account product quantity changes.

@Roxayl Roxayl requested a review from a team as a code owner October 2, 2023 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant