New answers tagged

0

As the nesting level of the categories is limited, an approach with joins can be taken. Otherwise, a CTE would be a better approach. My suggestion is based on the product category association. For each category, the parent is joined and the parent of the parent. The select gets the name of the category depending on the nesting level of the association. ...


0

maybe you should try to do it in a different way. I've recently upgraded my store to the 2.3 version with the help of Cart2Cart. It's an automated service. The overall impression is pretty good - they did the job quickly and I'm satisfied with the result. And, most importantly, I wasn't even involved in the process - just configured the migration at the very ...


0

I want select all child categories of category by one-click. For example, if I have 100 child categories, I have to click 100 times. I want to select them with one click.


1

For getting product details from url key using ObjectManager: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $prodColl = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection'); $collection = $prodColl->addAttributeToSelect('*') ->addAttributeToFilter('url_key','joust-duffle-bag'...


1

You need to create a simple module, say Rave_MoveOutOfStock: app/etc/modules/Rave_MoveOutOfStock.xml <?xml version="1.0"?> <config> <modules> <Rave_MoveOutOfStock> <active>true</active> <codePool>local</codePool> <depends> <Mage_Catalog/> </depends> ...


0

please check this solution for out of stock product last display : https://stackoverflow.com/questions/15879978/magento-out-of-stock-products-showing-last-in-the-category-page


0

You should disable the module Infortis/Cgen. Is it work?


1

$urlKey = "strive-shoulder-pack"; // add your url key which you want $productCollectionFactory = $objectManager->get('\Magento\Catalog\Model\ResourceModel\Product\Collection'); $productCollectionFactory->addAttributeToFilter('url_key',$urlKey); $productCollectionFactory->addAttributeToSelect('*'); foreach ($productCollectionFactory as $product) ...


0

Solution: $childProducts = $_product->getTypeInstance()->getUsedProducts($_product); foreach ($childProducts as $child) { $blockObj = $block->getLayout()->createBlock('Vendor\Module\Block\Product'); if ($blockObj->getStock($child) == 0) { ...


0

Already a similar code is implemented in catalog import module. You can explore the class Magento\CatalogImportExport\Model\Import\Product\CategoryProcessor to learn more about it. Here is my custom code which gives the category id from fully specified category path Default Category/Men/Sale/Activewear. <?php namespace Vendor\Module\Model; class ...


0

Everything was OK!!! The controller wasn't being overridden because another extension (Amasty_Shopby in my case) is also overriding it! So, I applied the following modification to my config.xml: AraujoPhillips/SpecialCategories/etc/config.xml <config> <modules> <AraujoPhillips_SpecialCategories> <version>0....


0

First WAY 1: Magento 2 get category id by category name Add the below code to your construct public function __construct( ... \Magento\Catalog\Model\CategoryFactory $categoryFactory ) { $this->_categoryFactory = $categoryFactory; ... } Add below code anywhere in class and get category id using category name. $categoryTitle = 'Men'; $...


0

You can use my extension: https://github.com/olegkoval/magento2-regenerate_url_rewrites It regenerate Url Rewrites for products and for categories.


0

You should be focusing on rewrites not routers and controllers. Also, there’s an option in the store configurations to add category paths to URLs.


0

Please try below code on your phtml file. $product_id = '1'; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->create('Magento\Catalog\Model\Product')->load($product_id); $relatedProducts = $product->getRelatedProducts(); //var_dump($relatedProducts); if (!empty($relatedProducts)) { echo '...


1

I've learned that changes in "catalog_category_view_type_default_without_children.xml" apply to categories that have the "anchor" setting turned off in the CMS.


0

Product title (product name) in product detail page define in vendor\magento\module-catalog\view\frontend\layout\catalog_product_view.xml <referenceBlock name="page.main.title"> <arguments> <argument name="css_class" xsi:type="string">product</argument> <argument name="...


3

it will not help in a performance boost in the latest version with Magento plus Magento no longer recommend use flat catalog option for more info https://docs.magento.com/m2/ce/user_guide/catalog/catalog-flat.html


0

I think you have over ride following files. vendor/magento/module-catalog/view/frontend/layout/catalog_category_view.xml In your theme like below app/design/frontend/mytheme/theme/Magento_Catalog/layout/catalog_category_view.xml


0

Go to Catalog -> Categories -> Select any category Now click on Scope:All Store Views You can find many stores here. Now save it one by one.


0

Please avoid use of ObjectManager protected $_storeManager; protected $_categoryNameFactory; public function __construct( ........................................... \Magento\Catalog\Model\CategoryFactory $categoryNameFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, ........................................... ) { ......


0

Please try following code $categoryId = 185 $categoryFactory = $objectManager->get('\Magento\Catalog\Model\CategoryFactory'); $categoryData = $categoryFactory->create()->load($categoryId); $getCategoryTitle1 = $categoryData->getData('keyfeature_1'); hope this will help you


0

Add a UpgradeData.php in the below path /app/code/<Vendor_name>/<Module_name>/Setup/UpgradeData.php Add below code of category attributes <?php /** * Copyright © 2020 Devi mage. All rights reserved. */ namespace Devi\Mage\Setup; use Magento\Framework\Module\Setup\Migration; use Magento\Framework\Setup\UpgradeDataInterface; use Magento\...


0

For that you have to first override view/adminhtml/ui_component/category_form.xml in your custom module. Inside your category_form.xml you have to add your code. You can create section using below code (<fieldset></fieldset>). <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:...


0

Two steps to create the category attribute, Add an InstallData.php in the below path app/code/vendor/ModuleName/Setup/InstallData.php then add the below code to it <?php namespace Vendor\ModuleName\Setup; use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use ...


0

Try to extend Magento\Catalog\Model\Category\DataProvider. Example : <?php namespace Your\Namespace; use Magento\Catalog\Model\Category\DataProvider as CategoryDataProvider; class DataProvider extends CategoryDataProvider { /** * Display "Use Default Value" checkbox * * @return array */ protected function getFieldsMap() ...


2

I think you forgot to add the "SCOPE_STORE" while creating the custom category attribute. You must need to add the \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE For the global variable Check the below code. $eavSetup->addAttribute( \Magento\Catalog\Model\Category::ENTITY, 'cat_short_description', [ '...


0

This is my debug after the error. I don't find what's wrong. And..i dont have a file GroupedProduct/view/adminhtml/ui_component/category_form.xml [2020-03-11 08:02:45] main.DEBUG: Request validation failed for action "Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor" [] [] [2020-03-11 08:02:56] main.DEBUG: cache_invalidate: {"method":"POST","...


0

firstly don't use objectManager you can inject the used class in the construct: public function __construct(\Magento\Catalog\Model\ProductFactory $productFactory) { $this->productFactory = $productFactory; } And after that in your class use loadByAttribute function $product = $this->productFactory->create(); $product->loadByAttribute('...


Top 50 recent answers are included