Skip to content

Instantly share code, notes, and snippets.

View tdgroot's full-sized avatar
🔌

Timon de Groot tdgroot

🔌
View GitHub Profile
@tdgroot
tdgroot / disable_unused_magento2_modules.sh
Last active January 11, 2021 11:27
Disable unused Magento 2 modules
#!/bin/bash
bin/magento module:status | \
grep -E '(Magento_(Adobe|Inventory|Braintree|Signifyd|Fedex|Marketplace|Authorizenet.*|.*GraphQl.*|.*Analytics)|Temando_|Amazon_|Dotdigitalgroup_|Vertex_|Klarna_)' | \
grep -v Magento_GoogleAnalytics | \
xargs bin/magento module:disable
--- view/frontend/web/js/block-submit-on-send.orig.js 2020-11-19 12:44:54.544000000 +0100
+++ view/frontend/web/js/block-submit-on-send.js 2020-11-19 12:45:18.409967078 +0100
@@ -14,9 +14,15 @@
dataForm.submit(function () {
$(this).find(':submit').attr('disabled', 'disabled');
+
+ if (this.isValid === false) {
+ $(this).find(':submit').prop('disabled', false);
+ }
@tdgroot
tdgroot / MAGENTO_27311.patch
Created March 17, 2020 11:01
Magento 2.3 patch for pull request magento/magento#27311
--- view/base/web/js/form/element/date.orig.js 2019-09-19 12:30:58.000000000 +0200
+++ view/base/web/js/form/element/date.js 2020-03-17 11:51:49.691288844 +0100
@@ -111,21 +111,19 @@
* Prepares and sets date/time value that will be displayed
* in the input field.
*
- * @param {String} value
+ * @inheritDoc
*/
- onValueChange: function (value) {
--- a/Block/Product/ProductsList.php
+++ b/Block/Product/ProductsList.php
@@ -8,6 +8,7 @@
use Magento\Catalog\Api\CategoryRepositoryInterface;
use Magento\Catalog\Block\Product\AbstractProduct;
+use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Block\Product\Widget\Html\Pager;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Visibility;
@tdgroot
tdgroot / catalog_graphql_image_size.patch
Created April 10, 2020 16:18
Add size to Magento_CatalogGraphQl MediaGallery Url field
--- etc/schema.orig.graphqls 2020-01-10 06:20:38.000000000 +0100
+++ etc/schema.graphqls 2020-04-10 18:07:05.630098596 +0200
@@ -197,7 +197,7 @@
}
interface MediaGalleryInterface @doc(description: "Contains basic information about a product image or video.") @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\MediaGalleryTypeResolver") {
- url: String @doc(description: "The URL of the product image or video.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGallery\\Url")
+ url(width: Int, height: Int): String @doc(description: "The URL of the product image or video.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGallery\\Url")
label: String @doc(description: "The label of the product image or video.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGallery\\Label")
}
@tdgroot
tdgroot / fix_varnish_missing_topmenu_github_3421.patch
Created June 10, 2020 07:06
Apply using cweagans/composer-patches, patch it for package magento/module-theme!
--- view/frontend/layout/default.orig.xml 2020-06-10 09:03:29.889000000 +0200
+++ view/frontend/layout/default.xml 2020-06-10 09:03:36.624645526 +0200
@@ -70,7 +70,7 @@
<arguments>
<argument name="title" translate="true" xsi:type="string">Menu</argument>
</arguments>
- <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="Magento_Theme::html/topmenu.phtml" ttl="3600" before="-"/>
+ <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="Magento_Theme::html/topmenu.phtml" before="-"/>
</block>
<block class="Magento\Framework\View\Element\Text" name="store.links" group="navigation-sections">
--- Model/Config.php 2020-04-23 08:56:42.000000000 +0200
+++ Model/Config.php 2020-05-15 16:28:16.337488649 +0200
@@ -822,6 +822,10 @@
$fullAttributeData = array_key_exists('is_required', $attributeData);
if ($existsFullAttribute || (!$existsFullAttribute && !$fullAttributeData)) {
+ $scopeIsRequired = $attributeData['scope_is_required'] ?? null;
+ if ($scopeIsRequired !== null) {
+ $attribute->setData('scope_is_required', $scopeIsRequired);
+ }
@tdgroot
tdgroot / gist:fa1b83773fd96a00fa6f531f873c30a0
Last active February 28, 2020 09:56
Update Magento 1 copyrights to 2020
grep -rl --exclude="vendor/*" "Copyright (c) 2006-2019 Magento, Inc. (http://www.magento.com)" | xargs sed -i 's#Copyright (c) 2006-2019 Magento, Inc. (http://www.magento.com)#Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)#g'
--- a/Plugin/Block/Topmenu.php
+++ b/Plugin/Block/Topmenu.php
@@ -193,4 +193,21 @@ protected function getCategoryTree($storeId, $rootId)
return $collection;
}
+
+ /**
+ * Add active
+ *