Entries by admin

Exclude a category id from category collection in Magento

Please use the below code for exclude a category id from category collection in Magento <?php $allCategories = Mage::getModel(‘catalog/category’) ->getCollection() ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘level’,2) ->addAttributeToFilter(‘entity_id’, array(‘nin’ => 69)) ->addIsActiveFilter(); ?>

Get Categories and Its Sub Categories in Magento

Get Categories and Its Sub Categories in Magento: To retrieve categories and their subcategories in Magento, you can use Magento’s built-in repository classes and helper functions. Using the Magento\Catalog\Model\CategoryRepository and Magento\Catalog\Model\ResourceModel\Category\CollectionFactory, you can efficiently fetch category data, including subcategories, in a structured way. Here’s a basic approach: use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory; use Magento\Framework\App\State; class CategoryHelper { protected […]

How to Remove SID query from Magento URLs

We will apply the site redirects technique for this issue . While working on the SEO someone can place a wrong link to some forum or blog. We don’t want those links to lead to improper URL and we don’t want SIDs to appear to those visitors. Most important: We don’t want that search engines index the […]

How to Remove SID (SESSION_ID) from URL in Magento 2

First of all we have know about SID (SESSION_ID) in magento2: The SID is a “session ID”. Magento uses this to track a user’s activity within the same Magento installation. Normally, Magento powers one website and one store from one installation (database). Magento could power multiple websites with multiple stores from one installation though. The SID […]

How to get Magento low stock report

How to get Magento low stock report: In magento admin panel Go to System->Configuration->Inventoty->Product Stock Options and set Notify for Quantity Below to the required value. Now when you generate low stock report all the products having the quantity below Notify for Quantity Below value wil be dispalyed.

How to hide Discount code in Magento 2

How to hide Discount code in Magento 2 Here is the info how you can get rid off Discount code from cart page and payment page. Add below css code and it will hide discount code from the pages. For cart page : .checkout-cart-index .cart-discount {display: none;} For payment page : .checkout-index-index .payment-option._collapsible.opc-payment-additional.discount-code { display: […]

How to remove header links in Magento 2

How to remove header links in Magento 2 Please follow the below instructions : Step 1 :- Go to app/design/frontend/VenderName/ThemeName/Magento_Theme/layout/default.xml Step 2 :- Copy below Code <referenceBlock name=”wish-list-link” remove=”true”/> <referenceBlock name=”catalog.compare.link” remove=”true”/> Step 3 :- Paste this code in default.xml before body tag () and save it. It will remove the links from the header

How to remove compare link on Magento2 header

How to remove compare link on Magento2 header To remove the compare link from the header in Magento 2, you can follow these steps: First, create a custom module if you haven’t already. Inside your module, create a di.xml file under app/code/[Vendor]/[Module]/etc/frontend/ and use the Magento\Catalog\Block\Product\Compare\Link block class to remove the compare link. You can […]

How to Change Magento 2 Favicon

Today I will show you how you can change favicon on magento2 site. Follow the below steps : 1- go to Content -> Design -> Configuration 2- Click on HTML Head settings tab 3- Upload your favicon and save configuration. 4- Refresh the Cache