Skip to main content

E-commerce Platforms

E-commerce Platforms

Use CURL library to get token and lists in Magento2

'cURL' is a command-line tool that lets you transmit HTTP requests and receive responses from the command line or a shell script. It is available for Linux distributions, Mac OS X, and Windows. To use cURL to run your REST web API call, use the cURL command syntax to construct the command. To create the endpoint in the call, append the REST URI that you constructed in Construct a request to this URL: https:////rest/ To pass the customer data object in the POST call payload, specify a JSON or XML request body on the call.

Magento 2 Delete the not used Cart after upgrade Magento

It's very recommanded to delete unused carts after you finish the upgrade using these queries all customers carts that are not converted to order will be deleted 

 

select * 
FROM `quote_address`
WHERE `customer_address_id` IS NULL AND `firstname` IS NULL AND `lastname` IS NULL and quote_id in (SELECT entity_id FROM `quote` where is_active= 1)

 

select *    from quote where entity_id not in (select quote_id from quote_address)

Notice: Undefined offset: 2 in Encryptor.php

Error : Notice: Undefined offset: 2 in vendor\magento\framework \Encryption\Encryptor.php

Some time you will have the below error after you move Magento2 from server to another server with different PHP version or even with the same PHP version , now what is the first solution we can do 

mostly this library will be missed 

php-sodium

So we need to install it , below is some command we can do to install it on Centos

How Magento2 format the product URL

I have looked at almost 100 articles to know how Magento format the URL without any success and finally I found it and it was really so easy , here is the quick way to see it using object manager

Note: please consider to use the dependency injection

 

$_productloader = $objectManager->get('\Magento\Catalog\Model\ProductFactory');
$product =  $_productloader->create()->load(1);


echo  $product->formatUrlKey({Your text here});

 

in this way Magento will give you the correct URL which will be used 

Magento 2 correct permissions

The most frequent question, asked by Magento users, is correct permissions. They can differ, whether you run your store in one-user mode, or many-user, and also can be different for different modes.

Single user mode

One-user mode is the simplest case. In this case user shall belong to group, which own Magento system and also runs web-server. For them the following rules apply: