The Beginnings:
This is the article for [Magento 2 Advent Calendar 2018](https://adventar.org/calendars/4213) 25th day of 2019.In this article, I am going to describe some of my experience in upgrading magento2.3.0 to 2.3.3 and its consequences errors and important steps to take care off before starting up.
Execution Enviroment
Magento 2.3.0 PHP 7.1.23 MySQL 5.7.24 Apache 2.4.29Steps to reproduces:
1. Back up the magento2.3 database 2. Back up composer.json file from root in the Magento installation directory. 3. use command: composer require magento/product-community-edition=2.3.3 --no-update 4. composer updateconsequent errors might occurs:
Unfortunately using above command is not to be and we would stuck into something like the following: 1. if this type of error occurs, then we need to remove all the third party extensions from composer.json and try once again.- "The following exception is caused by a lack of memory or swap, or not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details"
solution: use this command:
php -d memory_limit=2G /usr/local/bin/composer update
If all goes well we will see the upgrade process happening:
Any errors at this stage are likely caused by the extensions that need to be upgraded at the same time as Magento to stay compatible.
Now that we have the latest code the only thing left to do is make sure that the database itself is also upgraded with.
Use this command:
bin/magento setup:upgrade
And then we can confirm in the admin that we have upgraded to 2.3.3.
After successful upgrade to 2.3.3 you may also face other consequent errors.
1. Catalog pagination issue on Elasticsearch 2. Email Message Interface backward compatibility error 3. Uncaught TypeError: urldecode() expects parameter 1 to be string, boolean given in (in CommunityEngineering/JapaneseUrlRewrite) 4. Warning: Declaration of CommunityEngineering\JapaneseName\Model\DataObject\Copy::setAttributeValueFromExtensibleDataObject($target,$code,$value)... 5. Insufficient inventory error when shipping items 6. When creating a cancellation / credit memo, it will get an error that the product cannot be returned 7. Even if the available quantity is 0, the product will still be displayed on the product list page.Solution for those errors:
1. Catalog_pagination_issue_on_Elasticsearch_6_composer-2019-10-11-08-07-41.patch this is security patches which needs to be applied command: in shell use patch -p1 < Catalog_pagination_issue_on_Elasticsearch_6_composer-2019-10-11-08-07-41.patch-
EmailMessageInterface_2.3.3_backward_compatibility_composer-2019-10-30-10-20-09.patch this is another patches needs to be inserted
command: in shell use patch -p1 < EmailMessageInterface_2.3.3_backward_compatibility_composer-2019-10-30-10-20-09.patch -
CommunityEngineering/JapaneseUrlRewrite needs to be disabled
php bin/magento module:disable:CommunityEngineering_JapaneseUrlRewrite -
add some lines in CommunityEngineering/JapaneseName/Model/DataObject/Copy.php
- use Magento\Framework\Api\ExtensibleDataInterface;
- protected function setAttributeValueFromExtensibleDataObject(ExtensibleDataInterface $target, $code, $value)
-
first confirm the order data only using : php bin/magento inventory:reservation:list-inconsistencies
then use this command:
bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations -
use this command to solve above one : insert into inventory_shipment_source(shipment_id, source_code) values({ShipmentId}, {return stock source_name})
-
use this sql:
SELECT
e.entity_id,
csi.is_in_stock,
isi.quantity + SUM(ir.quantity) as salable_quantity
FROM
catalog_product_entity AS e
LEFT JOIN inventory_source_item isi ON e.sku=isi.sku
LEFT JOIN inventory_reservation ir ON e.sku = ir.sku
LEFT JOIN cataloginventory_stock_item as csi on e.entity_id=csi.product_id
GROUP BY e.sku
HAVING salable_quantity=0 and is_in_stock=1;
and check if salable_quantity=0 then change the status to out_of_stock.