Skip to content

Instantly share code, notes, and snippets.

View osrecio's full-sized avatar

Oscar Recio osrecio

View GitHub Profile
@osrecio
osrecio / duplicateOrders.sql
Last active August 29, 2015 14:20
Get Duplicate Orders in Magento
SELECT `quote_id`,
COUNT(`quote_id`) AS `qty_duplicates`,
`increment_id` AS `first_increment_id`,
GROUP_CONCAT( `increment_id` SEPARATOR ' | ' ) AS `increment_ids`,
`created_at`,
`state`,
`status`,
`customer_firstname`,
`customer_lastname`,
`customer_email`,
@osrecio
osrecio / getVersionMage
Created April 23, 2015 19:31
Get Version Magento Command Line
php -r "require 'app/Mage.php'; echo Mage::getVersion();"
@osrecio
osrecio / DebugLayout
Last active August 29, 2015 14:09
Debug Layout Magento
Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
@osrecio
osrecio / orders.sql
Created August 7, 2014 09:06
Get your store’s current order/shipment/invoice /credit memo number
SELECT core_store_group.name AS group_name, core_website.name AS website_name, core_store.name AS store_name, core_store.store_id, increment_prefix, increment_last_id, entity_type_code
FROM eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
INNER JOIN core_store ON core_store.store_id = eav_entity_store.store_id
INNER JOIN core_store_group ON core_store_group.group_id = core_store.group_id
INNER JOIN core_website ON core_website.website_id = core_store.website_id
WHERE eav_entity_store.store_id != 0 ORDER BY eav_entity_store.store_id;
TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
#!/bin/bash
#
# ----------------------------------------------------------------------------
# magento_backup.sh by @OSrecio
#
# Hace una copia de seguridad de la instalacion de magento en la maquina local.
#
# Se crean dos ficheros comprimidos:
# - Un volcado de la base de datos MYSQL.
# - Una copia de la carpeta que contiene la instalacion web.
@osrecio
osrecio / read_csv.php
Created August 12, 2013 09:40
Read CSV - (PHP)
<?php
$row = 0;
$j = 1; // Linea por la que quieres empezar
$file = "name.txt"; //Nombre del fichero
if (($handle = fopen($file, "r")) !== FALSE) {
while (($data = fgetcsv($handle, ",")) !== FALSE) {
print_r($data);
$j++;
$row++;
}
@osrecio
osrecio / Backup_cpanel.sh
Created June 24, 2013 12:55
Get Backup Cpanel ( Files & DB's )
#!/bin/bash
LOG="/path_to_save_logs"
echo "Start backup web `date`" >> $LOG
cd /folder_to_save
FECHAF=`date +%Y.%m.%d`
mkdir $FECHAF
cd $FECHAF
FECHA=`date +%-m-%-d-%Y`
@osrecio
osrecio / Custom.css
Last active December 14, 2015 18:59 — forked from carlosasin/Custom.css
Custom CSS Chrome Cobalt
/*
Cobalt theme by Carlos Asín
************************************
A cobalt theme for Chrome Developer Tools inspired by Sublime Text 2 cobalt theme.
Modifies the source code and other smaller tweaks.
@osrecio
osrecio / SQL: Delete Post Revision WP
Last active December 14, 2015 08:19
Delete Post Revision Wordpress
DELETE a.*,b.*,c.*
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision';