Skip to content

Instantly share code, notes, and snippets.

View jreinke's full-sized avatar

Johann Reinké jreinke

  • Freelance
  • France
View GitHub Profile
<?php
/*
Edit file vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php
and add the following code at line 237
*/
$sqlQuery = $sql;
if (is_string(key($bind))) {
foreach ($bind as $field => $value) {
$sqlQuery = str_replace($field, $this->quote($value), $sqlQuery);
@jreinke
jreinke / magento_copy_product_images.php
Created October 19, 2015 12:36
Magento: copy images from one product to another
<?php
/**
* Copy all images from $productSrc to $productDest
*
* @param Mage_Catalog_Model_Product $productSrc
* @param Mage_Catalog_Model_Product $productDest
*/
public function copyProductImages(Mage_Catalog_Model_Product $productSrc, Mage_Catalog_Model_Product $productDest)
{
$images = array();
@jreinke
jreinke / .gitconfig
Created April 30, 2015 09:13
Git aliases
[alias]
ci = commit
co = checkout
st = status
br = branch
lg = log -10 --graph --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%an %cr)%Creset' --abbrev-commit --date=relative
files = diff-tree --no-commit-id --name-only -r
@jreinke
jreinke / .gitignore
Last active August 29, 2015 14:16 — forked from karmi/.gitignore
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@jreinke
jreinke / disable_flat_catalog_category.php
Last active November 13, 2024 13:23
Magento: Disable flat catalog category on the fly
<?php
/** @var $collection Mage_Catalog_Model_Resource_Category_Collection */
$collection = Mage::getModel('catalog/category', array('disable_flat' => true))->getCollection();
// ... custom stuff
@jreinke
jreinke / disable_flat_catalog_product.php
Last active November 16, 2017 00:28
Magento: Disable flat catalog product on the fly
<?php
/** @var Mage_Catalog_Helper_Product_Flat $helper */
$process = Mage::helper('catalog/product_flat')->getProcess();
$status = $process->getStatus();
$process->setStatus(Mage_Index_Model_Process::STATUS_RUNNING);
/** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
$collection = Mage::getResourceModel('catalog/product_collection'); // Use EAV tables
// ... custom stuff
@jreinke
jreinke / install-0.1.0.php
Created July 10, 2014 13:35
Magento EE - Reindex category urls
<?php
// Reindex category urls
if (Mage::helper('core')->isModuleEnabled('Enterprise_Mview')) {
$client = Mage::getModel('enterprise_mview/client')
->init('enterprise_url_rewrite_category')
->execute('enterprise_catalog/index_action_url_rewrite_category_refresh');
}
@jreinke
jreinke / Check.php
Created May 12, 2014 12:54
Magento: set index as update required
<?php
if (Mage::helper('catalog/product_flat')->isEnabled()) {
Mage::getSingleton('index/indexer')
->getProcessByCode(Mage_Catalog_Helper_Product_Flat::CATALOG_FLAT_PROCESS_CODE)
->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
}
@jreinke
jreinke / Data.php
Created May 5, 2014 13:42
Bubble Dynamic Category Sample
<?php
/**
* @category Bubble
* @package Bubble_DynamicCategory
* @version 1.0.1
* @copyright Copyright (c) 2014 BubbleShop (http://www.bubbleshop.net)
*/
class Bubble_DynamicCategory_Helper_Data extends Mage_Core_Helper_Abstract
{
public function getDynamicProductIds(Varien_Object $category)
@jreinke
jreinke / .gitignore
Created April 11, 2014 08:07
Magento .gitignore
# Misc
/.buildpath
/.project
/nbproject
/catalog.xml
/sitemap.xml
/.settings
/.idea
/staging
/.modman