New answers tagged

0 votes

Magento 2.4.5 uninstall language pack not working

I discovered that there was a language .csv in the theme files... After removing that al the translations were gone
1 vote
Accepted

Magento 2.4.5 uninstall language pack not working

That command (bin/magento i18n:uninstall) uninstalls only language packages that are provided as Composer packages and hosted in a server like packagist.org, github.com, repo.magento.com, and so on. ...
  • 2,523
1 vote

Upgrading from Magento 2.4.0 to 2.4.5

To upgrade Magento 2.4.0 to 2.4.5, you first need to upgrade the PHP version to 8.1 to avoid conflict and dependency issues. What you can do is: Enable the maintenance mode: php bin/magento ...
0 votes

Magento 2 ui/form/field template Error since Upgrade from 2.3.7 to 2.4.5-p1

You are facing an issue with the XML file layout structure. To resolve this, please make sure as of Magento 2.4.5, the XML structure is quite strictly identified: Steps to reproduce: The component ...
0 votes

Magento 2 ui/form/field template Error since Upgrade from 2.3.7 to 2.4.5-p1

There are some custom templates (*.html) with a closing ko tag that had no opening tag or vice versa. As of Magento 2.4.3 HTML tags must have nested and closed properly to meet standards in JQuery 3.5....
  • 2,523
0 votes

Magento 2 Error: Cannot instantiate interface

This might come alittle late but i just happened upon this error With @piotr-rusin answer i was able to figure out that the simple solution in my case was that the Magento_InventorySales and ...
0 votes

Magento 2.4.1 and Elasticsearch 7.6.2 "no mapping found" issue

I fixed this issue by executing this command bin/magento indexer:reindex catalogsearch_fulltext
0 votes

Magento 2 while upgrading an error of requires facebook/php-business-sdk but these conflict

The error shown is pretty clear, it has compatibility minimum stability version of 1.4.5. Check prerequisites for Facebook SDK with your Magento version: The minimum stability and compatibility ...
0 votes

Magento 2.4 How to send attachement in email?

Great update @Gohil Rajesh Some minor comments: (1) In $transport = $this->_transportBuilder->setTemplateIdentifier($Email_template_name) // put Email Template Name ->...
0 votes

Custom Coupon Code Validation

I'm doing the same thing, here's how I did it. For the shopping cart (before buying the product): Add a custom observer and observe the controller_action_postdispatch_checkout_cart_couponPost event ...
0 votes

magento 2.4 observer on product image change

Give a try on this event - catalog_product_save_commit_after. It will give updated image data as well. <event name="catalog_product_save_commit_after"> <observer name="...
  • 3,702
0 votes

What is the use of event_prefix and cache_tag variable magento 2 model file

$_eventPrefix Prefix of model events names, this prefix will be used in beforeLoad and afterLoad, beforeSave, afterSave, afterCommitCallback and another relative event dispatcher. See this generic ...
  • 3,702
0 votes

How to show yes/no text for boolean field in custom added grid column

