-
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…
-
Magento 2 import email address to Newsletter from csv
Magento 2 import email address to Newsletter from csv. I have a requirement to import email is from CSV and import the email ids to Newsletter Subscriber list from csv. Write a PHP script which will import Newsletter subscriber from CSV. In this script, first i have read the email ids from Csv , Then first check an email is exits as customer Using Magento\Customer\Api\AccountManagementInterface ‘s function isEmailAvailable($emailId,$websiteId) and depends on customer types Guest ( mean guest Not register) and register, i have added the email to subscriber list. For add an email to the subscriber list, we need to call factory class Magento\Newsletter\Model\SubscriberFactory and need to Customer.Guest customer use $_subscriberFactory->create()->subscribe($Email); and register customer ,use…