rockpos 4.2.10 unable to edit the product price in order page

prestashop directory/override/classes/Cart.php

in line 431

//start - edited by Jimmy @9Aug2022 solve the product price in order page
// if ($keepOrderPrices) {
$orderId = Order::getIdByCartId($this->id);
$orderId = (int) $orderId ?: null;
// }
//end - edited by Jimmy @9Aug2022 solve the product price in order page

put the below getOrderPrices function before getCartPrices

private function getOrderPrices(
array $productRow,
int $orderId,
int $productQuantity,
?int $addressId,
Context $shopContext,
&$specificPriceOutput
): array {
$orderPrices = [];
$orderPrices['price_without_reduction'] = Product::getPriceFromOrder(
$orderId,
(int) $productRow['id_product'],
isset($productRow['id_product_attribute']) ? (int) $productRow['id_product_attribute'] : 0,
true,
false,
true
);

$orderPrices['price_without_reduction_without_tax'] = Product::getPriceFromOrder(
$orderId,
(int) $productRow['id_product'],
isset($productRow['id_product_attribute']) ? (int) $productRow['id_product_attribute'] : 0,
false,
false,
true
);

$orderPrices['price_with_reduction'] = Product::getPriceFromOrder(
$orderId,
(int) $productRow['id_product'],
isset($productRow['id_product_attribute']) ? (int) $productRow['id_product_attribute'] : 0,
true,
true,
true
);

$orderPrices['price'] = $orderPrices['price_with_reduction_without_tax'] = Product::getPriceFromOrder(
$orderId,
(int) $productRow['id_product'],
isset($productRow['id_product_attribute']) ? (int) $productRow['id_product_attribute'] : 0,
false,
true,
true
);

// If the product price was not found in the order, use cart prices as fallback
if (false !== array_search(null, $orderPrices)) {
$cartPrices = $this->getCartPrices(
$productRow,
$productQuantity,
$addressId,
$shopContext,
$specificPriceOutput
);
foreach ($orderPrices as $orderPrice => $value) {
if (null === $value) {
$orderPrices[$orderPrice] = $cartPrices[$orderPrice];
}
}
}

return $orderPrices;
}

 

 

 

Article Details

Article ID:
52
Rating :

Related articles