Skip to content

Instantly share code, notes, and snippets.

View molotovbliss's full-sized avatar
⚗️
Code, Eat, Sleep++;

Jared molotovbliss

⚗️
Code, Eat, Sleep++;
  • DFW, Texas
View GitHub Profile
@wigman
wigman / Compress Magento media
Last active August 6, 2021 12:49
Compress Magento media from commandline
# you need these installed if you want to:
sudo apt-get update
# resize images
sudo apt-get install imagemagick -y
# compress jpg and png files
sudo apt-get install jpegoptim optipng
# compress video's
sudo apt-get install ffmpeg
@rsisco
rsisco / gist:6deeb3209ec9a396c859ca249a9ab5fa
Last active January 11, 2021 23:07
Magento 2 - Identify gallery image files missing from filesystem
mysql -u <user> -p <db> -h <host> -e "SELECT distinct case when value like '/%' then concat('.',value) else value end FROM catalog_product_entity_media_gallery" | awk '{print $1}' | xargs ls | grep "cannot access"
@satishgumudavelli
satishgumudavelli / magento2preview.php
Created November 12, 2019 13:30
Magento 2 order,invoice,shipment,credit meno preview emails
<?php
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$objectManager = $bootstrap->getObjectManager();
@antoinekociuba
antoinekociuba / m2_clean_product_eav_values.sql
Created November 10, 2019 02:12
Magento 2 - Clean product EAV values (zombie product values, even if attribute(s) is/are not on concerned attribute set(s) anymore). Inspiration from https://github.com/magento/data-migration-tool/issues/598
CREATE TABLE catalog_product_entity_int_old LIKE catalog_product_entity_int;
INSERT INTO catalog_product_entity_int_old SELECT * FROM catalog_product_entity_int;
DELETE FROM catalog_product_entity_int
WHERE value_id IN
(SELECT cpei.value_id
FROM catalog_product_entity_int_old cpei
WHERE cpei.attribute_id NOT IN
(SELECT eea.attribute_id
FROM eav_entity_attribute eea
@BrocksiNet
BrocksiNet / mysql-select-simples-not-assigned-to-parents.sql
Last active February 10, 2020 19:50
Magento2 - MySQL Select simples products not assigned to parents
SELECT * FROM `catalog_product_entity`
LEFT JOIN `catalog_product_entity_int` ON `catalog_product_entity`.`entity_id` = `catalog_product_entity_int`.`entity_id`
WHERE `catalog_product_entity`.`type_id` = 'simple' AND `catalog_product_entity_int`.`attribute_id` = (SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code` = 'visibility') AND `catalog_product_entity_int`.`value` = 1 AND `catalog_product_entity`.`entity_id` NOT IN
(
SELECT `product_id` FROM `catalog_product_super_link`
)
@pobegov
pobegov / convert_latin1_data_in_a_utf8_mysql_database_to_utf8mb4.php
Created July 4, 2019 17:12
Convert MySQL Database (tables and data) to UTF8MB4, where UTF8 data stored via latin1 connection
<?php
/**
* Requires php >= 5.5
*
* Use this script to convert utf-8 data in utf-8 mysql tables stored via latin1 connection
* This is a PHP port from: https://gist.github.com/njvack/6113127
*
* BACKUP YOUR DATABASE BEFORE YOU RUN THIS SCRIPT!
*
* Once the script ran over your databases, change your database connection charset to utf8:
@satishgumudavelli
satishgumudavelli / Test.php
Last active December 23, 2021 08:45
magento 2 add video to product programmatically
<?php
namespace Yourcompany\Yourmodule\Controller\Test;
use Magento\Framework\Api\Data\VideoContentInterface;
use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface;
use Magento\Framework\App\Action\Context;
use Magento\ProductVideo\Model\Product\Attribute\Media\ExternalVideoEntryConverter;
use Magento\Store\Model\Store;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\StateException;
@satishgumudavelli
satishgumudavelli / loginascustomer.php
Last active November 24, 2020 06:52
Magento 2 login as customer
<?php
ini_set('display_errors', '1');
ini_set('error_reporting', E_ALL);
use Magento\Framework\App\Bootstrap;
require 'app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
@Vinai
Vinai / magento-composer-issues.md
Last active April 15, 2020 03:09
My beef with composer and Magento
@yogeshdubey2006
yogeshdubey2006 / instruction.txt
Created March 27, 2019 06:53
Magento 2- Add animation to sections on scroll and Preloader
<!-- AOS -->
Step 1: follow: https://michalsnik.github.io/aos/
Step 2: Add
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
Step 3: add jquery dependency (requirejs-config.js)
var config = {
shim: {
jquery: {