Skip to content

Instantly share code, notes, and snippets.

💭
Stay'n cold in Minnesota

Tegan Snyder tegansnyder

💭
Stay'n cold in Minnesota
Block or report user

Report or block tegansnyder

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
@tegansnyder
tegansnyder / Magento-Customers-With-Multiple-Recurring-Profiles.php
Created Dec 14, 2012
Create a CSV of Magento Customers with more than one recurring profile attached to their account.
View Magento-Customers-With-Multiple-Recurring-Profiles.php
<?php
error_reporting(E_ALL | E_STRICT);
require_once 'app/Mage.php';
Varien_Profiler::enable();
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app('default');
$collection = Mage::getModel('customer/customer')
@tegansnyder
tegansnyder / Magento-Recurring-Profile-CSV-Customers-Export.php
Created Dec 14, 2012
Produce a CSV of All Magento Customers with Recurring Profile Details
View Magento-Recurring-Profile-CSV-Customers-Export.php
<?php
// Produce a CSV of All the Customers with Recurring Profile Details
error_reporting(E_ALL | E_STRICT);
require_once 'app/Mage.php';
Varien_Profiler::enable();
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app('default');
@tegansnyder
tegansnyder / Magento-Reset-Discounts-By-IncrementId.php
Created Dec 14, 2012
Magento load an order by IncrementId and clear and discounts that applied on the order.
View Magento-Reset-Discounts-By-IncrementId.php
<?php
error_reporting(E_ALL | E_STRICT);
require_once 'app/Mage.php';
Varien_Profiler::enable();
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app('default');
$order = Mage::getModel('sales/order')->loadByIncrementId('100126630');
@tegansnyder
tegansnyder / Magento-Get-Coupon-Codes-Used-on-Recurring-Profiles.php
Created Dec 17, 2012
Get a list of coupons used on recurring profiles in Magento
View Magento-Get-Coupon-Codes-Used-on-Recurring-Profiles.php
<?php
require_once 'app/Mage.php';
Varien_Profiler::enable();
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app('default');
$profile = Mage::getModel('sales/recurring_profile')->getCollection();
@tegansnyder
tegansnyder / addExportButtonMagentoRecurringProfiles.php
Created Dec 31, 2012
To add a export button to Magento Recurring Profiles edit this file: /app/code/core/Mage/Adminhtml/controllers/Sales/Recurring/ProfileController.php
View addExportButtonMagentoRecurringProfiles.php
<?php
// ADD THIS CODE
/**
* Export order grid to CSV format
*/
public function exportCsvAction()
{
$fileName = 'subscriptions.csv';
@tegansnyder
tegansnyder / Get-OrderIncrementID-recurring-profiles-success-page.php
Created Jan 3, 2013
Get Order Increment ID on success.phtml file for recurring profiles
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>';
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();
?>
@tegansnyder
tegansnyder / Mixpanel-Revenue-PHP.php
Created Jan 15, 2013
Here is an example of how to track Mixpanel Revenue Data using PHP and HTTP Post methods.
View Mixpanel-Revenue-PHP.php
<?php
$params = array(
'$append' => array(
'$transactions' => array(
'$time' => '2013-01-03T00:58:05',
'$amount' => 125.34
),
),
'$token' => 'YOUR_MIX_PANEL_TOKEN',
@tegansnyder
tegansnyder / Magento-Abandon-Cart-Tied-To-Mixpanel-Engage-Like-A-Boss.php
Last active Apr 24, 2018
An example of creating an Abandon Cart report utilizing Mixpanel. This queries Magento for abandon carts then updates few people properties at Mixpanel. Then in Mixpanel you can create an "Engage" report that sends emails to folks that have "cart_created_at" less than 1 day and it will send emails to these people. Pretty niffted idea.
View Magento-Abandon-Cart-Tied-To-Mixpanel-Engage-Like-A-Boss.php
<?php
require_once('app/Mage.php');
umask(0);
Mage::app();
$log = '';
$db_conn = Mage::getSingleton('core/resource');
$r_conn = $db_conn->getConnection('core_read');
@tegansnyder
tegansnyder / GetMagentoCustomerIDbyEmail.php
Created Feb 19, 2013
Short example of getting customer_id of a Magento customer via email address outside of Magento via direct SQL
View GetMagentoCustomerIDbyEmail.php
<?php
require_once('/site/app/Mage.php');
umask(0);
Mage::app();
//setup the direct sql db conn resource
$db_conn = Mage::getSingleton('core/resource');
$r_conn = $db_conn->getConnection('core_read');
$email = 'tsnyder@tegdesign.com';
You can’t perform that action at this time.