emrez Posted October 6, 2021 Share Posted October 6, 2021 I want to add payment fee to cart with a product created for payment fees. But when i add to cart the product for fee then i use $cart->getOrderTotal(), it doesn't show the real price with fee. It shows the order total as product price without fee. I use SpecificPrice class for this action. And i think prestashop orders page on back office, firstly reads products with specific prices. However, it does not show the payment price, but shows it together with the price of the product I added. Maybe you didn't understand it like that, but I explained it better in the comments below. Please help me. I've been struggling for 2 days. $specific_price = new SpecificPrice(); $specific_price->id_product = 50; // choosen product id $specific_price->id_customer = (int) $cart->id_customer; $specific_price->id_product_attribute = 0; $specific_price->id_cart = (int)$cart->id; $specific_price->id_shop = (int) $cart->id_shop; $specific_price->id_currency = (int) $cart->id_currency; $specific_price->id_country = Context::getContext()->country->id; $specific_price->id_group = 0; $specific_price->from_quantity = 1; $specific_price->price = $installment_fee; //installment fee is here. (example: 1.13) $specific_price->reduction_type = 'amount'; $specific_price->reduction_tax = 1; $specific_price->reduction = 0; $specific_price->from = date("Y-m-d H:i:s"); $dateUntil = new DateTime(); $dateUntil->modify("+2 days"); $specific_price->to = $dateUntil->format('Y-m-d H:i:s'); // or set date x days from now try{ $specific_price->add(1,1); } catch (\Exception $exception) { echo $exception->getMessage(); die; } //cart product price = 30 //installment fee product = 10 (i want to edit it with installment fee (ex: 1.13)) $cart->updateQty(1,50); //the real product is here. Price: 10, but i want to use it with specific price created above.So product price + specific price. //but it shows product price(30) + product price(10) //but i want product price(30) + product price(1.13) echo '<pre>'; print_r($cart->getOrderTotal()); //it shows 40 but i want 31.13 exit; Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now