Inline scripts blocked after a Composer update? Here’s how to update the CSP whitelist.

In today’s digital world, security measures such as Content Security Policy (CSP) are essential for ensuring the integrity and security of websites. However, a Composer update to, for example, Magento 2.4.6-p6 can cause inline scripts to no longer load, which can be particularly problematic during the checkout process of an online shop. This article explains how this problem can be resolved, why these changes are necessary, and which security aspect needs to be taken into account.

Magento 2: Malicious code via API

Magento’s API is a popular target for attackers. It repeatedly happens that malicious code is injected into content blocks through compromised interfaces. This code can be executed automatically in visitors’ browsers when an affected page is accessed – with potentially serious consequences for security, privacy, and customer trust.

Magento 2: Missing images in the WYSIWYG editor after an update

After an update to Magento 2, we encountered a problem where images in the WYSIWYG editor were no longer displayed. However, when we uploaded a new image, it was displayed without any issues. All other files located in the WYSIWYG folder were still not displayed. Since the file permissions were correct and the error messages did not provide any specific clues about the problem, we had to investigate further.

Magento 2 with Computop and Fatchip

Task at our online shop agency: The payment interface from the manufacturer Customweb used in our Magento 2 shop had to be replaced with the interface from the provider Fatchip, as Computop had transferred the support of its shop interfaces from Customweb to Fatchip. The new Fatchip interface was installed without any problems, and the Customweb modules were uninstalled.

 

Magento: Display script hashes in the browser

When developing custom extensions in Magento 2, we encountered an issue where the Content Security Policy (CSP) hashes were not displayed in the browser console. These hashes are important for allowing inline scripts and other content that may be blocked by CSP. In this article, we show you how to create your own plugin to customize the CSP policies in Magento and make the hashes visible.

Auswahl einer Internetagentur

Magento developers, take note! There is exciting news for you. Whether you are already using Magento or considering integrating it into your online business strategy, this article provides all the important information you need. We take a look at the latest features, platform improvements, as well as updates regarding security and performance.

Großkundenprojekt mit Magento 2

Are you planning a large-scale enterprise project and have decided to use Magento 2 as your e-commerce platform? Then you have come to the right place! In this blog article, we give you an insight into our experience planning and implementing our own enterprise projects with Magento 2. We show you how to implement your project efficiently and successfully and what you should pay attention to along the way. Read on to discover useful tips and tricks for a successful Magento 2 implementation.

Magento 2 lokal installieren

Magento is a powerful e-commerce platform used by many online retailers worldwide. Installing Magento on a local server is the best way to get to know and test the platform without needing an Internet connection. However, if you have never installed an e-commerce platform before, it can seem a little intimidating. Don’t worry, we have created a step-by-step guide to help you install Magento on your local server! In this blog article, we will introduce you to the necessary steps and provide helpful tips and tricks to help you successfully install Magento.

Magento 2 Statische Datein und Xampp

At our agency, we needed to install a Magento CE 2.4.5-p1 online shop on XAMPP (PHP 8.1) / Windows. Magento web shops are not designed for Windows or XAMPP, so there are a few special considerations. After we had resolved most of the difficulties (the correct c:\xampp\apache\conf\extra\httpd-vhosts.conf configuration, adjusting \vendor\magento\framework\View\Element\Template\File\Validator.php due to the different directory separator, etc.), one error remained.

Magento 2.4 Webshop

Today's problem at our web agency in our online shop (Magento 2 CE 2.4.3): The Store Restriction Pro extension from extension developer MagePsycho, which is intended to restrict access to certain pages for specific user groups, was not working as expected. Among other things, the extension allows you to select CMS pages that should remain accessible without registration. However, when the cache was enabled, these pages were not displayed and users were instead redirected to the login page. The configuration made in the Magento backend was therefore not being applied correctly on the frontend.

 

Magento 2 Produktindividuelle Versandkosten

Our web agency was tasked with setting the shipping costs individually for each product in a Magento 2 online shop. More specifically, each product needed to be assigned a specific weight depending on a particular attribute. This weight could then be used to determine the final total shipping costs with the help of table-rate shipping. One way to achieve this, for example, is by writing a small plugin.

 

 

Sitemap Cover Bild

After the (supposedly) successful creation of a sitemap in Magento 2 (CE 2.3.5), a Parse Error was displayed when accessing the sitemap. The error: This page contains the following errors: Entity 'iacute' not defined. Below is a rendering of the page up to the first error. The solution offered here by our web agency or the workaround provided is, of course, not limited to the entity "iacute", i.e. "í", which corresponds to the letter "í", but also applies to umlauts and other special characters such as Trademark (™) or similar.

