Skip to content

Commit

Permalink
Merge pull request #230 from magmodules/release/1.19.0
Browse files Browse the repository at this point in the history
Release/1.19.0
  • Loading branch information
Marvin-Magmodules authored Jul 24, 2024
2 parents 17d25af + 3e9da60 commit 8fd6939
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 161 deletions.
125 changes: 0 additions & 125 deletions Helper/Category.php

This file was deleted.

28 changes: 3 additions & 25 deletions Helper/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Magento\Framework\App\Helper\Context;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Catalog\Model\Product\Visibility;
use Magento\Framework\Exception\LocalizedException;
use Magmodules\Channable\Service\Product\InventorySource;

Expand Down Expand Up @@ -87,10 +86,6 @@ class Source extends AbstractHelper
* @var Item
*/
private $itemHelper;
/**
* @var Category
*/
private $categoryHelper;
/**
* @var StoreManagerInterface
*/
Expand All @@ -104,30 +99,17 @@ class Source extends AbstractHelper
*/
private $storeId = null;

/**
* Source constructor.
*
* @param Context $context
* @param StoreManagerInterface $storeManager
* @param General $generalHelper
* @param Category $categoryHelper
* @param Product $productHelper
* @param InventorySource $inventorySource
* @param Item $itemHelper
*/
public function __construct(
Context $context,
StoreManagerInterface $storeManager,
General $generalHelper,
Category $categoryHelper,
Product $productHelper,
InventorySource $inventorySource,
Item $itemHelper
) {
$this->generalHelper = $generalHelper;
$this->productHelper = $productHelper;
$this->itemHelper = $itemHelper;
$this->categoryHelper = $categoryHelper;
$this->storeManager = $storeManager;
$this->inventorySource = $inventorySource;
parent::__construct($context);
Expand Down Expand Up @@ -163,12 +145,6 @@ public function getConfig(int $storeId, ?string $type = 'feed', ?string $currenc
$config += [
'base_url' => $this->storeManager->getStore()->getBaseUrl(),
'weight_unit' => ' ' . $this->getStoreValue(self::XPATH_WEIGHT_UNIT),
'categories' => $this->categoryHelper->getCollection(
$storeId,
'',
'',
'channable_cat_disable_export'
),
'item_updates' => $this->itemHelper->isEnabled($storeId),
'delivery' => $this->getStoreValue(self::XPATH_DELIVERY_TIME)
];
Expand Down Expand Up @@ -631,6 +607,7 @@ public function getAttributes($type, $filters = [], $storeId = null)
$attributes['item_group_id'] = [
'label' => 'item_group_id',
'source' => $attributes['id']['source'],
'parent_selection_disabled' => 1,
'parent' => 2
];
$attributes['is_bundle'] = [
Expand Down Expand Up @@ -857,7 +834,8 @@ public function getCategoryData($product, $parent, $categories)
$path[] = [
'level' => $category['level'],
'id' => $catId,
'path' => implode(' > ', $category['path'])
'path' => $category['path'],
'url' => $category['url'],
];
}
}
Expand Down
14 changes: 11 additions & 3 deletions Model/Generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
use Magmodules\Channable\Model\Collection\Products as ProductsModel;
use Magmodules\Channable\Model\Item as ItemModel;
use Magmodules\Channable\Service\Product\TierPriceData;
use Magmodules\Channable\Service\Category\CategoryData;

class Generate
{

public const XPATH_FEED_RESULT = 'magmodules_channable/feeds/results';
public const XPATH_GENERATE = 'magmodules_channable/generate/enable';

/**
* @var ProductsModel
*/
Expand Down Expand Up @@ -53,6 +51,12 @@ class Generate
* @var TierPriceData
*/
private $tierPriceData;

/**
* @var CategoryData
*/
private $categoryData;

/**
* @var Emulation
*/
Expand All @@ -68,6 +72,7 @@ class Generate
* @param GeneralHelper $generalHelper
* @param FeedHelper $feedHelper
* @param TierPriceData $tierPriceData
* @param CategoryData $categoryData
* @param Emulation $appEmulation
*/
public function __construct(
Expand All @@ -78,6 +83,7 @@ public function __construct(
GeneralHelper $generalHelper,
FeedHelper $feedHelper,
TierPriceData $tierPriceData,
CategoryData $categoryData,
Emulation $appEmulation
) {
$this->productModel = $productModel;
Expand All @@ -87,6 +93,7 @@ public function __construct(
$this->generalHelper = $generalHelper;
$this->feedHelper = $feedHelper;
$this->tierPriceData = $tierPriceData;
$this->categoryData = $categoryData;
$this->appEmulation = $appEmulation;
}

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

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

foreach ($products as $product) {
/** @var Product $product */
Expand Down
Loading

0 comments on commit 8fd6939

Please sign in to comment.