Blog ... old fashioned (Page 3)

PHP-Snippet: How to get the defaultTaxRate in Shopware 6?

Sometimes it is maybe useful to get the defaultTaxRate that is defined via Admin in Shopware 6. For this we have this small php function below to get the UUID from the SystemConfig and then search with the tax.repository to get the curent value. The system path to get the default UUID is core.tax.defaultTaxRate.

Categories: Shopware 6 PHP

CustomFields, Properties and Entity Extensions for Shopware 6

CustomFields, Properties and Entity Extensions for Shopware 6

When you start working with Shopware 6 it can be hard to know what to use for what. So this guide will explain you the different aspects of CustomFields, Properties and Entity Extensions in Shopware 6. Disclaimer: This definition is maybe not correct in all parts, it is more less a guide to give you a feeling what to use when. Because you can solve same tasks in very different ways and maybe both will work. So feel free to comment when you think something should be changed or written in another way. Let's checkout the differences between CustomFields, Properties and Entity Extensions.

Categories: Shopware 6

PHPStan with static SQL analysis as pre-commit hook for Shopware 6

PHPStan with static SQL analysis as pre-commit hook for Shopware 6

You working on a customer project and you want to make sure that you write code like a Shopware 6 core developer? Then you need all the shiny linters that the core developers are using. This guide will explain how to setup PHPStan and easy-coding-standard as a pre-commit hook with CaptainHook in a docker container setup. That's it, enjoy. 🤯

Categories: Shopware 6 PHP

Configure PHPStan in PHPStorm to use PHP from Docker Container

Configure PHPStan in PHPStorm to use PHP from Docker Container

In PHPStorm you can set up PHP > Quality Tools that will check your code as you code. This will help you write clean code. I suspect that most developers use a local configuration for these PHP > Quality Tools. But if you already have some Docker containers set up for your project, you should use the same PHP version and the same tool version, e.g. PHPStan, installed in this project via Composer. In this post I will guide you through the setup with many screenshots.

Categories: PHPStorm PHP

How to debug SQL-Queries in Shopware 6?

How to debug SQL-Queries in Shopware 6?

There are always situations where you need to get the raw SQL query. Maybe to understand what is going on, to debug a problem on a production system or just for playing around in your favorit MySQL client to adjust the query. So let's see what kind of options you have to get the SQL query in Shopware 6.

Categories: Shopware 6

Content Management anywhere in Shopware 6

Content Management anywhere in Shopware 6

The Content Management System in Shopware 6 is called Shopping Experiences. But in this post I will always talk from Content Management when I mean the Shopping Experiences, just to clarify. I will explain how you can use the Content Management to build custom product pages with Shopware 6. The idea is to connect your product (or other entities) with any CMS page and render the content from you CMS page into the DOM. At many page types and places you can add content via the administration (layouts) but when you want for example different content in different tabs you can not solve this via administration and need some custom code/template. So this tutorial is for that case.

Categories: Shopware 6

Environment variables in Shopware 6 (aka process.env.XYZ)

Environment variables in Shopware 6 (aka process.env.XYZ)

With environement variabeles you can do a lot in Shopware 6. Especially when you use some build process to deploy your projects or test your plugins. So in this little post I will collect some of the important environment variables I found in Shopware 6.

Categories: Shopware 6