New answers tagged

0

Since this attribute will not visible on frontend, you can change it's type to any other type. The solution to this issue is you need to create attribute with type "Price" instead of "Text Field". You cannot change attribute type after creating attribute, so in order to do that follow this instruction Delete old attirbute, i.e, ...


0

For newest use $this->_collection->getSelect()->order('e.created_at DESC'); insted of $this->_collection->setOrder('e.created_at', 'desc'); It is working with Magento 2.4.X


0

you could use this repo to have full breadcrumb on PDP https://github.com/studioraz/magento2-breadcrumb


0

This behavior is clearly the 'work' of a customization somewhere, so I would advise checking your custom code and 3rd party integration and see which one causes this issue. By default, you should be able to add as many root categories as you want in the admin panel. Ref: https://docs.magento.com/user-guide/catalog/category-root.html


0

If using Magento 2.3.4 + you can create specific layout update for that category as defined here: https://magento.stackexchange.com/a/303941 and can use cacheable=false in your block in definition or blocks which you do not want to be cached.


0

@Mike Tim Turner any idea how to get your solution to work in Magento 2.4.2?


1

You can choose to create a custom module to help you with custom sorting. https://github.com/bogdanpisica/Magento2-ProductSort Here is an example of the custom sorting mode, you can use it


0

Add New Function use Magento\Catalog\Model\Product\Visibility; use Magento\Catalog\Model\Product\Attribute\Source\Status; public function isCategoryHasProducts($category) { $collection = $category->getProductCollection(); $collection->setVisibility(array(Visibility::VISIBILITY_BOTH, Visibility::VISIBILITY_IN_CATALOG)); $...


0

By default, Magento 2 shows the most viewed product in Magento Admin > Dashboard > choose tab Most Viewed Products. The _prepareCollection() method in vendor/magento/module-backend/Block/Dashboard/Tab/Products/Viewed.php is used for selecting products. you can use that same code. You can added category condition here if you want. class Index extends \...


0

Delete the Specfic category on magetnto 2 from this script <?php use Magento\Framework\App\Bootstrap; include('./app/bootstrap.php'); $bootstrap = Bootstrap::create(BP, $_SERVER); $objectManager = Magento\Framework\App\ObjectManager::getInstance(); deleteAllCategories($objectManager); function deleteAllCategories($objectManager) { $categoryFactory = $...


0

Not a solutions, but it's a place to start. I think there is an inconsistency in the category repository between get and save. I suspect that you load the category with the store view scope 0 (admin) but save it with the store scope 1. So the get method accepts a parameter with the store id, as your last piece of code. But the save method completely ignores ...


0

I've got an alternate way of going about this. Its requires more complicated code, but doesn't require replacing a whole class through dependency injection, so swings and roundabouts. I hope that a different perspective may help people in other situations, but the approach from Sohel Rana seems pretty good. First, the extra column can be targeted through a ...


Top 50 recent answers are included