Skip to content

Instantly share code, notes, and snippets.

View LeeSaferite's full-sized avatar

Lee Saferite LeeSaferite

  • Lake City, FL, US
View GitHub Profile
<?php
class MyCompany_MyModule_Model_Observer extends Mage_Cron_Model_Observer
{
/**
* Process cron queue
* Geterate tasks schedule
* Cleanup tasks schedule
*
@LeeSaferite
LeeSaferite / gist:662396
Created November 4, 2010 12:36
Mage_PayPal fix for versions prior to 1.4
diff --git a/app/code/core/Mage/Paypal/Model/Standard.php b/app/code/core/Mage/Paypal/Model/Standard.php
index e77e3d8..e70efea 100644
--- a/app/code/core/Mage/Paypal/Model/Standard.php
+++ b/app/code/core/Mage/Paypal/Model/Standard.php
@@ -368,8 +368,16 @@ class Mage_Paypal_Model_Standard extends Mage_Payment_Model_Method_Abstract
*/
} else {
-
- if ($this->getIpnFormData('mc_gross')!=$order->getBaseGrandTotal()) {
@LeeSaferite
LeeSaferite / broken-exception-prepareRedirect.patch
Created April 5, 2012 14:44
The Mage_Core_Controller_Varien_Exception::prepareRedirect method has been broken since the class was introduced in 1.3.2 (Current: 1.9.1.0) https://github.com/OpenMage/magento-mirror/blob/1.9.1.0/app/code/core/Mage/Core/Controller/Varien/Exception.php#L67-L72
Index: app/code/core/Mage/Core/Controller/Varien/Exception.php
===================================================================
--- app/code/core/Mage/Core/Controller/Varien/Exception.php (revision )
+++ app/code/core/Mage/Core/Controller/Varien/Exception.php (revision )
@@ -67,7 +67,7 @@
public function prepareRedirect($path, $arguments = array())
{
$this->_resultCallback = self::RESULT_REDIRECT;
- $this->_resultCallbackParams($path, $arguments);
+ $this->_resultCallbackParams = array($path, $arguments);
@LeeSaferite
LeeSaferite / systemConfigSectionsSorting.patch
Created May 11, 2012 18:53
Patch to fix Magento config section sorting bug
diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php
index 9d3350c..4af5c71
--- a/app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php
+++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php
@@ -80,13 +80,22 @@ class Mage_Adminhtml_Block_System_Config_Tabs extends Mage_Adminhtml_Block_Widge
$configFields = Mage::getSingleton('adminhtml/config');
$sections = $configFields->getSections($current);
$tabs = (array)$configFields->getTabs()->children();
-
@LeeSaferite
LeeSaferite / gist:3058243
Created July 6, 2012 05:15 — forked from molotovbliss/gist:2562551
Magento Snippets
<?php
class EcomDev_Optimization_Model_Resource_Attribute_Source_Table extends Mage_Eav_Model_Entity_Attribute_Source_Table
{
protected static $_preloadedOptions = array();
protected static function _getStoreOptions($storeId, $attributeId)
{
if (!isset(self::$_preloadedOptions[$storeId])) {
$options = Mage::getResourceModel('eav/entity_attribute_option_collection')
@LeeSaferite
LeeSaferite / Fixed.php
Created January 16, 2014 20:31
Mage_Cms_Helper_Wysiwyg_Images has a bug when you have the /media directory symlinked in to the deployment location (At least as of EE 1.13.1)
<?php
/**
* Return URL based on current selected directory or root directory for startup
*
* @return string
*/
public function getCurrentUrl()
{
if (!$this->_currentUrl) {
$mediaDir = Mage::getConfig()->getOptions()->getMediaDir();
@LeeSaferite
LeeSaferite / OpenMage_Base_Model_Core_Store.php
Created November 25, 2014 22:58
Remove the index.php from admin URLs in Magento
<?php
class OpenMage_Base_Model_Core_Store extends Mage_Core_Model_Store
{
/**
* Add script file name to the URL if server rewrites are disabled or Magento is not installed
*
* NB: This differs from the parent just by not adding the script name to the URL for the admin site
*
* @param string $url
@LeeSaferite
LeeSaferite / original.php
Last active August 29, 2015 14:13
Mage_CatalogInventory_Model_Stock_Item::suggestQty update
<?php
public function suggestQty($qty)
{
// We do not manage stock
if ($qty <= 0 || !$this->getManageStock()) {
return $qty;
}
$qtyIncrements = (int)$this->getQtyIncrements(); // Currently only integer increments supported
if ($qtyIncrements < 2) {
@LeeSaferite
LeeSaferite / gist:b885e0359186241b09ff
Last active August 29, 2015 14:25
Parameter Encoder and Hasher
<?php
/**
* @param array $parameters
* @param string $secretKey
*
* @return string
*
* @throws InvalidArgumentException
*/
function prepareParameters(array $parameters, $secretKey)