Snippet

Composer set memory_limit in bash

PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108864 bytes) in ...

If you are running into a memory_limit when using composer, there are many ways to solve the problem. Finally I'm hoping for enhancements in composer to require less memory. But until that I've found a quick solution in bash:

Drupal 8 Media: Format file size output / display

If you'd like to output Drupal 8 Media file size (mapper field) output in human-readable format, this snippet may help you!

in MYTHEME.theme file:

  1. function MYTHEME_preprocess_media(&$variables) {
  2.   /** @var \Drupal\media_entity\MediaInterface $media */
  3.   $media = $variables['elements']['#media'];
  4.  
  5.   if ($media->bundle() == 'document' && !empty($media-> field_document_size)) {

Shopware 5 PLZ-Bereich (Umkreis) versandkostenfrei für ausgewählte Kategorien


(IFNULL(us.zipcode,ub.zipcode) IS NOT NULL) AND (IFNULL(us.zipcode,ub.zipcode) IN ('32312', '32310', '12345'))
AND
MIN(SELECT 1 FROM s_articles_categories WHERE articleID=a.id AND categoryID IN (22,56)) AS erlaubtekategorie

Drupal 8: Override views row (views-view-fields.html.twig) in views style plugin

In the last days I developed the ZURB Foundation Views integration module for Drupal 8. To match the markup required by foundation accordion we first had to write a views style plugin in our module.

JTL-Shop4 Exportformat mit Varianteneigenschaften im Artikelnamen (z.B. für Idealo)

Nachfolgend das JTL Shop 4 Exportformat am Beispiel Idealo, wenn ihr Name und Wert der Varianten direkt hinter dem Artikelnamen ausgeben möchtet.

Dieser Trick wird z.B. verwendet, um Klicks auf (Kind-)Artikel zu vermeiden, die nur noch in bestimmten Größen lieferbar sind.


{strip}
{assign var="d" value="|"}
{$Artikel->kArtikel}{$d}
{$Artikel->cDeeplink}{$d}

Snippet: Drupal 8 Commerce: Show SKU in product variation inline entity form table

Before our modifications to the IEF table

Today I'd like to share a little snippet with you on how to add or remove fields from the inline entity form line items table in a product edit form.

By default that inline entity form table contains

  • Weight
  • Product variation title
  • Price
  • Status
  • Operations

What we'd like to do in our example is to

JTL Artikel pro Seite Limit 100 Maximum übersteuern (Suche / Kategorien)

Heute ein kleiner Tipp für Anwender von JTL-Shop 3 und JTL-Shop 4:

Drupal 8: Load current entity from controller dynamically *updated*

Today I'd like to discuss a little Drupal 8 snippet to dynamically load an entity from the controller by the current path.

This acts a bit like a Drupal 8 replacement for Drupal 7's menu_get_object().

Use case / example:

VSCode (Visual Studio code) mark dollar sign $ on double click

Visual Studio Code is my new IDE love. It's simple, lightweight but brings great functionality.

One little problem was that when double-clicking a variable with a dollar-sighn ("$") (for example in PHP or JavaScript) not the whole $variable was marked, but only the text without the $.

JTL-Shop 4: AJAX events / hooks / bindings "contentLoaded"

Ein typisches Problem im Umgang mit AJAX ist die (re-)Initialisierung von Scripts auf den nachträglich geladenen Inhalt. Im JTL-Shop 4 stößt man darauf beispielsweise auf Kategorieübersichten bei der Seitennavigation.

Viele Systeme, viele Lösungen