Thursday, 15 December 2022

How to disable MSI in Magento 2.4.X

 

Simple Run the below command to disable MSI.

php -d error_log= -d memory_limit=-1 bin/magento module:disable -f Magento_Inventory Magento_InventoryAdminUi Magento_InventoryAdvancedCheckout Magento_InventoryApi Magento_InventoryBundleProduct Magento_InventoryBundleProductAdminUi Magento_InventoryCatalog Magento_InventorySales Magento_InventoryCatalogAdminUi Magento_InventoryCatalogApi Magento_InventoryCatalogSearch Magento_InventoryConfigurableProduct Magento_InventoryConfigurableProductAdminUi Magento_InventoryConfigurableProductIndexer Magento_InventoryConfiguration Magento_InventoryConfigurationApi Magento_InventoryDistanceBasedSourceSelection Magento_InventoryDistanceBasedSourceSelectionAdminUi Magento_InventoryDistanceBasedSourceSelectionApi Magento_InventoryElasticsearch Magento_InventoryExportStockApi Magento_InventoryIndexer Magento_InventorySalesApi Magento_InventoryGroupedProduct Magento_InventoryGroupedProductAdminUi Magento_InventoryGroupedProductIndexer Magento_InventoryImportExport Magento_InventoryCache Magento_InventoryLowQuantityNotification Magento_InventoryLowQuantityNotificationApi Magento_InventoryMultiDimensionalIndexerApi Magento_InventoryProductAlert Magento_InventoryRequisitionList Magento_InventoryReservations Magento_InventoryReservationCli Magento_InventoryReservationsApi Magento_InventoryExportStock Magento_InventorySalesAdminUi Magento_InventorySalesFrontendUi Magento_InventorySetupFixtureGenerator Magento_InventoryShipping Magento_InventorySourceDeductionApi Magento_InventorySourceSelection Magento_InventorySourceSelectionApi Magento_InventoryLowQuantityNotificationAdminUi Magento_InventoryShippingAdminUi Magento_InventoryGraphQl

Wednesday, 21 September 2022

Magento 2.4.4 Admin Login Responce 302 After Upgrade

 Magento 2.4.4 Admin Login Responce 302 After Upgrade.

Found the issue! In Magento 2.4.4 it seems that a value of "0" for "Max Session Size in Admin" breaks it. Solved this issue for simple run below cli command. After that flush cache.


sudo php bin/magento config:set system/security/max_session_size_admin 2560000

php bin/magento config:set system/security/max_session_size_admin 2560000

Monday, 22 August 2022

Magento 2 Repairing Database Using Magento CLI

You can use the Magento CLI and Magerun 2 like this sample:

Using Magento CLI:

Installs and upgrades data in the DB

php -f bin/magento setup:db-data:upgrade


Installs and upgrades the DB schema

php -f bin/magento setup:db-schema:upgrade 


Checks if DB schema or data requires upgrade

php -f bin/magento setup:db:status 

Wednesday, 6 July 2022

Magento 2 Coding Standard warning fixed

 Magento Coding Standard  warning fixed



First we add DocBlock on all pages at top like this

<?php

/**

 * Copyright © Magento, Inc. All rights reserved.

 * See COPYING.txt for license details.

 */


WARNING | Short description duplicates class property name.

WARNING | Missing short description

WARNING | There must be exactly one blank line before tags

WARNING | Type is not specified


---------------------WARNING | Short description duplicates class property name.

/**

 * Url Builder

 *

 * @var UrlInterface

 */

protected $_urlBuilder;


..........Replace to

/**

 * Builder a Url

 *

 * @var urlBuilder

 */

 

---------------------WARNING | Missing short description

/**

 * @param \Magento\Checkout\CustomerData\Cart $subject

 * @param $result

 *

 * @return mixed

 * @throws LocalizedException

 * @throws NoSuchEntityException

 */

 

 .........Replace to

 

/**

 * After Plugin Get Section Data

 *

 * @param $result

 *

 * @return mixed

 *

 * @throws LocalizedException

 * @throws NoSuchEntityException

 */

 

 

----------------------WARNING | There must be exactly one blank line before tags

 

