Skip to content

Instantly share code, notes, and snippets.

Hervé Guétin herveguetin

Block or report user

Report or block herveguetin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
herveguetin / flat_source_table_select_varchar.php
Last active Aug 29, 2015
Save an attribute with a select input type with values that are not of "int" type and create correct column type in flat catalog tables (in Magento)
View flat_source_table_select_varchar.php
class Your_Module_Model_Catalog_Attribute_Source_Product_[Attribute] extends Mage_Eav_Model_Entity_Attribute_Source_Table
public function getAllOptions()
if (!$this->_options) {
$this->_options = array(
'option_1' => array('value' => 'value_1', 'label' => Mage::helper('adminhtml')->__('-- Not Selected --')),
'option_2' => array('value' => 'value_2', 'label' => 'Label 2'),
herveguetin / clean_catalogsearch.sql
Last active Aug 29, 2015 — forked from leek/
Clean Magento Database
View clean_catalogsearch.sql
TRUNCATE `catalogsearch_fulltext`;
TRUNCATE `catalogsearch_query`;
TRUNCATE `catalogsearch_result`;
-- Enterprise Edition
herveguetin / checkout_total_discount_no_code.phtml
Last active Aug 29, 2015
Remove coupon code in parenthesis from discount total title in Magento
View checkout_total_discount_no_code.phtml
$title = ($this->getTotal()->getCode() == 'discount') ? preg_replace('@\(.*?\)@', '', $this->getTotal()->getTitle()) : $this->getTotal()->getTitle();
herveguetin / Amasty_Shopby_Helper_Attributes.php
Last active Aug 29, 2015
Bugfix - Make sure to sort filter options by sort order set in Magento attribute option edit
View Amasty_Shopby_Helper_Attributes.php
* @return array
public function getAllFilterableOptionsAsHash()
if (is_null($this->_optionsHash)) {
$hash = array();
$attributes = $this->getFilterableAttributes();
herveguetin / translation_var_order.csv
Created Apr 27, 2014
Manage different var positions in Magento translations
View translation_var_order.csv
%1$s %2$s private sales Ventes privées %2$s %1$s
herveguetin / product_entity_type_id.php
Created May 20, 2014
Retrieve product entity type ID in Magento
View product_entity_type_id.php
herveguetin / first_product_category.php
Created May 20, 2014
Retrieve first active category of product in Magento
View first_product_category.php
// $product must be an instance of Mage_Catalog_Model_Product
$productCategoryIds = $product->getCategoryIds();
$productCategory = Mage::getModel('catalog/category')->getCollection()
->addAttributeToFilter('is_active', true)
->addAttributeToFilter('entity_id', array('in' => $productCategoryIds))
herveguetin / canonical_url.php
Created May 26, 2014
Add canonical URL to Magento <head>
View canonical_url.php
$canonicalUrl = Mage::getBaseUrl(); // your logic...
->addLinkRel('canonical', $canonicalUrl);
herveguetin /
Created May 26, 2014
Test Magento order success page

In Mage_Checkout_OnepageController, temporarely comment out $session->clear();

herveguetin /
Created May 26, 2014
Translating strings from specific modules in Magento
You can’t perform that action at this time.