You need to add renderer to column properties and create a renderer class for it. Change $grid->addColumnAfter( 'promotion_on', [ 'header' => __('Promotion On'), 'index' =...
  • 2,523
1 vote
Accepted

Overriding Magento\Catalog\Block\Adminhtml\Category\Tab\Product

Your code works as expected. You should remove generated directory and re-compile code to see the changes: rm -rf generated bin/magento:setup:di:compile
  • 2,523
0 votes

Issue on assigning base image, small_image, Thumbnail_image programatically using csv?

Here my issue was image path. I have added the image path as /1/6/16-02-05659_1_1.jpeg. But actually it should be from the pub/catalog/product. So i updated my script as below. $product->...
  • 2,689
0 votes

Magento2 - Secure your store from CSRF

You should add Google recaptcha on all forms and and add form validation code level and set characters length in form fields.
0 votes

Paypal (payflow) returnurl change Magento 2.4

Where you have added paypal/* ? Could you please share me file location ? I am getting same issue in Payflow link Credit card payment. It's not redirecting checkout success page after payment
0 votes

Magento 2.4.0 ElasticSearch not alive

If you are using Magento 2.4.x then you should be using ElasticSearch 7. Check app/etc/env.php for ElasticSearch settings. Example: 'system' => [ 'default' => [ 'catalog' =&...
0 votes

Magento 2.4.1 and Elasticsearch 7.6.2 "no mapping found" issue

This can be resolved by adding '"unmapped_type": "type_of_field"' You can get the type of field from the Query Body. From Elasticsearch Documentation, By default, the search ...
0 votes

B2B installation in Magento 2.4.5-p1 EE

I think you should check your these things : - PHP version compitability - Composer.json and Composer.lock If you need more help please let me know
  • 323
0 votes
Accepted

how to completely remove a theme?

To uninstall a manually added theme: 1.Navigate to the vendor directory where the theme was installed. This directory should be: <installation dir>/app/design/frontend/<VendorName>. 2....
0 votes

How to fix str_replce Deprecated Functionality error in magento 2.4.4

When you get this type of error then you should use this If string requires $var ?? '' If array requires $var ?? [] If number require $var ?? <addDefaultNumber> If a Number type ...
  • 6,900
2 votes
Accepted

How to fix str_replce Deprecated Functionality error in magento 2.4.4

That error indicates somewhere in your code passing null to the third parameter when calling a PHP function that is deprecated in PHP 8.1. Assume you have below code: return sprintf( $path, ...
  • 2,523
1 vote

Warning: Object of class Magento\Framework\Phrase could not be converted to int product/list/toolbar/limiter.phtml on line 26

The issue got fixed but somehow it was not included in the Magento 2.4.5-p1 release. This most likely will be fixed in the Magento 2.4.5-p2 patch which is planned to be released in March 2023 (...
  • 11
0 votes

Magento 2: How to Update Existing Record If Available In the DB Table Or Not then Insert New Row From CSV File

Welcome to Magento Stack Exchange Community. To be able to update an existing record in the table (instead of adding new record every time), you must have some way to uniquely identify the record. If ...
0 votes

Price Rule based on percentage in attribute in M 2.4x

The default way is to create specific coupons and those can be set to be applicable by default or when a customer enters a coupon. If you can further elaborate on your objective as to why you want a ...
0 votes

Custom attribute not getting created - Magento 2.4.5

Delete your module from setup_module table and run php bin/magento setup:upgrade again, also please do not use 'InstallData' as it is not recommended by Magento. Instead use 'patch' See here for patch
  • 196
0 votes

Price Rule based on percentage in attribute in M 2.4x

Yes, you can use Cart Price Rules to achieve that. From the Admin sidebar, navigate to Marketing > Promotions > Cart Price Rules > Create a new rule: Filled all required fields. In the ...
  • 2,523
0 votes

Create popup after customer logged in

In your Observer file you can call the custom template file like this <?php declare(strict_types = 1); namespace Vendor\Module\Observer; use Magento\Framework\Event\Observer; use Magento\...
0 votes

Google tag manager crashes Magento 2.4.3-p2

I managed to find a solution: The problem was that I added the instructions for the HEAD in default.xml but it should be inserted in default_head_blocks.xml See the whole solution above in the ...
0 votes

I get a strange search result when searching a couple of collections, but others are as they should be

When a user enters a search term this search term is saved in a data base table and later based on popularity this term is used by Ajax search. In your case some one tried hacking by adding some sql ...
0 votes

Page Builder not working after composer installation on Magento 2.4.2

This might be useful to you, as I had a very similar issue recently. Basically, a bunch of my jquery requires were 404'ing. It turns out when I upgraded from 2.4.3 > 2.4.5, I didn't update the /lib ...
0 votes

I get a strange search result when searching a couple of collections, but others are as they should be

They are search terms that users enter to search on your Magento site. The root cause: Someone tried to find vulnerabilities to attack your Magento site by adding SQL injection queries to the search ...
  • 2,523
0 votes

how to get SUM of value from the collection?

Magento allow us to retrieve all value of a specific column via $collection->getColumnValues('column');, in your case we can get the sum of grand total as per following: $sumOfTotal = array_sum($...
  • 2,909
1 vote

Magento 2 Newsletter Error Invalid Method Interceptor::loadByCustomer

This is the solution, change your code: Change loadByCustomer to loadByCustomerId <?php declare(strict_types=1); namespace Vendor\Module\Observer; use Magento\Customer\Model\Session; use Magento\...
0 votes

Fail to install cloud docker environment

try these steps: clone needed branch from https://github.com/magento/magento-cloud run composer install run ./vendor/bin/ece-docker build:compose run docker-compose up -d run docker-compose run build ...
  • 121
0 votes

bundle product not creating from admin cms

Can you disable MSI module as its not needed by most ecommerce store and then check. This error also gets generated due to that module and how it has been configured.
0 votes

How to add intlTelInput in Magento Checkout

Issue solved I forgot window window.intlTelInput(input, { // any initialisation options go here }); I also had another error: getAttribute not found. I had actually selected two inputs, so check ...
1 vote
Accepted

How to validate a custom field in sales rule before the discount applying to cart in magento 2.4

To add validation for custom salesrule, you should add an after plugin to Magento\SalesRule\Model\Utility::canProcessRule method. I'll tell you how to validate the apply_on_weekday custom field, then ...
  • 2,523
0 votes

Magento 2.4 - Prevent widget from loading on mobile

I think there is no need to write JavaScript code for it. This can be achieved using PHP also. To detect that the website is being opened in mobile, I would do something like this: // Create the ...
0 votes

Class "Magento\Framework\Component\ComponentRegistrar" not found in setup/src/Magento/Setup/registration.php:9

The official system requirements for Magento 2.4.5 state that Composer 2.2 is supported. However, as of the time of writing, Composer 2.2.0 throws the error you posted during composer install or ...
1 vote

Cookie problem after updating to 2.4.4-p2 (page not loading)

Somewhere in your layout you (or an extension) have the following definition: <block class="Magento\Framework\View\Element\Js\Cookie" name="js_cookies" template="...
  • 708
1 vote

Magento 2.4 : Admin Custom page block not loading

Everything seems correct in your code try adding cacheable="false" in your XML file if it is a cache issue. <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/...
0 votes

Magento 2 How to get this data for password strenght

To check if password is valid in checkout, you can check by error list : $('.amcheckout-form-login').validate().errorList.length > 0
1 vote
Accepted

multiselect custom field does not save in sales rule admin form in magento 2.4

Because of adminhtml_controller_salesrule_prepare_save event does not return value to $data in Magento\SalesRule\Controller\Adminhtml\Promo\Quote\Save controller, you should use ...
  • 2,523
0 votes
Accepted

Conditional webp and resizing in nginx

Following seems to work quite well: set $webpmediacheck ''; set $webpvar $webp_suffix; if ($uri !~* /media/(?:.+)(\.webp)(?:$|\W)) { set $webpmediacheck 1; } if ($uri ~* /media/(?:.+)(\.jpe?g|\....
1 vote
Accepted

How to save extension attribute in Salesrule Api magento 2.4

Due to Magento\SalesRule\Model\Data\Rule can't set custom data, you should use the resource model to save the Rule. To do that, replace your RuleRepositoryPlugin with the following code: <?php ...
  • 2,523
1 vote
Accepted

Elastisearch 7.17 installed but not displaying as option to select in Admin Panel Stores->Configuration->Catalog

The config indicates your site is still on Magento 2.3, you can check your Magento version in admin at the bottom right of the page. Assume, you want to upgrade your Magento site to 2.4.0 Open Source, ...
  • 2,523
1 vote

Show only active subcategories

Could you confirm the following code is redundant? foreach ($subCategories as $subCategory) { if ($subCategory->hasChildren()) { $this->getChildNames(); } } I've tested your ...
  • 2,523
1 vote
Accepted

Issue migration 2.4.1 to 2.4.4

For admin login issue in Magento 2.4.4: This issue reported in Magento github https://github.com/magento/magento2/issues/35297 Found the issue! In Magento 2.4.4 it seems that a value of "0" ...
  • 2,523

Top 50 recent answers are included