Skip to content

Instantly share code, notes, and snippets.

@SchumacherFM
Last active December 15, 2015 11:59
Show Gist options
  • Save SchumacherFM/5256581 to your computer and use it in GitHub Desktop.
Save SchumacherFM/5256581 to your computer and use it in GitHub Desktop.
Magento: Want to use negative position values in Category Product Relation? Just include this MySQL update routine and rerun the indexer for catalog_category_product. Problem: Table catalog_category_product with its column position is type signed while the column position in the indexers anchor idx and tmp table are unsigned. Unsigned columns ca…
<?php
/**
* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
*/
$installer = $this;
$installer->startSetup();
$tables = array(
$installer->getTable('catalog/category_anchor_products_indexer_idx'),
$installer->getTable('catalog/category_anchor_products_indexer_tmp')
);
foreach ($tables as $table) {
$installer->getConnection()->modifyColumn(
$table,
'position',
array(
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
'unsigned' => FALSE,
'nullable' => TRUE,
'default' => null,
'comment' => 'Position'
)
);
}
$installer->endSetup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment