Skip to content

Commit

Permalink
Fixed PayPal line item positions
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Jul 18, 2019
1 parent 50d24c4 commit 969b926
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -678,7 +678,7 @@ protected function getOrderDetails( \Aimeos\MShop\Order\Item\Base\Iface $orderBa
foreach( $orderBase->getProducts() as $product )
{
$price = $product->getPrice();
$lastPos = $product->getPosition() - 1;
$lastPos = $product->getPosition();

$deliveryPrice = clone $price;
$deliveryPrices = $this->addPrice( $deliveryPrices, $deliveryPrice->setValue( '0.00' ), $product->getQuantity() );
Expand Down Expand Up @@ -708,6 +708,7 @@ protected function getOrderDetails( \Aimeos\MShop\Order\Item\Base\Iface $orderBa

try
{
$lastPos = 0;
foreach( $orderBase->getService( 'delivery' ) as $service )
{
$deliveryPrices = $this->addPrice( $deliveryPrices, $service->getPrice() );
Expand All @@ -716,10 +717,12 @@ protected function getOrderDetails( \Aimeos\MShop\Order\Item\Base\Iface $orderBa
$deliveryCosts += $this->getAmount( $priceItem );
}

$values['L_SHIPPINGOPTIONAMOUNT0'] = number_format( $deliveryCosts, 2, '.', '' );
$values['L_SHIPPINGOPTIONLABEL0'] = $service->getCode();
$values['L_SHIPPINGOPTIONNAME0'] = $service->getName();
$values['L_SHIPPINGOPTIONISDEFAULT0'] = 'true';
$values['L_SHIPPINGOPTIONAMOUNT' . $lastPos] = number_format( $deliveryCosts, 2, '.', '' );
$values['L_SHIPPINGOPTIONLABEL' . $lastPos] = $service->getCode();
$values['L_SHIPPINGOPTIONNAME' . $lastPos] = $service->getName();
$values['L_SHIPPINGOPTIONISDEFAULT' . $lastPos] = 'true';

$lastPos++;
}
}
catch( \Exception $e ) { ; } // If no delivery service is available
Expand Down

0 comments on commit 969b926

Please sign in to comment.