Skip to content

Instantly share code, notes, and snippets.

Bruno elisei

Block or report user

Report or block elisei

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View hhvm_magento_setup.md

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
@elisei
elisei / Category.sql
Created Aug 10, 2016 — forked from ticean/Category.sql
A series of queries for selecting Magento entity EAV attributes, and their values. Lots of union here...
View Category.sql
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
View magento-code-snippets.md

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 / Sales-by-category.sql
Created Jan 20, 2017 — forked from tegansnyder/Sales-by-category.sql
Finding the category that has the most sales in Magento
View Sales-by-category.sql
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-Average-Orders-Average-Discounts-Totals-by-Month-Year.sql Magento get average order, discount, item count, and order amount break down by month and year with direct SQL
View Magento-Average-Orders-Average-Discounts-Totals-by-Month-Year.sql
SELECT sub_query.month_ordered,
sub_query.year_ordered,
AVG(sub_query.base_subtotal) AS average_base_subtotal,
AVG(sub_query.discount_amount) AS average_discount_amt,
AVG(sub_query.order_qty) AS average_total_item_count,
COUNT(sub_query.entity_id) AS total_orders
FROM
(SELECT so.entity_id,
MONTH(so.created_at) AS month_ordered,
YEAR(so.created_at) AS year_ordered,
@elisei
elisei / Magento-new-customer-sales-by-month-year.sql
Created Jan 20, 2017 — forked from tegansnyder/Magento-new-customer-sales-by-month-year.sql
Magento - New Customer Sales Averages and Totals by Month and Year - direct sql
View Magento-new-customer-sales-by-month-year.sql
SELECT sub_query.month_ordered,
sub_query.year_ordered,
AVG(sub_query.base_subtotal) AS average_base_subtotal,
AVG(sub_query.discount_amount) AS average_discount_amt,
AVG(sub_query.order_qty) AS average_total_item_count,
COUNT(sub_query.entity_id) AS total_orders
FROM
(SELECT so.entity_id,
MONTH(so.created_at) AS month_ordered,
YEAR(so.created_at) AS year_ordered,
@elisei
elisei / email-test.php
Created Jan 20, 2017 — forked from tegansnyder/email-test.php
email testing SMTP outbound relay on Magento
View email-test.php
<?php
/**
* email-tester.php
* A tool to test if the SMTP relay is working
*
* @category Mmm
* @package EmailTester
* @author Tegan Snyder
*
*/
@elisei
elisei / abandon-cart.sql
Created Jan 20, 2017 — forked from tegansnyder/abandon-cart.sql
Abandon Cart example
View abandon-cart.sql
SELECT `main_table`.*,
(main_table.base_subtotal_with_discount*main_table.base_to_global_rate) AS `subtotal`,
`cust_email`.`email`,
`cust_fname`.`value` AS `firstname`,
`cust_lname`.`value` AS `lastname`,
CONCAT_WS(' ', cust_fname.value, cust_lname.value) AS `customer_name`
FROM `sales_flat_quote` AS `main_table`
INNER JOIN `customer_entity` AS `cust_email` ON cust_email.entity_id = main_table.customer_id
INNER JOIN `customer_entity_varchar` AS `cust_fname` ON cust_fname.entity_id = main_table.customer_id
AND cust_fname.attribute_id = 5
View GetLastRecurringOrderID.php
<?php
$last_recurring_profile_id = $_SESSION['checkout']['last_recurring_profile_ids'][0];
$customer_id = Mage::getSingleton('customer/session')->getCustomerId();
$order = Mage::getResourceModel('sales/order_collection')
->addFieldToFilter('customer_id', $customer_id)
->addRecurringProfilesFilter($last_recurring_profile_id)
->setOrder('entity_id', 'desc')
->getFirstItem();
?>
View Get-OrderIncrementID-recurring-profiles-success-page.php
<?php
$order = Mage::getResourceModel('sales/order_collection')
->addFieldToFilter('customer_id', $customer_id)
->addRecurringProfilesFilter($profile->getProfileId())
->setOrder('entity_id', 'desc')
->getFirstItem();
echo '<pre>';
print_r($order->getData());
echo '</pre>';
You can’t perform that action at this time.