This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('app/Mage.php'); //Path to Magento | |
umask(0); | |
Mage::app(); | |
// Run you code here | |
$orderCollection = Mage::getModel('sales/order')->getCollection(); | |
$fromDateStart = '2017-01-01'; | |
$toDateEnd = '2017-07-24'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once ("app/Mage.php"); | |
umask(0); | |
Mage::app("default"); | |
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*'); | |
foreach ($collection as $customer) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set a Last Run date | |
Mage::getConfig()->saveConfig('custom_module/order_export/last_run', date('Y-m-d H:i:s'), 'default', 0); | |
Get this date back | |
Mage::getStoreConfig('custom_module/order_export/last_run'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tasks = Mage::getModel('cron/schedule')->getCollection() | |
->addFieldToSelect('finished_at') | |
->addFieldToFilter('job_code', 'orders_exportsales') | |
->addFieldToFilter('status', 'success'); | |
$tasks->getSelect() | |
->limit(1) | |
->order('finished_at DESC'); | |
$lastRun = $tasks->getFirstItem()->getFinishedAt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Modify the path in the require statement below to refer to the | |
// location of your Composer autoload.php file. | |
require './vendor/autoload.php'; | |
// Instantiate a new PHPMailer | |
$mail = new PHPMailer; | |
// Tell PHPMailer to use SMTP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Source: https://www.demacmedia.com/magento-commerce/magento-tutorials/magento-data-feed/ | |
*/ | |
/* To start we need to include abscract.php, which is located | |
* in /shell/abstract.php which contains Magento's Mage_Shell_Abstract | |
* class. | |
* | |
* Since this ProductExport.php is in /shell/Namespace/ we |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//https://developer.dotmailer.com/docs/add-transactional-data-to-contact | |
//PHP Version 7 Example | |
$apiUsername = "API_USER"; //Your API username | |
$apiPassword = "API_PASSWORD"; //your API password | |
$baseUrl = 'https://r1-api.dotmailer.com'; | |
$url = $baseUrl . '/v2/contacts/transactional-data/Orders'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('app/Mage.php'); | |
umask(0); | |
Mage::app(); | |
$customers = Mage::getResourceModel('customer/customer_collection') | |
->addAttributeToSelect('*') // <- careful with this | |
->addAttributeToFilter('entity_id', 15701); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
DISTINCT(`sku`) as `sku`, | |
COUNT(`sku`) as `skuCount`, | |
entity_id | |
FROM | |
catalog_product_entity | |
GROUP BY | |
`sku` | |
HAVING | |
`skuCount` > 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Password protection | |
AuthType Basic | |
AuthName "Site Name Stage" | |
AuthUserFile /.htpasswd | |
Require valid-user |