Skip to content

Instantly share code, notes, and snippets.

View elisei's full-sized avatar
:octocat:
Isto fica feliz em ser útil!

Bruno elisei

:octocat:
Isto fica feliz em ser útil!
View GitHub Profile
@elisei
elisei / Sales-by-category.sql
Created January 20, 2017 19:17 — forked from tegansnyder/Sales-by-category.sql
Finding the category that has the most sales in Magento
SELECT cat_id, SUM(row_total) as total_sales_by_cat, cv.value FROM (
SELECT c2.entity_id as cat_id, si.row_total
FROM catalog_category_product c1
INNER JOIN catalog_category_entity_varchar c2 ON (c1.category_id = c2.entity_id)
INNER JOIN catalog_product_entity c3 ON (c1.product_id = c3.entity_id)
INNER JOIN sales_flat_order_item si ON (si.product_id = c3.entity_id)
WHERE c2.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'name' AND entity_type_id = 3)
ORDER BY si.created_at DESC
) main
INNER JOIN catalog_category_entity_varchar cv ON (cv.entity_id = cat_id)
@elisei
elisei / magento-code-snippets.md
Created August 10, 2016 20:21 — forked from arosenhagen/magento-code-snippets.md
[magento] - code snippets

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@elisei
elisei / Category.sql
Created August 10, 2016 20:12 — forked from ticean/Category.sql
A series of queries for selecting Magento entity EAV attributes, and their values. Lots of union here...
SET @entityid = '3';
SELECT ea.attribute_id, ea.attribute_code, eav.value AS 'value', 'varchar' AS 'type'
FROM catalog_category_entity e
JOIN catalog_category_entity_varchar eav
ON e.entity_id = eav.entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE e.entity_id = @entityid
UNION
@elisei
elisei / hhvm_magento_setup.md
Created June 4, 2016 01:51 — forked from tegansnyder/hhvm_magento_setup.md
HHVM Magento Server Setup

I've had the opertunity to try a variety of different server configurations but never really got around to trying HHVM with Magento until recently. I thought I would share a detailed walkthrough of configuring a single instance Magento server running Nginx + Fast CGI + HHVM / PHP-FPM + Redis + Percona. For the purpose of this blog post I'm assuming you are using Fedora, CentOS, or in my case RHEL 6.5.

Please note: I'm 100% open to suggestions. If you see something I did that needs to be done a different way, please let me know. I haven't included my Perconca my.conf file yet. I will shortly. Also I plan on trying this same test with HHVM 3.3 and PHP 7.

Install the EPEL, Webtatic, and REMI repos

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm