Skip to content

Instantly share code, notes, and snippets.

View scgoeswild's full-sized avatar

Simone Chinaglia scgoeswild

View GitHub Profile
@scgoeswild
scgoeswild / stripe-mobile.patch
Last active September 1, 2022 10:18
Magento2 Stripe patch for Amazon Pay wallet payment
#This Magento patch fix the Stripe module which override the Amazon Pay Wallet even if is selected as gateway.
--- vendor/stripe/module-payments/view/frontend/web/js/view/payment/apple_pay.js 2022-08-31 10:42:45.101389300 -0400
+++ vendor/stripe/module-payments/view/frontend/web/js/view/payment/apple_pay.js 2022-08-31 10:41:38.809286854 -0400
@@ -10,6 +10,7 @@
'Magento_Checkout/js/action/select-payment-method',
'Magento_Checkout/js/checkout-data',
'Magento_Checkout/js/model/quote',
+ 'Amazon_Pay/js/model/storage',
@scgoeswild
scgoeswild / theme.js
Created August 10, 2022 09:03
Datadog specific domain activation
<script>
const applicableDomains = [
"your-domain.it",
"your-domain.com",
"your-domain.uk",
"your-domain.fr",
"your-domain.eu",
"your-domain.de"
];
@scgoeswild
scgoeswild / Currency.php
Created March 31, 2022 14:42
Magento2 not shows currency symbol
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*vendor\magento\module-directory\Model\Currency.php
*/
namespace Magento\Directory\Model;
use Magento\Framework\App\ObjectManager;
@scgoeswild
scgoeswild / images.sql
Created March 25, 2022 14:14
Unhide magento2 images (gallery) programmatically in SQL
UPDATE `catalog_product_entity_media_gallery_value` SET `disabled` = 0 WHERE `value_id` IN (
SELECT `value_id` FROM `catalog_product_entity_media_gallery` WHERE `value` IN (
SELECT `value` FROM `catalog_product_entity_varchar` WHERE `attribute_id` = (
SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code` = "image" AND `frontend_label` = "Base" LIMIT 1 ) ) )
@scgoeswild
scgoeswild / AdminSessionInfo.php
Created March 21, 2022 12:35
TypeError: strtotime() expects parameter 1 to be string, null given in /vendor/magento/module-security/Model/AdminSessionInfo.php:136
#/home/production/vendor/magento/module-security/Model/AdminSessionInfo.php:136
public function isSessionExpired()
{
$lifetime = $this->securityConfig->getAdminSessionLifetime();
$currentTime = $this->dateTime->gmtTimestamp();
$lastUpdatedTime = $this->getUpdatedAt();
if (empty($lastUpdatedTime)) {
return true;
}
if (!is_numeric($lastUpdatedTime)) {
@scgoeswild
scgoeswild / install.sh
Created March 3, 2022 09:43
Magento advance installation
php bin/magento setup:install --base-url=http://127.0.0.1/magento2/ \
--db-host=localhost --db-name=magento --db-user=magento --db-password=magento \
--admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
--admin-user=admin --admin-password=admin123 --language=en_US \
--currency=USD --timezone=America/Chicago --cleanup-database \
--sales-order-increment-prefix="ORD$" --session-save=db --use-rewrites=1 \
--search-engine=elasticsearch7 --elasticsearch-host=es-host.example.com \
--elasticsearch-port=9200
@scgoeswild
scgoeswild / query.sql
Created February 15, 2022 21:39
Magento2 move customers to another website
UPDATE `customer_eav_attribute_website` SET `website_id` = NEW_WEBSITE_ID WHERE `website_id` = OLD_WEBSITE_ID;
@scgoeswild
scgoeswild / .htaccess
Created February 10, 2022 04:36
Magento2 setup apache2 multiwebsite
SetEnvIf Host ^(.)mcstaging.50-ml.it MAGE_RUN_CODE=IT
SetEnvIf Host ^(.)mcstaging.50-ml.it MAGE_RUN_CODE=EN
@scgoeswild
scgoeswild / import.yaml
Created December 28, 2021 22:50
Jelastic root user
version: 1.5
type: update
categories:
- apps/dev-tools
targetNodes:
nodeGroup:
- bl
- cp
- sqldb
- nosqldb
@scgoeswild
scgoeswild / invoice.php
Created September 10, 2021 21:58
Magento2 order invoice with custom footer field
<?php
/**
* add this file to /var/www/html/app/code/Simeone/InvoicePdf/Pdf
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Model\Order\Pdf;
use Magento\Sales\Model\ResourceModel\Order\Invoice\Collection;