Skip to content

Commit 8fd6939

Browse files
Merge pull request #230 from magmodules/release/1.19.0
Release/1.19.0
2 parents 17d25af + 3e9da60 commit 8fd6939

File tree

8 files changed

+170
-161
lines changed

8 files changed

+170
-161
lines changed

Helper/Category.php

Lines changed: 0 additions & 125 deletions
This file was deleted.

Helper/Source.php

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Magento\Framework\App\Helper\Context;
1111
use Magento\Framework\Exception\NoSuchEntityException;
1212
use Magento\Store\Model\StoreManagerInterface;
13-
use Magento\Catalog\Model\Product\Visibility;
1413
use Magento\Framework\Exception\LocalizedException;
1514
use Magmodules\Channable\Service\Product\InventorySource;
1615

@@ -87,10 +86,6 @@ class Source extends AbstractHelper
8786
* @var Item
8887
*/
8988
private $itemHelper;
90-
/**
91-
* @var Category
92-
*/
93-
private $categoryHelper;
9489
/**
9590
* @var StoreManagerInterface
9691
*/
@@ -104,30 +99,17 @@ class Source extends AbstractHelper
10499
*/
105100
private $storeId = null;
106101

107-
/**
108-
* Source constructor.
109-
*
110-
* @param Context $context
111-
* @param StoreManagerInterface $storeManager
112-
* @param General $generalHelper
113-
* @param Category $categoryHelper
114-
* @param Product $productHelper
115-
* @param InventorySource $inventorySource
116-
* @param Item $itemHelper
117-
*/
118102
public function __construct(
119103
Context $context,
120104
StoreManagerInterface $storeManager,
121105
General $generalHelper,
122-
Category $categoryHelper,
123106
Product $productHelper,
124107
InventorySource $inventorySource,
125108
Item $itemHelper
126109
) {
127110
$this->generalHelper = $generalHelper;
128111
$this->productHelper = $productHelper;
129112
$this->itemHelper = $itemHelper;
130-
$this->categoryHelper = $categoryHelper;
131113
$this->storeManager = $storeManager;
132114
$this->inventorySource = $inventorySource;
133115
parent::__construct($context);
@@ -163,12 +145,6 @@ public function getConfig(int $storeId, ?string $type = 'feed', ?string $currenc
163145
$config += [
164146
'base_url' => $this->storeManager->getStore()->getBaseUrl(),
165147
'weight_unit' => ' ' . $this->getStoreValue(self::XPATH_WEIGHT_UNIT),
166-
'categories' => $this->categoryHelper->getCollection(
167-
$storeId,
168-
'',
169-
'',
170-
'channable_cat_disable_export'
171-
),
172148
'item_updates' => $this->itemHelper->isEnabled($storeId),
173149
'delivery' => $this->getStoreValue(self::XPATH_DELIVERY_TIME)
174150
];
@@ -631,6 +607,7 @@ public function getAttributes($type, $filters = [], $storeId = null)
631607
$attributes['item_group_id'] = [
632608
'label' => 'item_group_id',
633609
'source' => $attributes['id']['source'],
610+
'parent_selection_disabled' => 1,
634611
'parent' => 2
635612
];
636613
$attributes['is_bundle'] = [
@@ -857,7 +834,8 @@ public function getCategoryData($product, $parent, $categories)
857834
$path[] = [
858835
'level' => $category['level'],
859836
'id' => $catId,
860-
'path' => implode(' > ', $category['path'])
837+
'path' => $category['path'],
838+
'url' => $category['url'],
861839
];
862840
}
863841
}

Model/Generate.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@
1818
use Magmodules\Channable\Model\Collection\Products as ProductsModel;
1919
use Magmodules\Channable\Model\Item as ItemModel;
2020
use Magmodules\Channable\Service\Product\TierPriceData;
21+
use Magmodules\Channable\Service\Category\CategoryData;
2122

2223
class Generate
2324
{
2425

25-
public const XPATH_FEED_RESULT = 'magmodules_channable/feeds/results';
26-
public const XPATH_GENERATE = 'magmodules_channable/generate/enable';
27-
2826
/**
2927
* @var ProductsModel
3028
*/
@@ -53,6 +51,12 @@ class Generate
5351
* @var TierPriceData
5452
*/
5553
private $tierPriceData;
54+
55+
/**
56+
* @var CategoryData
57+
*/
58+
private $categoryData;
59+
5660
/**
5761
* @var Emulation
5862
*/
@@ -68,6 +72,7 @@ class Generate
6872
* @param GeneralHelper $generalHelper
6973
* @param FeedHelper $feedHelper
7074
* @param TierPriceData $tierPriceData
75+
* @param CategoryData $categoryData
7176
* @param Emulation $appEmulation
7277
*/
7378
public function __construct(
@@ -78,6 +83,7 @@ public function __construct(
7883
GeneralHelper $generalHelper,
7984
FeedHelper $feedHelper,
8085
TierPriceData $tierPriceData,
86+
CategoryData $categoryData,
8187
Emulation $appEmulation
8288
) {
8389
$this->productModel = $productModel;
@@ -87,6 +93,7 @@ public function __construct(
8793
$this->generalHelper = $generalHelper;
8894
$this->feedHelper = $feedHelper;
8995
$this->tierPriceData = $tierPriceData;
96+
$this->categoryData = $categoryData;
9097
$this->appEmulation = $appEmulation;
9198
}
9299

@@ -130,6 +137,7 @@ public function generateByStore(
130137
$parents = $this->productModel->getParents($parentRelations, $config);
131138

132139
$this->prefetchData($products, $parents, $config);
140+
$config['categories'] = $this->categoryData->load($products, $parents, $storeId);
133141

134142
foreach ($products as $product) {
135143
/** @var Product $product */

0 commit comments

Comments
 (0)