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 / rest_test.php
Created February 22, 2018 13:22 — forked from xcommerce-gists/rest_test.php
Magento coupon code generator test script
<?php
/********************************************************************
File name: rest_test.php
Description:
A PHP test script that calls the Coupon AutoGen extension
to Magento's REST API.
The Coupon AutoGen API takes:
-- the rule ID of the &quot;Generate Coupons&quot; rule to execute
-- the number of coupon codes to generate
-- the length of each coupon code
@elisei
elisei / moip_onestepcheckout.xml
Created December 12, 2017 12:23
moip_onestepcheckout.xml para thema porto
<?xml version="1.0"?>
<layout version="0.1.0">
<checkout_onepage_cadastro>
<reference name="root">
<action method="setTemplate"><template>MOIP/onestepcheckout/page/1column.phtml</template></action>
</reference>
<reference name="head">
<remove name="addthis_smartlayers" />
<action method="addJs" ifconfig="moipall/config/enable_jquery"><script>MOIP/core/jquery.js</script></action>
@elisei
elisei / local.xml
Created June 13, 2017 19:14 — forked from MikeWilkie/local.xml
Magento – Disable Excessive Logging and Reporting in app/etc/local.xml
<?xml version="1.0"?>
<!-- license -->
<config>
<global>
<!-- global config -->
</global>
<frontend>
<events>
<!-- disble logs -->
<controller_action_predispatch>
@elisei
elisei / addExportButtonMagentoRecurringProfiles.php
Created January 20, 2017 20:33 — forked from tegansnyder/addExportButtonMagentoRecurringProfiles.php
To add a export button to Magento Recurring Profiles edit this file: /app/code/core/Mage/Adminhtml/controllers/Sales/Recurring/ProfileController.php
<?php
// ADD THIS CODE
/**
* Export order grid to CSV format
*/
public function exportCsvAction()
{
$fileName = 'subscriptions.csv';
@elisei
elisei / Get-OrderIncrementID-recurring-profiles-success-page.php
Created January 20, 2017 20:29 — forked from tegansnyder/Get-OrderIncrementID-recurring-profiles-success-page.php
Get Order Increment ID on success.phtml file for recurring profiles
<?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>';
<?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();
?>
@elisei
elisei / abandon-cart.sql
Created January 20, 2017 20:02 — forked from tegansnyder/abandon-cart.sql
Abandon Cart example
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
@elisei
elisei / email-test.php
Created January 20, 2017 19:59 — forked from tegansnyder/email-test.php
email testing SMTP outbound relay on Magento
<?php
/**
* email-tester.php
* A tool to test if the SMTP relay is working
*
* @category Mmm
* @package EmailTester
* @author Tegan Snyder
*
*/
@elisei
elisei / Magento-new-customer-sales-by-month-year.sql
Created January 20, 2017 19:17 — forked from tegansnyder/Magento-new-customer-sales-by-month-year.sql
Magento - New Customer Sales Averages and Totals by Month and Year - direct 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-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
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,