/**

* After Plugin Get Section Data

*

* @param $result

*

* @return mixed

* @throws LocalizedException

* @throws NoSuchEntityException

*/

 .........Replace to

 

/**

 * After Plugin Get Section Data

 *

 * @param $result

 *

 * @return mixed

 *

 * @throws LocalizedException

 * @throws NoSuchEntityException

 */

 

 ----------------------WARNING | Type is not specified

 

 /**

 * After Plugin Get Section Data

 *

 * @param $result

 *

 * @return mixed

 *

 */

public function afterGetSectionData($result)


............Replace to @param array $result


/**

 * After Plugin Get Section Data

 *

 * @param array $result

 *

 * @return mixed

 *

 */

 more example like this

 /**

 * Validates that forbidden tags are not used in comment

 *

 * @param File $phpcsFile

 * @param int $commentStartPtr

 * @param array $tokens

 * @return bool

 */

private function validateTags(File $phpcsFile, $commentStartPtr, $tokens)


WARNING | Short description must start with a capital letter

/**

 * set cart token

 *

 * @param CartInterface $cart

 *

 * @return CartInterface

 */

 .............. Replace to

/**

 * Set Cart Token

 *

 * @param CartInterface $cart

 *

 * @return CartInterface

 */





WARNING | Line exceeds 120 characters; contains 133 characters

$tcpdf2 = new \Eighteentech\DownloadQuote\Block\Tcpdf\MYTCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);


.............. Replace to


$tcpdf2 = new \Eighteentech\DownloadQuote\Block\Tcpdf\MYTCPDF(

            PDF_PAGE_ORIENTATION,

            PDF_UNIT,

            PDF_PAGE_FORMAT,

            true,

            'UTF-8',

            false

        );

        

WARNING | Comment block is missing


public function getCmsFilterContent($value = '')

 

.............. Replace to

 

/**

 * Cms Filter Content

 *

 * @param voide $value

 */

public function getCmsFilterContent($value = '')



WARNING | The use of function unlink() is discouraged


unlink($pdffilepath);


.............. Replace to all files related solution

First you add like this

use Magento\Framework\Filesystem\Io\File;


/** @var File */

private $file;


/**

 * @param File $file

 */

public function __construct(File $file)

{

$this->file = $file;

}


file_exist() can be

$this->file->fileExists($file);


unlink() can be

$this->file->rm($file)


mkdir() can be

$this->file->mkdir($dir)


`dirname() can be

$this->file->dirname($file)


file_put_contents() can be

$this->file->write($filename, $src, $mode)


Thursday, 14 April 2022

Get started PWA Studio with Magento 2

Minimum requirements#

  • Basic knowledge of React
  • Node >= 10.14.1
  • Yarn (recommended) or NPM

Before you can start developing with PWA Studio, make sure you meet the requirements listed on this page.

Note: You must have a version of NodeJS >=10.14.1, and Yarn >=1.13.0. The latest LTS versions of both are recommended.

Reference link: https://developer.adobe.com/commerce/pwa-studio/tutorials/

when checking the yarn version some time is an error below

kuldeep@8DYTVG3:~$ yarn -v

ERROR: There are no scenarios; must have at least one.

Solution:

Fix  'ERROR: There are no scenarios; must have at least one.' run the below command.

sudo apt remove yarn

In my case (Ubuntu 18.04) it was the following:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt update && sudo apt install yarn

kuldeep@8DYTVG3:~$ yarn -v

1.22.18




Thursday, 24 March 2022

Magento 2 Solved: cluster_block_exception

error: cluster_block_exception [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block] .

This error means you do not have enough disk space to store or update data. The flood storage watermark is 95% default, so when it exceeds, the above error is shown and it puts the Elasticsearch into read-only mode. So you need to free up disk space or enlarge it.

Steps to Solve Reindex issue with Elasticsearch: run below cmd

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_cluster/settings -d '{ "transient": { "cluster.routing.allocation.disk.threshold_enabled": false } }'

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

php bin/magento indexer:reindex

Magento 2.2.4 :menu is not showing after upgrade CE To EE

I was found that issue related to Varnish Cache

If we select Store -> Configuration -> Advanced -> System -> Full page cache -> Caching Application Set to Varnish Cache then menu are not appear in home page other then appear on all pages .