Skip to content

Instantly share code, notes, and snippets.

View fballiano's full-sized avatar

Fabrizio Balliano fballiano

View GitHub Profile
@fballiano
fballiano / apply_promotion_rules.php
Created July 21, 2014 14:33
Apply promotion rules, for Magento EE 1.13, CE 1.8
<?php
require_once 'app/Mage.php';
ini_set('display_errors', 1);
Mage::setIsDeveloperMode(true);
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
try {
Mage::getModel('catalogrule/rule')->applyAll();
Mage::getModel('catalogrule/flag')->loadSelf()
@fballiano
fballiano / controller.php
Created July 17, 2014 09:20
Magento: controller bootstrapping layout and messages
public function indexAction()
{
$this->loadLayout();
$this->_initLayoutMessages("customer/session");
$this->_initLayoutMessages("catalog/session");
$this->renderLayout();
}
@fballiano
fballiano / sitemap.patch
Created June 26, 2014 12:21
Magento EE 1.13 does not use suffix in sitemap.xml generation => all urls go 404
diff --git a/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Category.php b/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Category.php
index 5c82f40..63ecf21 100644
--- a/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Category.php
+++ b/app/code/core/Mage/Sitemap/Model/Resource/Catalog/Category.php
@@ -102,7 +102,22 @@ class Mage_Sitemap_Model_Resource_Catalog_Category extends Mage_Sitemap_Model_Re
*/
protected function _getEntityUrl($row, $entity)
{
- return !empty($row['request_path']) ? $row['request_path'] : 'catalog/category/view/id/' . $entity->getId();
+ $suffix = Mage::helper('catalog/category')->getCategoryUrlSuffix();
@fballiano
fballiano / file.patch
Last active August 29, 2015 14:02
Duplicate primary on catalog_product_index_price_tmp
+++ b/app/code/core/Mage/Index/Model/Resource/Abstract.php
@@ -176,6 +176,7 @@ abstract class Mage_Index_Model_Resource_Abstract extends Mage_Core_Model_Resour
if ($from === $to) {
$query = $select->insertFromSelect($destTable, $columns);
+ $query = str_replace("INSERT INTO", "INSERT IGNORE INTO", $query);