Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Remove Magento's orphan images web console</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Inconsolata:400,700&subset=latin,latin-ext' rel='stylesheet'
type='text/css'>
<style type="text/css">
@oreales
oreales / mysql-default-value-product-attributes.sql
Last active November 22, 2019 19:57
Magento: como volver a marcar el checkbox "valor por defecto" en los atributos de producto que tienen el mismo valor que la store view por defecto.
#LIMPIANDO DATETIME
#borramos los valores de atributo de la tienda 1 (o la que comparta valores con el admin / default)
#porque los valores seran los de por defecto. y los atributos cuyo valor sea NULL
DELETE FROM catalog_product_entity_datetime WHERE store_id = 1 OR `value` IS NULL;
DELETE otherStores
FROM catalog_product_entity_datetime as defaultStore
INNER JOIN catalog_product_entity_datetime as otherStores ON (defaultStore.attribute_id = otherStores.attribute_id AND defaultStore.entity_id = otherStores.entity_id)
WHERE
defaultStore.store_id = 0
@oreales
oreales / mysql-select-to-csv.mysql
Created November 11, 2016 20:01
Exportando desde MySQL a csv
#Por ejemplo para importar a Apple Numbers
SELECT *
FROM orders
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
#SELECT que nos da las labels de productos configurables que no estan usando el valor por defecto (traducciones) establecido para este atributo / store view en el admin.
SELECT * FROM catalog_product_super_attribute_label as sal
LEFT JOIN catalog_product_super_attribute as sa USING (product_super_attribute_id)
LEFT JOIN eav_attribute_label as al ON (sal.store_id = al.store_id AND sa.attribute_id = al.attribute_id)
WHERE sal.store_id != 0
AND sal.value != al.value;
#SQL para obtener los productos que hay en stock en cada website:
SELECT w.name as site, count(`product_id`) as productos_en_stock FROM cataloginventory_stock_status AS s LEFT JOIN core_website as w USING(website_id) WHERE stock_status = 1 GROUP BY website_id
@oreales
oreales / git sort tags
Last active December 9, 2015 18:54
Git ordenar tags (2 formas)
#en versiones nuevas de git, usando el param --sort para tags
git tag --sort v:refname
#se puede añadir a configuracion global
git config --global tag.sort="v:refname"
#para versiones anteriores a la 1.8 que no tienen el --sort parameter
git tag -l | sort -V
@oreales
oreales / omnifocus-delegate.scpt
Last active December 4, 2015 00:56
Applescript Omnifocus que uso para delegar tareas en mi flujo de GTD
tell application "OmniFocus"
try
set dialogReply to (display dialog ¬
"A quien delegas?" with title ¬
"Nombred del contacto a quien delegas..." default answer ¬
"Contacto en mi AddressBook" buttons {"Preparar Mail", "Delegar"} default button 2)
set delegateTo to text returned of dialogReply
@oreales
oreales / mgCategoriesToAnchor.php
Last active December 1, 2015 23:50
Magento: poner todas las categorías a anchor script php
<?php
/**
* todas las categorías de nivel 4 las ponemos a anchor
* por ejemplo para que tengan "filtros" (layered nav)
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
// Load Up Magento Core
define('MAGENTO', realpath(''));
@oreales
oreales / buyers-subscribers-emails
Last active August 29, 2015 14:25
Magento: Sacar emails de subscriptores y compradores de un store view
SET @storeId = 10;
(SELECT subscriber_email as email FROM newsletter_subscriber WHERE store_id = @storeId)
UNION DISTINCT
(SELECT customer_email FROM sales_flat_order WHERE store_id = @storeId);
@oreales
oreales / select_attributes.sql
Last active August 29, 2015 14:22
Magento: Productos Precio Especial SELECT
#SELECT special_from_date and special_to_date 77 y 78
SELECT * FROM eav_attribute WHERE attribute_code LIKE 'special%date' AND entity_type_id=4;
#SELECT el atributo special_price
SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'special_price' AND entity_type_id=4;