Snippet

Download PDFs in Cordova InAppBrowser (3.1.0)

I wasted several hours on handling PDF downloads in cordovas inAppBrowser.

My situation was that a page was loaded in inAppBrowser which contained links to PDF Downloads from the same host.
The links simply didn't work.

JTL-Shop 4 "keinBild.gif" Platzhalter Grafik updatesicher ersetzen / überschreiben

Heute ein kleiner Tipp für JTL-Shop Entwickler: Wenn ihr die Platzhalter-Grafik für "Kein Bild vorhanden", z.B. für Kategorien, Produktbilder o.Ä. kundenspezfisch und updatesicher durch Grafiken aus Eurem JTL-Shop Template ersetzen möchtet, könnt ihr dies durch folgende Einträge in der Konfiguration erzielen (Beispiel):

Drupal 8 print current breadcrumb trail with route title

Whao, that wasn't as easy as I thought. I wanted to print out the two top level breadcrumb elements, without "Home", with node title in a custom block. I tried it in many different ways but ran into surprises every time. So finally I'd like to share my code with you, if you should run into the same situation:

Drupal CMS: Change user profile title & tab title

Since I needed some time to find out how to change the user profile tabs title and page title, I'd like to share that information with you.

Drupal 7: Decorate / wrap existing form as separate form with individual path

It's not an untypical situation: You'd like to use an existing Drupal CMS form as base for a custom form under a separate URL. In our example case we will decorate the Registration form "user_register_form" and create a separate registration form under a separate URL. This might be a custom alternative to modules like https://www.drupal.org/project/multiple_registration if they don't match your requirements.

Shopware 5 SEO Router (URLs) aus Freitextfeldern / Attributen überschreiben

Shopware 5 SEO Router (URLs) aus Freitextfeldern / Attributen überschreiben

Heute hatte ich die kleine Herausforderung in Shopware 5 URL's per Freitextfeld-Attribut (z.B. attr20) SEO-URLs diverser Seitentypen manuell zu übersteuern.

Dies erfolgt über die Einstellungen > Grundeinstellungen > SEO/Router-Einstellungen.

Shopware Smarty Plugin URL im Template sauber erstellen mittels Controller (Seiten / Formulare / ...)

Shopware 5 bietet mit einem entsprechenden Smarty Plugin eine gute und sichere Lösung zur URL-Generierung im Template an. Dazu wir die Smarty funktion "url" verwendet, der entsprechende Parameter übergeben werden.

Details dazu finden sich in der Shopware Dokumentation: https://developers.shopware.com/designers-guide/smarty-plugins/#url-plugin

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