Skip to content

Instantly share code, notes, and snippets.

Avatar

Achim Rosenhagen arosenhagen

View GitHub Profile
@arosenhagen
arosenhagen / LocalAdapterFactory.patch
Created Nov 6, 2020
[PATCH] Shopware - Allow definition of strategy in media adapter (allow migrating back to plain strategy)
View LocalAdapterFactory.patch
diff --git a/engine/Shopware/Bundle/MediaBundle/Adapters/LocalAdapterFactory.php b/engine/Shopware/Bundle/MediaBundle/Adapters/LocalAdapterFactory.php
index b7c02b3a28..f93b4eeab3 100644
--- a/engine/Shopware/Bundle/MediaBundle/Adapters/LocalAdapterFactory.php
+++ b/engine/Shopware/Bundle/MediaBundle/Adapters/LocalAdapterFactory.php
@@ -65,11 +65,12 @@ class LocalAdapterFactory implements AdapterFactoryInterface
$options = new OptionsResolver();
$options->setRequired(['root']);
- $options->setDefined(['file', 'dir', 'mediaUrl', 'type', 'permissions', 'url']);
+ $options->setDefined(['strategy', 'file', 'dir', 'mediaUrl', 'type', 'permissions', 'url']);
@arosenhagen
arosenhagen / SensusInxmailConnect.patch
Created Oct 7, 2019
[PATCH] Shopware - Fix SensusInxmailConnect debug logging
View SensusInxmailConnect.patch
diff --git a/Service/Session.php b/Service/Session.php
index 369e9e8..9836a31 100644
--- a/Service/Session.php
+++ b/Service/Session.php
@@ -34,7 +34,6 @@ class Session extends AbstractService
$this->session = \Inx_Api_Session::createRemoteSession($config['server'], $config['user'], $config['pass']);
$this->sessionCreationTimestamp = time();
- Shopware()->Container()->get('pluginlogger')->err('Return new session');
return $this->session;
View gist:7cd01923e57ea93f44640a3ae8521473
Verifying my Blockstack ID is secured with the address 1RhdHiBoKn7kVGrxhWqLJ1FChrv82XJJX https://explorer.blockstack.org/address/1RhdHiBoKn7kVGrxhWqLJ1FChrv82XJJX
View gist:b794de67d936d557318edde5228c8355
Verifying that "arosenhagen.id" is my Blockstack ID. https://explorer.blockstack.org/name/arosenhagen.id
@arosenhagen
arosenhagen / maintenance.patch
Last active Aug 29, 2019
[PATCH] Shopware - Return HTTP 200 for maintenance mode
View maintenance.patch
diff --git a/engine/Shopware/Controllers/Frontend/Error.php b/engine/Shopware/Controllers/Frontend/Error.php
index d546d4c41c..c1333f6471 100644
--- a/engine/Shopware/Controllers/Frontend/Error.php
+++ b/engine/Shopware/Controllers/Frontend/Error.php
@@ -199,7 +199,7 @@ class Shopware_Controllers_Frontend_Error extends Enlight_Controller_Action impl
*/
public function serviceAction()
{
- $this->Response()->setHttpResponseCode(503);
+ $this->Response()->setHttpResponseCode(200);
@arosenhagen
arosenhagen / ShopwareFonts.patch
Created May 27, 2019
[PATCH] Shopware - Remove shopware-revision from font links
View ShopwareFonts.patch
diff --git a/themes/Frontend/Responsive/frontend/_public/src/less/_components/fonts.less b/themes/Frontend/Responsive/frontend/_public/src/less/_components/fonts.less
index b582c292da..e66d142be9 100644
--- a/themes/Frontend/Responsive/frontend/_public/src/less/_components/fonts.less
+++ b/themes/Frontend/Responsive/frontend/_public/src/less/_components/fonts.less
@@ -6,9 +6,9 @@
font-display: swap;
src: local('Open Sans Light'),
local('OpenSans-Light'),
- url('@{OpenSansPath}/Light/OpenSans-Light.woff2?@{shopware-revision}') format('woff2'),
- url('@{OpenSansPath}/Light/OpenSans-Light.woff?@{shopware-revision}') format('woff'),
@arosenhagen
arosenhagen / MediaOptimizer.patch
Created Apr 3, 2019
[PATCH] Shopware - Fix absolute paths to MediaOptimizers
View MediaOptimizer.patch
diff --git a/engine/Shopware/Bundle/MediaBundle/Optimizer/GuetzliOptimizer.php b/engine/Shopware/Bundle/MediaBundle/Optimizer/GuetzliOptimizer.php
index c5ac2fef2b..0f01712841 100644
--- a/engine/Shopware/Bundle/MediaBundle/Optimizer/GuetzliOptimizer.php
+++ b/engine/Shopware/Bundle/MediaBundle/Optimizer/GuetzliOptimizer.php
@@ -31,7 +31,7 @@ class GuetzliOptimizer extends BinaryOptimizer
*/
public function getCommand()
{
- return 'guetzli';
+ return '/usr/bin/guetzli';
@arosenhagen
arosenhagen / pre-commit.sh
Created Dec 7, 2018
Pre Commit Hook for Shopware Plugin
View pre-commit.sh
#!/bin/sh
CWD=$(pwd)
STATUS=0
echo "Running PHPCS"
if [ -f $CWD/bin/php-cs-fixer ]
then
$CWD/bin/php-cs-fixer fix --dry-run --allow-risky=yes --config=$CWD/.php_cs.dist
@arosenhagen
arosenhagen / gist:f8fcaa227aba3618750b
Created Mar 8, 2015
Adjusting VCS files for Berkshelf
View gist:f8fcaa227aba3618750b

If you plan to use git, you may encounter a permission denied error while running vagrant provision:

stderr: /opt/chefdk/embedded/lib/ruby/2.1.0/fileutils.rb:1402:in `initialize': Permission denied @ rb_sysopen - /home/USER/.berkshelf/vagrant-berkshelf/shelves/berkshelf (...) (Errno::EACCES)
    from /opt/chefdk/embedded/lib/ruby/2.1.0/fileutils.rb:1402:in `open'

If it happens, add '**/.git' to the EXCLUDED_VCS_FILES_WHEN_VENDORING in the /opt/chefdk/embedded/apps/berkshelf/lib/berkshelf/berksfile.rb to instruct Berkshelf to ignore git’s metadata which is stored in the .git folder.

@arosenhagen
arosenhagen / order-set-state
Created Feb 19, 2015
Magento: Set order states by orderIncrementId programmatically
View order-set-state
<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
$orderIncrementIds[] = XXX;
$orderIncrementIds[] = XXX;
foreach ($orderIncrementIds as $orderIncrementId){
$order = Mage::getModel('sales/order')->load($orderIncrementId);