New answers tagged

0 votes

How to fix Referenced sniff "PHPCompatibility.FunctionUse.RemovedFunctions" does not exist with PHP8.1

Add the phpcompatibility/php-compatibility ruleset to the composer.json using post-install-cmd: { "scripts": { "post-install-cmd": [ "([ $...
user avatar
0 votes

Upload csv file from a custom admin form issue

My problem mainly was because of this part: ['fileId' => 'file'] It didn't match with my input value name defined in the UI Component. I will leave here all of the code, maybe it will help ...
user avatar
  • 3,575
0 votes

how to set the weekday in order email template magento 2.4

You can create a observer to the event email_order_set_template_vars_before. In the observer replace created_at_formatted in transportObject with your custom format // use __constructor instead $...
user avatar
0 votes

How to fix Referenced sniff "PHPCompatibility.FunctionUse.RemovedFunctions" does not exist with PHP8.1

This is known issue with Magento coding standards and temporary workaround is to add below code $resolvedInstalledPaths[] = '/path/to/your/project/vendor/phpcompatibility/php-compatibility/...
user avatar
0 votes

Unable to retrieve the qty updated product value in the cart using Observer

Try using events checkout_cart_update_item_complete processItemQty$observer->getItem()) For updates from the mini cart, you may also need checkout_cart_update_items_after $observer->getCart(...
user avatar
0 votes

Magento 2.4 Best way setup with Docker environment

here is another #docker configuration for Magento 2.4.4 https://github.com/magenx/Magento-2-docker-configuration Stack components in use: MariaDB - high performing open source relational database, ...
user avatar
  • 3,732
0 votes
Accepted

Creating configurable product attribute with magento > 2.4

ok, it took me quite some testing, but to save the attribute, you need to use the class Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute I use $this->...
user avatar
  • 383
0 votes

Magento 2 How to Upload Image For Category Using Rest API?

You need to use category API for your issues: https://devdocs.magento.com/redoc/2.2/#tag/categories/operation/catalogCategoryRepositoryV1SavePost
user avatar
1 vote

How to remove use website option from the system.xml in Magento 2

set showInWebsite="0" and as per your requirement set showInDefault="1" showInStore="0"
user avatar
0 votes

Can we create System.xml fileds inside any custom menu in Magento 2

Yes you can create your menu like this <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
user avatar
0 votes

Magento2.4: Is it Okay to upgrade magento from 2.4.3 to 2.4.4 in ubuntu 22.04?

Yes, you can update both easily. For magento , there are no major issue after 2.4.3 to 2.4.4, and no need to rtrim() error for php , you can easily add library from php official site. https://github....
user avatar
1 vote

What is the best approach to learn magento2 as backend developer?

I think best way to become certified developer in 6 month, Clear basic funda of php , crud operation , oops concept practically not theoretically. take a deep dive in vendor all modules with override ...
user avatar
0 votes

How to move breadcrumb to below main menu in custom module in magento 2

This is magento's default code for menu on top of the page. but you can try with this code it's works for me. <move element="breadcrumbs" destination="product.info.main" before=&...
user avatar
1 vote

How to set meta title dynamically for specific category in magento 2

I suggest to use the similar logic like described in https://magento.stackexchange.com/a/357049/91782 You need to create plugin for \Magento\Catalog\Block\Category\View and modify metadata on ...
user avatar
0 votes

How to set Dynamic meta title for cms page in magento 2

You can do this with plugin app/code/Acme/StackExchange/etc/frontend/di.xml <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
user avatar
1 vote
Accepted

Magento 2.4: How to change text "Order #" to "Confirmation #" in printed page that appears post order placement?

This is the title. Check the block /** * @return void */ protected function _prepareLayout() { $this->pageConfig->getTitle()->set(__('Order # %1', $this->getOrder()->...
user avatar
  • 34.3k
0 votes

How to Get all Order using GraphQL in Magento 2?

For Check What is GraphQL in Magento 2, Read Blog, GraphQl in Magento 2 Check the link, Get List of Orders of Customer using GraphQl Magento 2 full module For Get List of orders of Customer by ...
user avatar
  • 2,498
0 votes

How to change filter "and" to "or"?

You need to overwrite the filter functionality OR condition like this: $collection->addAttributeToFilter( array( array('attribute' => 'someattribute', 'like' => 'value'), ...
user avatar
0 votes

Inject dependency based on php version

Generally Magento has PHP requirements for each release version and doesn't designed to solve PHP version with DI Simple way is create custom factory for your class, create 2 classes with ...
user avatar
1 vote
Accepted

Magento 2 - automatically set product as new when CREATING product only

This answer is very similar to previous one, but use another one observer. In Magento for create and update operations uses the single action save. If you want to check if is it new product on ...
user avatar
0 votes

magento 2.4 add to cart multiple simple products with options

I finally did it. In case somebody else needs it, I'll explain here what I did. What puzzles me is that magento could already have this feature but for some reason that I cannot understand they ...
user avatar
  • 129
1 vote
Accepted

Magento 2 Category rule and override the cart file by plugin

The first step is to register your module with registration.php. The file location will be app/code/Softi/CartProduct/registration.php <?php \Magento\Framework\Component\ComponentRegistrar::...
user avatar
1 vote
Accepted

Back in stock alert translation and locale Magento 2.4.4

please use below code in email template to translate stock alert text, it will translate according to locale by default and we can translate it using .csv files. <p>{{trans "In stock alert! ...
user avatar
  • 498
0 votes

how to change/customize minicart dropdrow instead a dropdown cart I wish having a slider from right do left at magento 2.4.4

Below is the extension which can help you Magento: https://marketplace.magento.com/ambab-module-slidingcart.html Github: https://github.com/ambab-infotech/slidingcart
user avatar
0 votes

how to change/customize minicart dropdrow instead a dropdown cart I wish having a slider from right do left at magento 2.4.4

You can add this behavior with minicart template app/design/frontend/<vendor>/<theme>/Magento_Checkout/templates/cart/minicart.phtml <!-- ... --> <div class="block block-...
user avatar
0 votes

magento 2.4 add to cart multiple simple products with options

Try namespace MagePal\CustomCart\Helper; use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Helper\Context; use Magento\Checkout\Model\Cart; use Magento\Catalog\Model\...
user avatar
0 votes

Magebto 2: Order place for customer using oauth authentication instead token

In Magento 2 it is depricated for customer and admin token using oauth
user avatar
1 vote

Elasticsearch 7.11 connection refused using Devilbox

Search for the line that contains network.host, uncomment it, and change the value to 0.0.0.0. Set the network host to 0.0.0.0 to listen on all interfaces and make it available publicly, Incase you ...
user avatar
0 votes
Accepted

Elasticsearch 7.11 connection refused using Devilbox

solved this issue by changing network.host to 0.0.0.0 and discovery_seed.host to ["localhost", "127.0.0.1"] on the file elasticsearch/config/elasticsearch.yml
user avatar
0 votes

Magento 2 - automatically set product as new when CREATING product only

In this case, you can use the event like: app/code/Vendor/Module/etc/events.xml: <event name="catalog_product_save_after"> <observer name="my_custom_product_save_observer&...
user avatar
  • 2,498
1 vote
Accepted

Magento2.4: How to get Salable quantity in list.phtml file?

Try This Code app/code/VendorName/ModuleName/etc di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=...
user avatar
  • 5,800
0 votes

Add custom option Programmatically in cart its not increasing quantity in cart

/app/code/Namespace/Mymodule/etc/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:...
user avatar
1 vote
Accepted

Magento 2.4.4 PageBuilder SourceMaps not generated

Magento doesn't generate any source map files for JS. You can ignore those errors or disable warnings in your browser. This feature needs only for debug uglified code. How to fix the "DevTools ...
user avatar
0 votes

Back in stock alert translation and locale Magento 2.4.4

The exact strings used here are found in Magento_ProductAlert::email/stock.phtml Add the translations for it in your custom theme i18n folder, in a csv file for your language code (e.g. app/design/...
user avatar
  • 161
0 votes

chown: invalid group: ‘:apache’

may be your magento file is not permitted for current group and user. First get your current user name with whoami command. whoami check current file owner with ls -l and assign current group and ...
user avatar
  • 1,159
0 votes

chown: invalid group: ‘:apache’

There would be no "apache" user group by default in Ubuntu. If you want to give the permission to the user group for apache, the default user group it lies under is "www-data", so ...
user avatar
  • 4,585
0 votes

Admin Login Issue 2.4.4

Try to run this commands one's. php bin/magento cache:clean php bin/magento cache:flush php bin/magento indexer:reindex php bin/magento setup:upgrade php bin/magento setup:static-content:deploy -f ...
user avatar
0 votes
Accepted

Remaining Characters on Product Configure in Admin

You've pointed to documentation and just copied example of use but you didn't update selectors in your code It should be something like: <?php $scriptString = <<<script require(['jquery', ...
user avatar
0 votes
Accepted

after upgrading magento 2.2.3 to 2.4.4 all pub files return 404

Finally found the solution. Step:1. Add this in app/etc/env.php 'system' => [ 'default' => [ 'web' => [ 'unsecure' => [ 'base_media_url' => '{{...
user avatar
  • 3
0 votes

How to Add Cart Price Rule Condition in Coupon Code Programmatically in Magento 2.4.0?

You can select Customer Group - ( General or any other), if you are providing any customer group to them. General is given by default to Registered Customers. You can assign any group to your customer ...
user avatar
1 vote

getFullActionName() returning __ on CMS & Category Pages

For those kind of pages the event controller_action_predispatch called 2 times First time for \Magento\Framework\App\Action\Forward and route, controller and action are empty Second time for \Magento\...
user avatar
0 votes

Back in stock alert translation and locale Magento 2.4.4

alertGrid is a rendered block content Block: \Magento\ProductAlert\Block\Email\Stock Template: Magento_ProductAlert::email/stock.phtml $_products - list of products which back to stock
user avatar
0 votes

getFirstItem is not working on collection while getData returns an array

Try this: <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\...
user avatar
0 votes

getFirstItem is not working on collection while getData returns an array

Methods getSize, getData and getFirstItem use different logic getSize Calculates totals based on COUNT query /** * Get collection size * * @return int */ public function ...
user avatar
0 votes

magento-patches: Permission denied

Following may do: chmod +x ./vendor/magento/magento-cloud-patches/bin/magento-patches ./vendor/bin/magento-patches apply MDVA-40311 chmod -x ./vendor/magento/magento-cloud-patches/bin/magento-patches
user avatar
  • 15
1 vote

Add extra text in customer backend Address Book - Magento 2.4

You can achieve your requirement by following steps: Step 1: Create customer_address_index.xml under your theme location like below: app/design/frontend/Vendor/theme/Magento_Customer/layout/...
user avatar
0 votes

How to call CMS page using controller in Magento 2

Add below code in your controller : $this->loadLayout(); $block = $this->getLayout()->createBlock('block_type','name',array('template' => 'phtml_name')); $this->getLayout()->...
user avatar
1 vote
Accepted

Table Rates Shipping - UAE States Code issue

You can check validation rules in the vendor/magento/module-offline-shipping/Model/ResourceModel/Carrier/Tablerate/CSV/RowParser.php: /** * Retrieve region id from provided row data. * * @param ...
user avatar
1 vote

Magento 2.4.3 admin dashboard - Invalid security or form key. Please refresh the page

This fix is also added to Magento Quality Patches Tool (QPT) If Magento Quality Patches Tool is not already installed then install using composer composer require magento/quality-patches Apply patch ...
user avatar
0 votes

Checkout Page issue after upgrading magento from 2.3.5 to 2.4.4

I found my issue. The problem was caused for a module called HARDSOFTECH_PayuLatam. I disabled that module and my checkout page worked.
user avatar

Top 50 recent answers are included