Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Agata Firlejczyk committed Feb 5, 2020
2 parents 96a3673 + 9780e4f commit c3bcc02
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## [1.10.0] (2020.02.05)

### Fixed
- Fixed `max_sale_qty` getting wrong value when set per-product. [@rain2o](https://github.com/rain2o) ([#201](https://github.com/DivanteLtd/magento2-vsbridge-indexer/issues/201))
- Fixed exporting products for Magento Commerce: Bundle products and Linked products([#202](https://github.com/DivanteLtd/magento2-vsbridge-indexer/pull/202))

## [1.9.0] (2020.01.28)

Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"name": "Agata",
"email": "[email protected]"
}],
"version": "1.9.0",
"keywords": [
"magento",
"magento2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function prepareInventoryData($storeId, array $inventory)
}

if (!empty($inventory[StockItemInterface::USE_CONFIG_MIN_SALE_QTY])) {
$inventory['max_sale_qty'] = $this->stockConfiguration->getMinSaleQty($storeId);
$inventory['min_sale_qty'] = $this->stockConfiguration->getMinSaleQty($storeId);
}

if (!empty($inventory[StockItemInterface::USE_CONFIG_MAX_SALE_QTY])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ private function initOptions($storeId)
/* entity_id or row_id*/
$parentId = $bundleOption['parent_id'];
$parentEntityId = $this->products[$parentId]['entity_id'];

$optionId = $bundleOption['option_id'];

$this->bundleOptionsByProduct[$parentEntityId][$optionId] = [
Expand Down Expand Up @@ -145,13 +144,14 @@ private function initSelection()
$optionId = $selection['option_id'];
/*row_id or entity_id*/
$parentId = $selection['parent_product_id'];
$entityId = $this->products[$parentId]['entity_id'];
$productId = $selection['product_id'];
$bundlePriceType = $this->products[$parentId]['price_type'];

$selectionPriceType = $bundlePriceType ? $selection['selection_price_type'] : null;
$selectionPrice = $bundlePriceType ? $selection['selection_price_value'] : null;

$this->bundleOptionsByProduct[$parentId][$optionId]['product_links'][] = [
$this->bundleOptionsByProduct[$entityId][$optionId]['product_links'][] = [
'id' => (int)$selection['selection_id'],
'is_default' => (bool)$selection['is_default'],
'qty' => (float)$selection['selection_qty'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Divante\VsbridgeIndexerCatalog\Model\ResourceModel\Product;

use Divante\VsbridgeIndexerCatalog\Model\Product\LinkTypeMapper;
use Divante\VsbridgeIndexerCatalog\Model\ProductMetaData;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\DB\Select;

Expand Down Expand Up @@ -43,18 +44,26 @@ class Links
*/
private $positionAttribute;

/**
* @var ProductMetaData
*/
private $productMetaData;

/**
* Links constructor.
*
* @param ProductMetaData $productMetaData
* @param LinkTypeMapper $linkTypeMapper
* @param ResourceConnection $resourceConnection
*/
public function __construct(
ProductMetaData $productMetaData,
LinkTypeMapper $linkTypeMapper,
ResourceConnection $resourceConnection
) {
$this->linkTypeMapper = $linkTypeMapper;
$this->resource = $resourceConnection;
$this->productMetaData = $productMetaData;
}

/**
Expand All @@ -73,7 +82,11 @@ public function clear()
*/
public function setProducts(array $products)
{
$this->products = $products;
$linkField = $this->productMetaData->get()->getLinkField();

foreach ($products as $product) {
$this->products[$product[$linkField]] = $product;
}
}

/**
Expand Down Expand Up @@ -133,8 +146,9 @@ private function getAllLinkedProducts()

foreach ($links as $link) {
$productId = $link['product_id'];
$entityId = $this->products[$productId]['entity_id'];
unset($link['product_id']);
$groupByProduct[$productId][] = $link;
$groupByProduct[$entityId][] = $link;
}

$this->links = $groupByProduct;
Expand Down

0 comments on commit c3bcc02

Please sign in to comment.