Skip to content

Commit

Permalink
Merge pull request #29 from magmodules/release/1.10.1
Browse files Browse the repository at this point in the history
Release/1.10.1
  • Loading branch information
Marvin-Magmodules authored Jul 31, 2024
2 parents 24acd8f + 39d03e6 commit c3ef702
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
31 changes: 29 additions & 2 deletions Service/WebApi/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use Magento\Customer\Api\CustomerRepositoryInterface as CustomerRepository;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\App\ResourceConnection;
use Magento\GroupedProduct\Model\ResourceModel\Product\Link;
use Magento\Sales\Model\ResourceModel\Order\Collection;
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory;
use Magento\Sales\Model\Order as OrderModel;
Expand Down Expand Up @@ -48,20 +50,28 @@ class Order
* @var CollectionProcessorInterface
*/
private $collectionProcessor;
/**
* @var ResourceConnection
*/
private $resourceConnection;

/**
* Product constructor.
* Order constructor.
* @param CollectionFactory $orderCollectionFactory
* @param CustomerRepository $customerRepository
* @param CollectionProcessorInterface $collectionProcessor
* @param ResourceConnection $resourceConnection
*/
public function __construct(
CollectionFactory $orderCollectionFactory,
CustomerRepository $customerRepository,
CollectionProcessorInterface $collectionProcessor
CollectionProcessorInterface $collectionProcessor,
ResourceConnection $resourceConnection
) {
$this->orderCollectionFactory = $orderCollectionFactory;
$this->customerRepository = $customerRepository;
$this->collectionProcessor = $collectionProcessor;
$this->resourceConnection = $resourceConnection;
}

/**
Expand Down Expand Up @@ -182,6 +192,23 @@ private function getProducts(OrderModel $order): array
$item->getParentItem()->getProductType() == Type::TYPE_BUNDLE) {
$orderedProduct['parent_id'] = $item->getParentItem()->getProductId();
}

if ($item->getProductType() == 'grouped') {
$connection = $this->resourceConnection->getConnection();
$parentProduct = $connection->select()->from(
$this->resourceConnection->getTableName('catalog_product_link'),
['product_id']
)->where(
'link_type_id = ?',
Link::LINK_TYPE_GROUPED
)->where(
'linked_product_id = ?',
$item->getProductId()
);
$orderedProduct['id'] = $connection->fetchOne($parentProduct);
$orderedProduct['variant_id'] = $item->getProductId();
}

$orderedProducts[] = $orderedProduct;
}

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-reloadify",
"description": "Reloadify extension for Magento 2",
"type": "magento2-module",
"version": "1.10.0",
"version": "1.10.1",
"license": [
"BSD-2-Clause"
],
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<default>
<magmodules_reloadify>
<general>
<version>v1.10.0</version>
<version>v1.10.1</version>
<enable>0</enable>
<debug>0</debug>
</general>
Expand Down

0 comments on commit c3ef702

Please sign in to comment.