diff --git a/CHANGELOG.md b/CHANGELOG.md index f73bff5..d1aaee6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### 5.1.5 - 2024/10/28 +* Fix: + - Fix bundle products ### 5.1.4 - 2024/07/18 * Fix: - Fix recovery orders when quote has not a valid shipping address diff --git a/Helper/Data.php b/Helper/Data.php index 875fd40..ec5e837 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -481,6 +481,8 @@ public function getLineItems(array $items, $isQuoteItem = true): array $version = (int)str_replace('.', '', $this->getMageVersion()); $request = []; $quantityMethod = $isQuoteItem ? "getQty" : "getQtyOrdered"; + $processedBundleItems = []; + foreach ($items as $item) { if ($version > 233) { if ($item->getProductType() != 'bundle' && $item->getProductType() != 'configurable') { @@ -490,22 +492,26 @@ public function getLineItems(array $items, $isQuoteItem = true): array $sku = $this->removeSpecialCharacter($item->getSku()); $productId = $item->getProductId(); $productType = $item->getProductType(); - if (! empty($item->getParentItem())) { + if (!empty($item->getParentItem())) { $parent = $item->getParentItem(); if ($parent->getProductType() == 'configurable') { $price = $item->getParentItem()->getPrice(); $qty = (int)$item->getParentItem()->{$quantityMethod}(); } elseif ($parent->getProductType() == 'bundle' && $isQuoteItem) { - //If it is a quote item, then qty of item has not been calculated yet - $qty = $item->getParentItem()->getQty(); - $price = $item->getParentItem()->getPrice(); - $name = $this->removeSpecialCharacter($item->getParentItem()->getName()); - $sku = $this->removeSpecialCharacter($item->getParentItem()->getSku()); - $productId = $item->getParentItem()->getProductId(); - $productType = $item->getParentItem()->getProductType(); - - + // Verificar si el bundle product ya ha sido procesado + if (in_array($parent->getId(), $processedBundleItems)) { + continue; + } + $processedBundleItems[] = $parent->getId(); + + // Si es un quote item, entonces la cantidad del item no ha sido calculada aún + $qty = $parent->getQty(); + $price = $parent->getPrice(); + $name = $this->removeSpecialCharacter($parent->getName()); + $sku = $this->removeSpecialCharacter($parent->getSku()); + $productId = $parent->getProductId(); + $productType = $parent->getProductType(); } } diff --git a/README.md b/README.md index df4a940..b86bfb5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![alt tag](https://conekta.com/static/assets/Home/conekta-logo-blue-full.svg) -Magento 2 Plugin v.5.1.4 (Stable) +Magento 2 Plugin v.5.1.5 (Stable) ======================== Installation for Magento 2.3 @@ -13,7 +13,7 @@ composer config repositories.conekta git https://github.com/conekta/customer-mag 2. Add composer dependency ```bash -composer require conekta/conekta_payments 5.1.4 +composer require conekta/conekta_payments 5.1.5 ``` 3. Update Magento diff --git a/composer.json b/composer.json index 7a3bf25..03c1ac8 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "conekta/conekta-php": "v6.0.8" }, "type": "magento2-module", - "version": "5.1.4", + "version": "5.1.5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index f795e10..0783e17 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -3,7 +3,7 @@
-
Conekta Configuration. (v5.1.4)
]]>
+
Conekta Configuration. (v5.1.5)
]]>
complex conekta-section Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment diff --git a/etc/config.xml b/etc/config.xml index 4c3fcff..2fc66b6 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -100,7 +100,7 @@ - + diff --git a/etc/module.xml b/etc/module.xml index 113fb76..b7444ab 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - +