-
Magento2 php8.1 extension install
Magento2 php8.1 extension install on magento 2.4.5.p1 open source version. Here using Ubuntu version 20.04 and magento version 2.4.5.p1 and Web server apache If you have already has another PHP version then do below process. At my system php7.4
-
Magento 2 create yes/no product attribute
magento 2 create yes/no product attribute and assigns to all attributes sets. Using Data patch installer. Your module must be a dependency on the Magento_Catalog module using module.xml. Example: Data match installer script:
-
Api search magento using php
Searching with Repositories What is a repository? Repositories give service requestors the ability to perform create, read, update, and delete (CRUD) operations on entities or a list of entities. A repository is an example of a service contract, and its implementation is part of the domain layer. Repository state A repository should be stateless after instantiation. This means that every method call should not rely on previous calls nor should it affect later method calls. Any field contained in the repository class must also be stateless. If your repository needs to provide functionality that requires state, such as for caching, use the registry pattern. A good example that uses this pattern…
-
Magento2 Custom options do not show at Cart
Last week, working on an issue. I was trying to add a product to the cart with a custom option using Rest API. Passing customer option info option_id and options_value to request payload.
-
Category page NOINDEX,NOFOLLOW when filters applied
Category page NOINDEX,NOFOLLOW when filters applied. Most websites are getting duplicated content issues at SEO when filters applied To avoid the issue we need to mark the category page’s meta robots value to `NOINDEX,NOFOLLOW` when the filter is applied on the category page. Defined an observer on event layout_generate_blocks_after The Observer class code will be Module is available at https://github.com/devamitbera/Magento2-extension/tree/master/Category-disallow/
-
Magento2 programmatically create coupon
In this article, i have explaining how to we can create coupon programmatically. At Magento 2, if you wish to create a coupon programatically . Follow below steps: First, you have to create a Cart Price rule/Shopping Cart rule. At, Second steps you will create coupon code. Advanced sales promotion rules like #free-gift, discount on #first-order, #nth-order, #total-sales-amount, #total-order-number #specific-customers #subscribers etc.http://bit.ly/M2-Sales-Promotion 1.Create Cart Price rules For a create rules, i have used repository interface classes: For set the data for rules repository class, we have use the interface This interface some setter methods using this setter method, using those method you can set discount percent/amount ,rules starting & ending…
-
Magento2 Checkout shipping address autofill
Magento2 Checkout shipping address autofill. If you want to Magento2 Checkout shipping address autofill during checkout then you have to use Magento 2 plugin. I have used plugin over on Class below classes for autofill checkout Shipping address: Magento\Checkout\Block\Checkout\AttributeMerger is main classis the main class where i able to auto fill firstname,lastname,street,city,postcode,country_id,region,region_id,telephone,companyabove fields value using after Create after Plugin (Devbera\AutofillCheckoutAddress\Plugin\Magento\Checkout::afterMerge ) on Magento\Checkout\Block\Checkout\AttributeMerger::merge for shipping address fields autofill up. Step1:Define Plugin classes: First Create di.xml at app/code/{VendorName}/{ModuleName}/etc/frontent where we are define the plugin classes. Code Step2: Declare plugin class Create First plugin class AttributeMergerPlugin.php at app/code/{VendorName}/{ModuleName}/Plugin/Magento/Checkout/ Code Second plugin class which will auto fill email id for NON _login customer Create seocnf…
-
New Relic Setup in Server
In this Article , i am sharing you, how you can New Relic Setup in Server . First, i have describe how you can install and setup at New relic at Centos server. Before start install, Please read below articles: https://docs.newrelic.com/docs/agents/php-agent/installation/php-agent-installation-redhat-centos https://foxutech.com/how-to-setup-new-relic-server/ https://www.techbrown.com/configure-new-relic-server-monitoring-centos-7.shtml Please follow below steps for setup the new relic at server. Step1: Add the New Relic Repository to your server. First, you have add new relic package to your server software repository. So, run below command at your server terminal. Step2: Install the New Relic Packages Second, you have to install newrelic package from add repository Step3: Add Lienence Key Step 3: Add Licence Key Now need…
-
Magento2 add a cms page link to menu
Magento2 add a cms page link to menu or add a link to the menu, Magento2 add a cms page link to the menu. If you are store owner/ developer then sometimes, you want to add a cms page link to menu of your Magento 2 store. Magento 2 does not provide any feature like add a Cms page to your existing menu. At default Magento, you can only add the categories to its menu. So, today I am writing this blog for how you add a cms page link to the menu. For this, you need some coding also. If you do not want to wish to do any…
-
magento2 get base url and media url and static url
magento2 get base url and media url and static url magento2 get base url and media url and static url. Whenever you are working on magento2 then a lot of times you need to get base URL and media URL and static url. From this blog, you base url, media url, static content url in Magento2.Magento2 basically, use interface /* This is an interface Class */ Magento\Store\Model\StoreManagerInterface And this class have a function Store() which is provide store data. After that, using getBaseUrl() over Store() you can get base url and also get Media URL. /* Using Direct Object Manager */ $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); /* Get store manager */ $storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface'); // BASE URL $baseUrl = $storeManager->getStore()->getBaseUrl(); // MEDIA URL…