Hi! I'm Jacob 👋
  
    - This blog about my life, programming, electronics and 3D-printing 🏝️
    - From 2012 I work with Magento CMS and here you will find a lot of helphull notes about it 🐱‍💻
    - Why domain is "cc"? - because my first and lovely car is Volkswagen Passat CC 🤘

npm: command not found

The npm: command not found error may appear even if you already have installed npm. It might look like bash: npm: command not found or sudo: npm: command not found or npm: command not found Solution Either way the easiest solution is just run the following command: if you are logged in as root user apt-get install npm if you are not root user sudo apt-get install npm This command will re-install npm and will update is’s path in the system to the correct one....

January 23, 2024 · 1 min

Easy way to Test Emails in Magento2

An easy way to test emails in Magento 2 is just add the following lines echo $content; exit(); into the vendor/magento/framework/Mail/Template/TransportBuilder.php file. Navigate to the file above and scroll to the line 380. It should be $content = $template->processTemplate(); inside prepareMessage() method. And add the lines echo $content; exit(); after line 380. The code should look like this: protected function prepareMessage() { $template = $this->getTemplate(); $content = $template->processTemplate(); echo $content; exit(); switch ($template->getType()) { ....

January 22, 2024 · 1 min

Why no Orders in My Account in Magento 2 - You have placed no orders

Orders are missing on Order History page in My Account on Front-end The Orders are missing and the error You have placed no orders is presented in My Account on Order History page. But! The customer has orders and they are presented in the admin panel. Usualy it happens because of the Order Status has Visible on Storefront = No. How to display missing orders on Order History page in My Account on Front-end In the admin panel navigate to the Sales > Orders and open Order that 100% customer did and it doesn’t displays on Order History page....

September 4, 2023 · 2 min

Magento 2: How to Create Cms Block Programmatically Using DataPatch

Introduction In the [How to Create Cms Page Programmatically Using DataPatch] chapter I explained why we should use DataPatch in the Magento 2. To create CMS-Block we laso will use DataPatch. It will save our time in the future. Solution <?php namespace Vendor\ModuleName\Setup\Patch\Data; use Magento\Framework\Setup\Patch\DataPatchInterface; use Magento\Framework\Setup\Patch\PatchRevertableInterface; use Magento\Cms\Model\BlockFactory; class CreateCmsBlock implements DataPatchInterface, PatchRevertableInterface { /** * @var BlockFactory */ protected BlockFactory $blockFactory; /** * @param BlockFactory $blockFactory */ public function __construct( BlockFactory $blockFactory ) { $this->blockFactory = $blockFactory; } /** * {@inheritdoc} */ public function apply() { $blockData = [ 'title' => 'Test CMS Block', 'identifier' => 'test_cms_block_identifier', 'content' => 'Yau!...

June 13, 2023 · 2 min

Magento 2: How to Create Cms Page Programmatically Using DataPatch

Introduction In this chapter we will create CMS-Page programmatically in the Magento 2. But first a few words about why DataPatch. If you are developing something for your Magento 2 client which has staging and production envirenments, the best way to do changes for admin part (like changing settings, updating attributes or modifying CMS-Blocks and CMS-pages) is to create DataPatch. DataPatch allows you to avoid remember what and where in the admin panel you did changes....

June 7, 2023 · 2 min

Magento 2: List of All Available Condition Types Used in Search Criteria

Introduction In the Magento 2 when we build a Search Criteria we use filters. And each filter takes parameter condition type. This parameter is necessary to say Magento how we want to filter a field: should a field be greater or less than passed value to the filter, for example. In my previous article I explained in simple terms how we can use Search Criteria. In this article I prepared the table of all available condition types in the Magento 2 with filters and conditions and without it....

June 4, 2023 · 1 min

Magento 2: How to Get Category List. Use Search Criteria.

Introduction Sometime we need to load Category List while developing something for Magento 2. And there are a few ways to do it. But in this small chapter we will use the right way. Solution The right way to load Category List includes two things: use CategoryListInterface to get the list of categories use Search Criteria to build a query Here is the basic code to load Category List. This code will load All Categories, becuase we are using empty Search Criteria....

June 4, 2023 · 4 min

Magento 2: How to Call Cms Block in PHTML Template Correctly

Introduction I’m sure you know how to do it. Just paste the following code into the necessary *.phtml template and that’s it: <?php echo $this->getLayout() ->createBlock(\Magento\Cms\Block\Block::class) ->setIdentifier('block_identifier') ->toHtml(); ?> But! Did you know that the \Magento\Cms\Block\Block is depricated since magento 2.4.2 ? So, the solution above is work for Magento 2.4.1 and less. And for Magento 2.4.2 and higher the solution below. Solution If you updated to the newest Magento version (2....

June 3, 2023 · 1 min

How to Configure Magento 2 for the Comfortable Development

Solution There will be no introduction here. Straight to the point. For a comfortable development for the Magento 2 I use the following setting: Enable developer mode. In this mode: you can see errors; the static content like css and javascript files will be linked to the pub folder and you no need to do setup:static-content:deploy each time after an changes. To do it, please run the command: bin/magento deploy:mode:set developer Disable the following cache types: layout block_html full_page Disabling of these caches will slow down the page speed loading (a little bit), but will saves your time and nerves....

May 30, 2023 · 1 min

Ultimaker Cura: How to Erase Supports in One Place and Keep It in Another Place

Introduction Today I tried (again) to remove some supports on my detail. Here’s the detail: As you can see there is a Hat and Holes: And if you use in Cura the setting Support Placement - Everywhere, you will see the supports everywhere (of course) even in the places where you don’t want to use supports: Green highlighted elements are the places in holes where is I don’t need to use support....

May 21, 2023 · 3 min