Skip to content

Commit

Permalink
Merge pull request #34 from pagantis/INT-749
Browse files Browse the repository at this point in the history
Int 749
  • Loading branch information
pgarcess authored Oct 22, 2019
2 parents f49734c + cba6bdf commit 31dd952
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions controllers/paymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,30 +258,31 @@ public function pagantisReceiptPage($order_id)
$details = new Details();
$shippingCost = $order->shipping_total;
$details->setShippingCost(intval(strval(100 * $shippingCost)));
$items = $woocommerce->cart->get_cart();
$items = $order->get_items();
$promotedAmount = 0;
foreach ($items as $key => $item) {
$wcProduct = $item->get_product();
$product = new Product();
$productDescription = sprintf(
'%s %s %s',
$item['data']->get_title(),
$item['data']->get_description(),
$item['data']->get_short_description()
$wcProduct->get_name(),
$wcProduct->get_description(),
$wcProduct->get_short_description()
);
$productDescription = substr($productDescription, 0, 9999);

$product
->setAmount(intval(100 * $item['line_total']))
->setQuantity($item['quantity'])
->setAmount(intval(100 * $item->get_total()))
->setQuantity($item->get_quantity())
->setDescription($productDescription)
;
$details->addProduct($product);

$promotedProduct = $this->isPromoted($item['product_id']);
$promotedProduct = $this->isPromoted($item->get_product_id());
if ($promotedProduct == 'true') {
$promotedAmount+=$product->getAmount();
$promotedMessage = 'Promoted Item: ' . $product->getDescription() .
' Price: ' . $item['line_total'] .
' Price: ' . $item->get_total() .
' Qty: ' . $product->getQuantity() .
' Item ID: ' . $item['id_product'];
$metadataOrder->addMetadata('promotedProduct', $promotedMessage);
Expand Down

0 comments on commit 31dd952

Please sign in to comment.