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

[-] Project : Fixes PSCFV-11593. Added code to load the customer when a non-user calls the Product::getPriceStatic method #1312

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion classes/Product.php
Expand Up @@ -2492,7 +2492,20 @@ public static function getPriceStatic($id_product, $usetax = true, $id_product_a
die(Tools::displayError());

// Initializations
$id_group = (int)Group::getCurrent()->id;
/*
* When a non-user calls directly this method (e.g., payment module...) is on PrestaShop,
* the context does not have customer but the customer ID is present so load the customer and assign the customer's default group
*/

if(isset($id_customer) && !Validate::isLoadedObject($context->customer))
{
$context->customer = new Customer($id_customer);
$id_group = (int)$context->customer->id_default_group;
}
else
{
$id_group = (int)Group::getCurrent()->id;
}

// If there is cart in context or if the specified id_cart is different from the context cart id
if (!is_object($cur_cart) || (Validate::isUnsignedInt($id_cart) && $id_cart && $cur_cart->id != $id_cart))
Expand Down