I have attached screenshot, I want to add default values in position, for example when I add product in category position should show 100. Thanks in advance
1 Answer
I have set my default position for products to 100 by using this patch. This sets it to 100 when a product is added to a new category.
@package magento/module-catalog
diff --git a/Controller/Adminhtml/Product/Initialization/Helper.php b/Controller/Adminhtml/Product/Initialization/Helper.php
--- a/Controller/Adminhtml/Product/Initialization/Helper.php
+++ b/Controller/Adminhtml/Product/Initialization/Helper.php (date 1666682384544)
@@ -513,7 +513,7 @@
$categoryLink = $categoryLinks[$categoryId] ??
$this->categoryLinkFactory->create()
->setCategoryId($categoryId)
- ->setPosition(0);
+ ->setPosition(100);
$newCategoryLinks[] = $categoryLink;
}
-
Thanks, but I had done this I was overriden some magento core functionalities. Oct 25, 2022 at 10:36