2

How can I obtain the actual final cost of items?

Let's say a customer's out-of-pocket payment for an order is

$1000 and tax is $100 and shipping is $50

So subtracting, all his items AFTER discounts and promo rules (whether it's shopping cart rules or catalog rules) applied would be $850. Out of the $850, he may have varying items with varying discounts applied and prices (e.g. $250 + $100 + $300 + $200).

The values $250, $100, $300, $200 are is what I want..

How do I obtain them?

2
  • 1
    Are working with a quote item or an order item? Commented Jul 2, 2015 at 2:34
  • Im using an order
    – ahnbizcad
    Commented Jul 2, 2015 at 6:45

2 Answers 2

1

Take a look at the sales_flat_order_item table - this has the details on all ordered items. In your case to access the individual line items something like this would be a starting point:

foreach ($order->getAllItems() as $item) {
    $item->getBaseRowTotal();
    //or just the discount amount
    $item->getBaseDiscountAmount();
}
0

$porduct = $item->getProduct();

$product->getFinalPrice() should give you the price after discount for each item.

5
  • Does it work for shopping cart discounts as well as for catalog discounts? I tried this, but it said the price was $0.00, which was not correct. This is after a 99% shoppingcart discount, but the total was over $1000, so at least one product's final price should have been non-$0.00.
    – ahnbizcad
    Commented Jul 2, 2015 at 1:59
  • do you have cart price rule or catalog price rule applied? Commented Jul 2, 2015 at 2:01
  • This is after a 99% shoppingcart discount, but the total was over $1000, so at least one product's final price should have been non-$0.00.
    – ahnbizcad
    Commented Jul 2, 2015 at 2:09
  • Can you upload screenshot of your cart page plez. Commented Jul 2, 2015 at 2:25
  • This answer is wrong. Commented Apr 18 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.