Skip to content

Instantly share code, notes, and snippets.

View jreinke's full-sized avatar

Johann Reinké jreinke

  • Freelance
  • France
View GitHub Profile
@jreinke
jreinke / AbstractEntity.php
Last active August 29, 2015 13:57
Symfony2 Abstract Entity
<?php
namespace Clever\BlogBundle\Entity;
use Doctrine\Common\Util;
abstract class AbstractEntity
{
public function __construct($data = array())
{
@jreinke
jreinke / .gitignore
Created April 11, 2014 08:07
Magento .gitignore
# Misc
/.buildpath
/.project
/nbproject
/catalog.xml
/sitemap.xml
/.settings
/.idea
/staging
/.modman
@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 / 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 / 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 / .gitignore
Last active August 29, 2015 14:16 — forked from karmi/.gitignore
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@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 / mysql4-install-0.1.0.php
Created January 25, 2012 20:12
Example of how to add attribute to customer entity type in Magento
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute('customer', 'civility', array(
'label' => 'Civility',
'visible' => true,
'required' => false,
'type' => 'int',
'input' => 'select',
'user_defined' => '1',
@jreinke
jreinke / disable_flat_catalog_category.php
Last active November 8, 2015 03:40
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 / Group.php
Last active December 15, 2015 09:19
Bubble Launcher custom indexer example (customer groups indexation)
<?php
// app/code/local/Namespace/Module/Model/Indexer/Group.php
class Namespace_Module_Model_Indexer_Group extends Bubble_Launcher_Model_Indexer_Abstract
{
protected function _buildIndexData()
{
$data = array();
$collection = Mage::getModel('customer/group')->getCollection();