New answers tagged

1

There are many solutions to this problem, Joao71's solution is simple to write and should do the trick. In terms of best practice, preference are to be used if plugin is not possible. The reason is because if 2 modules do use the same preference, only one in the system will be eventually be used (we call this a conflict) and that is what plugin resolves. ...


2

In your module di.xml (app\code\vender\module\etc\di.xml) place this line <preference for="Magento\Catalog\Model\ResourceModel\Category" type="Vendor\Module\Model\Category"/> Create the file Vendor\Module\Model\Category.php and place this code in it: <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING....


0

You can create an observer for this and set page limit dynamic according to your requirement <event name="catalog_block_product_list_collection"> <observer name="vendor_module_product_list_collection" instance="vendor\Module\Observer\ListCollectionObserver" /> </event> And below are the ...


1

The pagination limit are retrieved using function getAvailableLimit in class Magento\catalog\Block\Product\ProductList\Toolbar. You can use plugin to define your custom limits for pagination. etc/frontend/di.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/...


0

Fixed the issue. It was due to missing etc/view.xml in my theme


0

You have error in your request parameters It should be- request body: {"parent_id":0, "afterId":0}


2

It's possible that single product will assign in multiple categories. So, you can get category level using this below way : /** * @var \Magento\Catalog\Model\ProductFactory */ protected $productFactory; /** * @var \Magento\Catalog\Model\CategoryRepository */ protected $categoryRepository; /** * @param \Magento\Catalog\Model\ProductFactory $...


0

Look at the links I think that's one step behind the associated product collection and doesnt load the products Magento\Catalog\Model\ResourceModel\Product\Link function getChildrenIds($parentId, $typeId) and I think the typeId for related is 3, but check. Note that this does not do checks for available on site, enabled/disabled etc which is part of its ...


0

I have setup my local environment with a french store and an english store, then using luma sample data, I have changed 2 things for my categories: the category name and the url key need to be changed (see screenshot). You need to select the french store view and untick the checkbox 'use default value'. to verify if it works, go to the french view and load ...


1

Magento 2 programmatically Category Multiselect Attributes Create Step -1 Create File App\Code\Vendor\Extension\Setup\InstallData.php <?php namespace Vendor\Extension\Setup; use Magento\Eav\Setup\EavSetup; use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use ...


0

i install the extension but magento 2 give me this error: There has been an error processing your request Exception printing is disabled by default for security reasons. Error log record number: 7d632992b9971963b37fc5f9424f7b96d3334e9c70c018c26ef78291d7395f7b Why?


0

Hi I have tried to edit directly in database like below and I have achieved what I want based on Disable All Children of Disabled Category for Store View UPDATE catalog_category_entity_int SET value = '0' WHERE entity_id IN ({{add category id's by comma separate }}) AND attribute_id=(SELECT attribute_id FROM eav_attribute WHERE attribute_code = "...


0

This can also happen if your search engine is set to elastic search and it has a problem. Try to set your search engine to MySQL: Shops -> Settings: Configuration -> Catalog -> Catalog -> Catalogsearch -> Searchmachine: MySQL Then start reindexing: php bin/magento indexer:reindex


0

Your code is great as it is, especially for a new contributor. I have spotted 2 issues and a possible improvement in the layout/template. Using ViewModel does allow to delegate the logic from your template to a singleton model whereas Block are much heavier and coupled with Magento core (even reusing a core Magento block is not necessarily a best option) ...


0

I have found api belowed: http://www.domain.com/rest/V1/categories?rootCategoryId=3 With this you can give any parent category id to parameter : rootCategoryId And can get response like: stdClass Object ( [id] => 3 [parent_id] => 2 [name] => [is_active] => [position] => 1 [level] => 2 [product_count] => ...


0

Your collection is correct, just need to add ->getId() function after $this->_storeManager->getStore(). As the category collection setStore function support storeId not store object. $collection = $this->_categoryCollectionFactory->create(); $collection->addAttributeToFilter('featured_category', 1) ->addFieldToFilter('is_active',...


1

Give a try on the below one http://www.domain.com/rest/V1/categories/list?searchCriteria[filterGroups][0][filters][0][field]=parent_id&searchCriteria[filterGroups][0][filters][0][value]=3&searchCriteria[filterGroups][0][filters][0][conditionType]=eq field will be field name(parent_id) value will be parent category id(3) conditionType will be an ...


0

You could try adding and/or overriding containers and blocks from the catalog_category_view.xml file which is located at: vendor\magento\module-catalog\view\frontend\layout\catalog_category_view.xml To add custom attributes, you might want to look to put a block before category.products in a custom phtml file. Example: <?xml version="1.0"?> &...


0

I FOUND SOLUTION! I hope it can help someone: Copy and paste this code in app/design/frontend/ParentTheme/YourTheme/Magento_Catalog/layout/catalog_category_view.xml (After category.product.type.details.renderers block) <block class="Magento\Swatches\Block\Product\Renderer\Listing\Configurable" name="category.product.type.details....


1

In your db eav_attribute table search your attrtibute and set user_defined = true and than run following command php bin/magento indexer:reindex


0

You can change the category page layout from admin in the Magento 2. Check this link it will help you. For Ex:- One category select 3 columns Output And last one category select 2 columns with right bar Output Hope this help you Thanks ...


Top 50 recent answers are included