Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace SampleModuleBlockAdminhtmlCategoryTree;
- use MagentoCatalogModelResourceModelCategoryCollection;
- use MagentoFrameworkDataTreeNode;
- use MagentoStoreModelStoreManagerInterface;
- /**
- * Category container block
- */
- class Supplier extends MagentoFrameworkViewElementTemplate
- {
- /**
- * Category Map collection
- *
- * @var SampleModuleModelResourceCategoryMapCollectionFactory
- */
- protected $_categoryMapCollectionFactory;
- /**
- * @var StoreManagerInterface
- */
- protected $_storeManager;
- /**
- * @param MagentoBackendBlockTemplateContext $context
- * @param SampleModuleModelResourceCategoryMapCollectionFactory $categoryMapCollectionFactory
- * @param StoreManagerInterface $storeManager
- * @param array $data
- */
- public function __construct(
- MagentoBackendBlockTemplateContext $context,
- SampleModuleModelResourceCategoryMapCollectionFactory $categoryMapCollectionFactory,
- StoreManagerInterface $storeManager,
- array $data = []
- ) {
- $this->_categoryMapCollectionFactory = $categoryMapCollectionFactory;
- $this->_storeManager = $storeManager;
- parent::__construct($context, $data);
- }
- /**
- * @param int $categoryId
- *
- * @return SampleModuleModelResourceCategoryMapCollection
- */
- protected function getMapsForCategory($categoryId)
- {
- $categoryMapCollection = $this->_categoryMapCollectionFactory->create();
- $storeId = $this->_storeManager->getStore()->getId();
- $categoryMapCollection
- ->addFilter('integrastore_category_id', $categoryId)
- ->addFilter('shop_id', $storeId)
- ->load();
- return $categoryMapCollection;
- }
- }
- class CurrentStore
- {
- public function __construct(
- MagentoFrameworkAppRequestHttp $request,
- //...
- ) {
- $websiteId = (int) $request->getParam('website', 0);
- // ...
- }
- }
Add Comment
Please, Sign In to add comment