Onlineshop Magento 2: Preise ohne Nachkommastellen

Current issue at our web agency while developing an online shop based on Magento 2: How can prices be displayed without decimal places in both the product detail view and the product list view? The good news: Magento 2 allows an optional $precision parameter when formatting the price with the formatCurrency() function, which is responsible for the display / rounding. The bad news: In the detail view, the price is formatted again using JavaScript.

 

Patch SUPEE-11555 Fehler media.js

If you encounter problems when applying the security patch SUPEE-11555 and the update aborts at the media.js file, the issue may be caused by the line endings. In this case, the following message is displayed during the online store's update process: "checking file js/tiny_mce/plugins/media/js/media.js Hunk #1 FAILED at 483 (different line endings).1 out of 1 hunk FAILED". However, this can be fixed easily.

Magento 2 EH Customer Approve

Encountered at our web agency in a Magento 2-based online store: At a certain point, it was no longer possible to log in to the admin area without any changes having been made to the online store. The generated error report indicated that the certificate of a page requested via the HTTPS protocol was not trusted. The requesting file was part of the Hut Extension "Customer Approval" extension. More specifically, the error was caused in the following file, where the change needs to be made:

 

Magento 2: Uncaught SyntaxError

If you receive the error "Uncaught SyntaxError: Unexpected token O in JSON at position 145" on the product detail page, and the product image is no longer loaded and no AJAX / JavaScript operations work anymore, the solution may be relatively simple. In our online store running Magento 2 (Magento CE 2.2.5), the product name contained the "inch symbol" (") in the form of a double quotation mark.

Magento 2: Konfigurierbares Produkt

When you create a configurable product in Magento 2 and assign simple products to it using a selected attribute, those simple products can be selected from a dropdown on the product detail page. The images and price change, but the SKU does not. The dropdown also displays only the labels of the underlying attribute rather than the name of the associated simple product. Instead, the price difference compared to the currently selected simple product is displayed.

We wanted to achieve two things: hide the price difference and, instead, display the name of the respective associated simple product next to the attribute label. First, we created a small plugin and added the following lines to

 

404-Seite (no-route) Magento 2

Problem encountered at our web agency: A page link integrated into the online store system Magento 2 using a widget was not displayed on our no-route page, even though this was configured accordingly in the Magento backend. The type was set to "Page Link", Package/Theme to "Luma", and all available store views were selected ("All Store Views" would also have been sufficient!). The sort order is irrelevant here. The layout updates were configured for "Specified Page", namely the "CMS No-Route Default Page" ("CMS No Route"). This did not work either, but we will take a closer look at this later:

 

Admin Backend langsam Magento 1

If the Magento 1 backend is extremely slow, even when logging in or saving products, there are a few tricks that can help. Two key problem areas are the /var/cache directory and the core_url_rewrite table.

If the backend is already extremely slow when logging in, it can help to manually delete the contents of the var/cache/ directory.

If editing or saving products is very slow, this may be caused by slow database queries. These can be identified, for example, using a slow query log. In our case, the culprit was the extremely large core_url_rewrite table, where queries sometimes took more than 30 seconds to complete.

The solution was to back up the manual rewrites and select them, for example, using a REGEXP:

  

Klarna Payments Magento

How can you change the name (title / label) of the Klarna Payments solution in the checkout of an online shop built with Magento CE 1.9? To begin with: Unfortunately, this setting cannot be found in the backend. For example, the checkout may display "Invoice." with a period instead of "Invoice" without a period. In this case, a change in the "payment form block" can help. We therefore look in the file 

DSGVO Magento

How do you change the name field in the Magento 1 contact form from a required field to an optional field? The background to this is that, as part of the General Data Protection Regulation (GDPR), which came into effect in 2018, you may want to give users the option of sending a message to the shop operator without having to provide their name.

 

Login Check für CMS-Seiten Magento

 

How can CMS pages be designed differently depending on whether a user is logged in or not? Basically, it's relatively simple: You create a PHTML file and then include it in the CMS page. In this file, you can use the isLoggedIn function, which returns whether the user is logged in or not, allowing you to generate different outputs, such as calling different static blocks.

 

 

Magento 2 Shopping-Cart

After logging in as a customer, we noticed that the shopping cart was not displayed at all. It was only visible on the customer account page. Whether the cart was displayed or not was defined in the following file: C:\xampp_7_1_23\htdocs\oku-online\app\design\frontend\econcess\default\Magento_Checkout\templates\cart\minicart.phtml   The if statement was:

Magento 2 Produktbeschreibung

On the homepage, under “Best-Selling Products”, a product description needs to be added to the products. To do this, an override must be created. The template file that needs to be overridden is located at:

\app\design\frontend\template-name\default\Magento_CatalogWidget\templates\product\widget\content\grid.phtml

We can find the block that needs to be inserted under

Magento 2 Online Store: Unexpected token during CMS file upload

If the file upload in Magento 2 (in this case: Magento 2.2.5) aborts when attempting to upload a video file in a static block, this may be due to an excessively large post_max_size. In this particular case, the PHP parameter in php.ini was set to 2048M, i.e. 2 gigabytes. If you look at the error displayed in the console when attempting to upload a file, you will see a message stating that the compiler encountered an "Unexpected token" while processing the program code and can no longer continue because of it.

 

Frontend Kommentare bei Bestellung

We now want to give the customer the option of entering comments during the ordering process, which should then be assigned to the order in the backend so that the shop operator can take them into account when processing the order. In addition, the customer should be able to find their comment both in the order confirmation email and in the order overview of their customer account. The first task can be solved quickly with a suitable extension; here we worked with the extension   . It works quite well overall, with a few weaknesses that can easily be addressed with a few minor adjustments. However, this extension only creates backend comments. The order confirmation and order overview do not contain the entered comment.

 

Magento DSGVO Kontaktform

If, as part of the new EU General Data Protection Regulation (GDPR) coming into force, you want to modify the Magento contact form so that the name is no longer a required field and instead becomes an optional field, there are a few things to consider. First, remove the "required" class and the "asterisk" in the file \app\design\frontend\PAKET\TEMPLATE\template\contacts\form.phtml, so that the result looks like this:

 

Datenschutz-Checkbox für Kontaktformular

How do you add a checkbox to the contact form and registration form in Magento 1.9, for example to confirm that the user is of legal age or to require acceptance of the privacy policy? A practical solution for this is the Terms and Conditions (Admin->Sales->Terms and Conditions). We now want to add confirmation of the privacy policy to the contact form and confirmation of the privacy policy and confirmation of legal age to the registration form, both in German and English (2 store views). To do this, we create 4 Terms and Conditions in the Magento backend (Age and Privacy Policy, each in German and English).

 

Sitemap mit Bildern Cover Bild

How do you create image sitemaps in a Magento online shop (multi-shop with 2 websites and 3 languages / store views per website) and exclude certain page types for individual store views? Here is one possible solution: First, we create subfolders for each sitemap, e.g. /sitemaps/sitemap-websitename1-storeviewname1/,  /sitemaps/sitemap-websitename1-storeviewname2/, etc. We then create a sitemap for each store view in the Magento backend and generate it, so that we have one sitemap per sitemap folder as a result (/sitemaps/sitemap-websitename1-storeviewname1/sitemap.xml,  /sitemaps/sitemap-websitename1-storeviewname2/sitemap.xml, etc.).

 

SUPEE-10570 und weiße Seite bei Warenkorb

After installing the SUPEE-10570 security patch for Magento CE 1.9.2.4, it can happen that the shopping cart displays only a blank page, without any errors appearing in the server logs or Magento logs. And this only occurs when compilation is enabled. Finding the error without any logs is relatively difficult—but after a long search, we were able to identify the culprit. In this case, it was a function in /app/code/core/Mage/Customer/Helper/Data.php, namely getPasswordTimestamp().

 

HEADERS ALREADY SENT in Http.php

If the following error message appears in the system log file var/log/system.log: DEBUG (7): HEADERS ALREADY SENT: <pre>[0] PATH_TO_MAGENTO_INSTALLATION\app\ code\core\Mage\Core\Controller\Response\Http.php:53, the first step is to find the location where the error actually occurs, since Http.php is only the downstream component. To do this, we add, for example, the following to the file

 

Magento UPS-Extension

After purchasing the "UPS Shipment" extension and downloading the file bms-magento-upsshipment-1.3.3.zip, it is unpacked and copied to the root directory of the Magento installation. The SOAP (PHP) extension must be enabled for this. After activating the extension, the error "Missing or invalid Shipto AttentionName" may occur when shipping to an address outside Germany. In this case, UPS requires not only the actual recipient but also the "Attn." entry, which is not transmitted by Magento.

 

Magento 1.9.3 ReferenceError

If the image upload no longer works in some areas of the Magento backend and the error "ReferenceError: Uploader is not defined" appears in the error console, this may be due to several required JavaScript files not being included. These files have become mandatory following the switch from Flash to HTML uploaders with Magento CE 1.9.3 and the corresponding patches.

 

Magento SSL-Verschlüsselung

How do you encrypt the backend and checkout in Magento? By selecting the appropriate setting in the backend under System->Configuration->GENERAL->Web->Secure. But how do you also encrypt all remaining pages? By entering the secure Base URL under System->Configuration->GENERAL->Web->Unsecure as well. Yesss, that easy, right! Unfortunately, not with existing Magento installations. What is the problem here? All unsecured subpages indexed by search engines (i.e. pages served using the http protocol) are now redirected to the homepage.

 

Magento PDF Upload

After applying the Magento patch SUPEE-9767, it is no longer possible to upload PDFs to the Magento system via the WYSIWYG editor's upload functionality, even if this file type had previously been added to the list of allowed extensions via a suitable config.xml. This is due to the newly introduced validate() function, which throws an exception after an unsuccessful attempt to determine the file format using getimagesize(). We therefore need to prevent this exception from being triggered.

Fooman Surcharge und PHP 7

In Magento, the Surcharge Extension makes it easy and convenient to charge surcharges for various areas of the online shop without having to modify Magento's built-in price rules to allow negative discounts. This can also be used for payment methods, for example, as a payment surcharge for cash on delivery, PayPal, and so on. With PHP 7, however, the display in the checkout changes—instead of the respective individual payment method surcharges, it simply displays "1" (+ currency).

 

 PHP 7 und Probleme beim Bild-Upload

When using PHP 7 for Magento shops running CE 1.9 (in this case: 1.9.2.4), problems can occur when uploading images while editing a product. For example, the upload may abort or simply hang without any further error message. The reason for this is the "Uniform Variable Syntax" introduced with PHP 7. In simple terms, this means that when dealing with embedded variables, we now read from left to right rather than from right to left.

Magento Extension Single Configurable Products

When using the Magento extension "Simple Configurable Products" from Organic Internet, it should be possible to display the lowest price for a configurable product in the product list (within a category), based on the simple products assigned to it. In other words, the lowest price of all assigned products should be displayed. To achieve this, the SCP extension performs (for the most part) suitable database queries in which it requests the desired rows using the ORDER clause.

Magento Fehler

When using the Magento extension "Improved Navigation" from Amasty, the following error can occur: If the filters are integrated on a CMS page (e.g. as an entry point on the homepage), selecting a filter leads to the subpage "/shopby" with the respective option as a URL parameter. However, the controller does not recognize any involvement of the Amasty extension there and attempts to display a CMS page. After some research, it turns out that Amasty unnecessarily changes the URL "/shopby" to "/s", which cannot then be mapped correctly—the result is the display of the 404 page.

 

Magento Kategorien weiterleitung

Suppose we want to position several CMS pages in the main menu alongside the sales categories, which we can edit freely in the category management and move around as needed. As an example, let's take a page for presenting the company, which we create as a category called "Company" and which is then accessible at /company.html. However, we do not want /company.html to be displayed using a static block, for example (due to the limited editing options), but instead want to create a new CMS page called "Company", making it accessible at /company.

 

Magento Redirect

How can categories in Magento be redirected to CMS pages or contact pages? This is particularly convenient for multilingual online shops, as it allows individual content elements to be represented within the category structure, such as a company profile or a link to the contact form (provided by the system at /contacts). As described in several threads, unfortunately it is not enough to create a custom rewrite that is intended to replace the system rewrite.

 

Attribut mit Mehrfach Auswahl

The problem: We have created an attribute with the "Multiple Select" property and now want to use it in Magento in the category view for the sorting function, i.e. sort the product list according to the values of this attribute. In the standard settings of a multiple-select attribute, this functionality ("Use in Layered Navigation") cannot be enabled.

Reihenfolge der Beträge in Magento

With a little programming effort, you can get Magento to change the order in which amounts are displayed during the checkout process, in the shopping cart, and in the breakdown included in sent emails—here using taxes as an example, which we want to move below the grand total (changing the order in the admin area under System->Configuration->SALES->Sales->"Sort Order of Address Total Segments" does not produce the desired result here):

Block-Erstellung in Magento

Variant 1: href="/Magento-Agentur/Magento-Programmierung-Muenchen.php">Magento Block via XML
The block is defined in the file \app \design \frontend \Dein_Templatepack \Dein_Template \layout \page.xml. In our case, it is called "firstheader" and receives (optional) design specifications in the file