Skip to content

Commit

Permalink
Merge pull request #127 from magmodules/1.5.4
Browse files Browse the repository at this point in the history
1.5.4
  • Loading branch information
Marvin-Magmodules authored Sep 14, 2021
2 parents 7efe269 + 45988ef commit a98516e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
22 changes: 10 additions & 12 deletions Helper/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -897,9 +897,9 @@ public function getPriceCollection($config, $product)
break;
default:
if (floatval($product->getFinalPrice()) !== 0) {
$price = $this->processPrice($product, $product->getPrice(), $config);
$finalPrice = $this->processPrice($product, $product->getFinalPrice(), $config);
$specialPrice = $this->processPrice($product, $product->getSpecialPrice(), $config);
$price = $product->getPrice();
$finalPrice = $product->getFinalPrice();
$specialPrice = $product->getSpecialPrice();
} else {
$finalPrice = $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue();
$price = $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue();
Expand All @@ -920,7 +920,6 @@ public function getPriceCollection($config, $product)

break;
}

$prices = [];
$config = $config['price_config'];
$prices[$config['price']] = $this->processPrice($product, $price, $config);
Expand Down Expand Up @@ -1022,12 +1021,11 @@ public function getGroupedPrices($product, $config)
*/
public function processPrice($product, $price, $config)
{
if (!empty($config['price_config']['exchange_rate'])) {
$price = $price * $config['price_config']['exchange_rate'];
if (!empty($config['exchange_rate'])) {
$price = $price * $config['exchange_rate'];
}

if (isset($config['price_config']['incl_vat'])) {
$price = $this->catalogHelper->getTaxPrice($product, $price, $config['price_config']['incl_vat']);
if (isset($config['incl_vat'])) {
$price = $this->catalogHelper->getTaxPrice($product, $price, ['incl_vat']);
}

return $this->formatPrice($price, $config);
Expand All @@ -1041,10 +1039,10 @@ public function processPrice($product, $price, $config)
*/
public function formatPrice($price, $config)
{
$decimal = isset($config['price_config']['decimal_point']) ? $config['price_config']['decimal_point'] : '.';
$decimal = isset($config['decimal_point']) ? $config['decimal_point'] : '.';
$price = number_format(floatval(str_replace(',', '.', $price)), 2, $decimal, '');
if (!empty($config['price_config']['use_currency']) && ($price >= 0)) {
$price .= ' ' . $config['price_config']['currency'];
if (!empty($config['use_currency']) && ($price >= 0)) {
$price .= ' ' . $config['currency'];
}
return $price;
}
Expand Down
11 changes: 6 additions & 5 deletions Model/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ private function setCustomerCart($cart, $store, $data)
$customerId = $customer->getId();
}
$customer = $this->customerRepository->getById($customerId);
$cart->assignCustomer($customer);
$cart->setCustomerIsGuest(false)->assignCustomer($customer);
} else {
$customerId = 0;
$cart->setCustomerId($customerId)
Expand Down Expand Up @@ -522,6 +522,8 @@ private function getShippingDescription($order, $data)
/**
* @param OrderModel $order
* @param array $data
*
* @throws \Magento\Framework\Exception\LocalizedException
*/
private function addPaymentData($order, $data)
{
Expand All @@ -536,10 +538,9 @@ private function addPaymentData($order, $data)
$order->setChannelId($data['channel_id']);
}

if (!empty($data['price']['commission'])) {
$commission = $data['price']['currency'] . ' ' . $data['price']['commission'];
$payment->setAdditionalInformation('commission', $commission);
}
$commissionValue = isset($data['price']['commission']) ? $data['price']['commission'] : 0;
$commission = $data['price']['currency'] . ' ' . $commissionValue;
$payment->setAdditionalInformation('commission', $commission);

if (!empty($data['channel_name'])) {
if ($this->lvb) {
Expand Down
2 changes: 1 addition & 1 deletion Service/Order/AddressData.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private function saveAddress($addressData, $customerId, $type)
->setFirstname($addressData['firstname'])
->setMiddlename($addressData['middlename'])
->setLastname($addressData['lastname'])
->setStreet($addressData['street'])
->setStreet(explode("\n", $addressData['street']))
->setCity($addressData['city'])
->setCountryId($addressData['country_id'])
->setRegionId($addressData['region'])
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magmodules/magento2-channable",
"description": "Channable integration for Magento 2",
"type": "magento2-module",
"version": "1.5.3",
"version": "1.5.4",
"license": "BSD-2-Clause",
"homepage": "https://github.com/magmodules/magento2-channable",
"require": {
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<general>
<enable>0</enable>
<limit>250</limit>
<version>v1.5.3</version>
<version>v1.5.4</version>
</general>
<data>
<name_attribute>name</name_attribute>
Expand Down

0 comments on commit a98516e

Please sign in to comment.