Skip to content

Instantly share code, notes, and snippets.

View willboudle's full-sized avatar

Will Boudle willboudle

View GitHub Profile
@willboudle
willboudle / udpatepassword.sql
Created December 20, 2019 21:51
Magento 2 sql update customer password
UPDATE `customer_entity`
SET `password_hash` = CONCAT(SHA2('xxxxxxxxPASSWORD', 256), ':xxxxxxxx:1')
WHERE `email` = "guysemail@hotmail.com";
@willboudle
willboudle / selectchildren.sql
Created December 20, 2019 17:52
Magento 2 sql - Select children of configurable based on sku
#select children of sku
SELECT
*
FROM
catalog_product_entity cpe
LEFT JOIN catalog_product_super_link cpsl
ON cpe.row_id = cpsl.`parent_id`
LEFT JOIN catalog_product_entity child
ON cpsl.`product_id` = child.`entity_id`
WHERE cpe.sku = "sku";
@willboudle
willboudle / selectparentsku.sql
Last active February 9, 2023 14:03
Magento 2 sql - Select parent sku based on child sku.
#Select parent of a sku
SELECT
parent.sku
FROM
catalog_product_entity parent
WHERE parent.row_id =
(SELECT
relationship.parent_id
FROM
catalog_product_super_link relationship
@willboudle
willboudle / php
Created September 20, 2019 13:20
Magento 2 - Find Parent with no Children ( Configurable with no simple attached)
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
use Magento\Framework\App\Bootstrap;
try{
require __DIR__ . '/app/bootstrap.php';
@willboudle
willboudle / ALLCOLORS
Last active September 19, 2019 16:26
Snippets Devtools
// allcolors.js
// https://github.com/bgrins/devtools-snippets
// Print out CSS colors used in elements on the page.
(function () {
// Should include colors from elements that have a border color but have a zero width?
var includeBorderColorsWithZeroWidth = false;
var allColors = {};
var props = ["background-color", "color", "border-top-color", "border-right-color", "border-bottom-color", "border-left-color"];
@willboudle
willboudle / gist:6195cec9a435203e8f2e802026c35130
Created June 10, 2019 16:13
Select product image using SQL in Magento 2
select gal.value from catalog_product_entity as ent
left join catalog_product_entity_media_gallery_value as val on (ent.row_id = val.row_id)
left join catalog_product_entity_media_gallery as gal on (val.value_id = gal.value_id);
# where ent.type_id='configurable';
@willboudle
willboudle / m2-products-w-attributes.sql
Last active October 1, 2019 16:44
Magetno 2 SQL - all products and attributes
SELECT ce.sku,
ea.attribute_code,
ea.attribute_id,
CASE ea.backend_type
WHEN 'varchar' THEN ce_varchar.store_id
WHEN 'int' THEN ce_int.store_id
WHEN 'text' THEN ce_text.store_id
WHEN 'decimal' THEN ce_decimal.store_id
WHEN 'datetime' THEN ce_datetime.store_id
@willboudle
willboudle / itemswithoptions.sql
Created March 14, 2019 23:13
Magento 1 SQL list items with options
SELECT e.sku ,t.title AS 'name',cv.value AS 'Custom option name'
,GROUP_CONCAT(ot.title) AS 'Custom option values'
FROM catalog_product_option o
JOIN catalog_product_entity e ON e.entity_id=o.product_id
JOIN catalog_product_option_title t ON t.option_id=o.option_id
JOIN catalog_product_entity_varchar cv ON
cv.entity_id=e.entity_id AND
cv.attribute_id=(SELECT attribute_id
FROM eav_attribute ea
JOIN eav_entity_type et
@willboudle
willboudle / gist:a8e8637e4e9d398b0c0abf7bb9913cb0
Created June 4, 2018 17:52
Groove Commerce Magento Robots.txt
# Groove Commerce Magento Robots.txt 05/2011
#
# robots.txt
#
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these “robots” where not to go on your site,
# you save bandwidth and server resources.
#
# This file will be ignored unless it is at the root of your host:
@willboudle
willboudle / gist:9efcd1908c7aae3c669de8f0c8f8e06d
Created June 4, 2018 17:50
Magento Robots.txt 2 - Blue Acorn
User-agent: *
Disallow: /index.php/
Disallow: /*?
Disallow: /*.js$
Disallow: /*.css$
Disallow: /customer/
Disallow: /checkout/
Disallow: /js/
Disallow: /lib/
Disallow: /media/