Skip to main content

Magento2

Power your online business with the most flexible and scalable ecommerce platform

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:

Apply Magento2 Patch manually using GIT

The best easy way is to simulate the directory path, so lets assume you will need to fix the comparison page after you upgrade to Magento 2.3.5-p2

Filename: vendor/magento/module-catalog/Helper/Output.php

we need to replace this line 

- if (preg_match($pattern, $attributeHtml)) {

with this line 

+ if (preg_match($pattern, (string) $attributeHtml)) {

 

Now create those directories vendor/magento/module-catalog/Helper

Magento 2 static files are not working

How many times you tried to install Magento 2 and later you could not see the website working !!, How many times you tried to search for these sentences 

"Magento 2 css not working"

"Magento 2 js not working"

"Magento 2 404 page not found" because of the static files?

Now here is the solution, and easily it is the missed .htaccess (for apache)

by quick look at this path "{magento root}/pub/static", you will see that you missed the .htaccess file