Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
PHP script to refresh magento caches periodically. Catalog Rewrites problems in 1.3+ version? 
 
Shven
Jr. Member
 
Total Posts:  12
Joined:  2008-10-25
 

When I run the fill-part (fill calculated prices in catalogindex_price),

it returns the following error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column \’e.display_price_group_0\’ in \’field list\’

Does anyone know how to solve this problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
craigcriv
Sr. Member
 
Total Posts:  85
Joined:  2009-08-05
 

Is this a browser based script?
I installed in my root folder and tried to run from a browser and I get this text.
“Nothing to do”

 
Magento Community Magento Community
Magento Community
Magento Community
 
mihaitm
Jr. Member
 
Total Posts:  5
Joined:  2009-09-24
 

i tryed to reindex flat product i get the error with Unknown column \’e.display_price_group_0\’ in \’field list\’ . my fix for this was:

//reindex flat product
Mage::getResourceModel(’catalog/product_flat_indexer’)->rebuild();

//fix flat product
$groups = Mage::getModel(’customer/group’)->getCollection();
$prefix = Mage::getModel(’core/config’)->init()->getTablePrefix();
$products = Mage::getSingleton(’catalog/product’)->getCollection()->addAttributeToSelect(’*’);
$stores = Mage::app()->getStores(false, true);
foreach($stores as $store){
foreach($products as $product){
if($product->getSpecialPrice()!=""){
$price = $product->getSpecialPrice();
}else{
$price = $product->getPrice();
}
foreach ($groups as $group) {
$field = “display_price_group_”.$group->getCustomerGroupId();
try{
$sql="ALTER TABLE {$prefix}catalog_product_flat_".$store->getStoreId()." ADD `".$field."` DECIMAL( 12, 4 ) NULL DEFAULT NULL “;
Mage::getSingleton("core/resource")->getConnection("core_read")->query($sql);
}catch (Exception $e){
}

$sql = “UPDATE {$prefix}catalog_product_flat_".$store->getStoreId()." SET `".$field."` = ‘“.$price.”’ WHERE `catalog_product_flat_".$store->getStoreId()."`.`entity_id` =”.$product->getEntityId() ;
Mage::getSingleton("core/resource")->getConnection("core_read")->query($sql);
}

}
}

Hope to work for you too!

 
Magento Community Magento Community
Magento Community
Magento Community
 
TechXperts
Jr. Member
 
Total Posts:  10
Joined:  2009-10-26
Rajkot
 
mihai giucoane - 01 October 2010 06:49 AM

i tryed to reindex flat product i get the error with Unknown column \’e.display_price_group_0\’ in \’field list\’ . my fix for this was:


//reindex flat product
Mage::getResourceModel(’catalog/product_flat_indexer’)->rebuild();

//fix flat product
$groups = Mage::getModel(’customer/group’)->getCollection();
$prefix = Mage::getModel(’core/config’)->init()->getTablePrefix();
$products = Mage::getSingleton(’catalog/product’)->getCollection()->addAttributeToSelect(’*’);
$stores = Mage::app()->getStores(false, true);
foreach($stores as $store){
foreach($products as $product){
if($product->getSpecialPrice()!=""){
$price = $product->getSpecialPrice();
}else{
$price = $product->getPrice();
}
foreach ($groups as $group) {
$field = “display_price_group_”.$group->getCustomerGroupId();
try{
$sql="ALTER TABLE {$prefix}catalog_product_flat_".$store->getStoreId()." ADD `".$field."` DECIMAL( 12, 4 ) NULL DEFAULT NULL “;
Mage::getSingleton("core/resource")->getConnection("core_read")->query($sql);
}catch (Exception $e){
}

$sql = “UPDATE {$prefix}catalog_product_flat_".$store->getStoreId()." SET `".$field."` = ‘“.$price.”’ WHERE `catalog_product_flat_".$store->getStoreId()."`.`entity_id` =”.$product->getEntityId() ;
Mage::getSingleton("core/resource")->getConnection("core_read")->query($sql);
}

}
}


Hope to work for you too!
Regards,
Mihai - Ecommerce Store

PHP Fatal error:  Uncaught exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘display_price_group_0’ in ‘field list’’ in /lib/Zend/Db/Statement/Pdo.php:259
Stack trace:
#0 /lib/Zend/Db/Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 /lib/Zend/Db/Adapter/Abstract.php(457): Zend_Db_Statement->execute(Array)
#2 /lib/Zend/Db/Adapter/Pdo/Abstract.php(230): Zend_Db_Adapter_Abstract->query(’UPDATE catalog_...’, Array)
#3 /lib/Varien/Db/Adapter/Pdo/Mysql.php(281): Zend_Db_Adapter_Pdo_Abstract->query(’UPDATE catalog_...’, Array)
#4 /demosflatcatalog.php(63): Varien_Db_Adapter_Pdo_Mysql->query(’UPDAT in /lib/Zend/Db/Statement/Pdo.php on line 259

demosflatcatalog.php is my file with your script…
Dont you think
$field = “display_price_group_”.$group->getCustomerGroupId();
should be $field = e."display_price_group_".$group->getCustomerGroupId();…

any solution.....

 
Magento Community Magento Community
Magento Community
Magento Community
 
dierre
Jr. Member
 
Total Posts:  2
Joined:  2010-10-29
 

Same error for me as well…

2010-10-29T11:40:45+02:00 DEBUG (7): [ERRORE] exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘e.display_price_group_0’ in ‘field list’’ in /var/www/releases/20101019/lib/Zend/Db/Statement/Pdo.php:238
Stack trace:
#0 /var/www/releases/20101019/lib/Zend/Db/Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/releases/20101019/lib/Zend/Db/Adapter/Abstract.php(457): Zend_Db_Statement->execute(Array)
#2 /var/www/releases/20101019/lib/Zend/Db/Adapter/Pdo/Abstract.php(230): Zend_Db_Adapter_Abstract->query(’UPDATE `catalog...’, Array)
#3 /var/www/releases/20101019/lib/Varien/Db/Adapter/Pdo/Mysql.php(281): Zend_Db_Adapter_Pdo_Abstract->query(’UPDATE `catalog...’, Array)
#4 /var/www/releases/20101019/app/code/core/Mage/CatalogIndex/Model/Mysql4/Indexer.php(639): Varien_Db_Adapter_Pdo_Mysql->query(’UPDATE `catalog...’)
#5 /var/www/releases/20101019/app/code/core/Mage/CatalogIndex/Model/Indexer.php(801): Mage_CatalogIndex_Model_Mysql4_Indexer->updateCatalogProductFlat(’1’, NULL, NULL)
#6 /var/www/releases/20101019/app/code/core/Mage/CatalogIndex/Model/Indexer.php(377): Mage_CatalogIndex_Model_Indexer->updateCatalogProductFlat(’1’, NULL)
#7 /var/www/releases/20101019/app/code/core/Mage/CatalogIndex/Model/Indexer.php(372): Mage_CatalogIndex_Model_Indexer->_afterPlainReindex(’1’, NULL)
#8 /var/www/releases/20101019/app/code/core/Mage/CatalogIndex/Model/Indexer.php(320): Mage_CatalogIndex_Model_Indexer->_afterPlainReindex(Array, NULL)
#9 /var/www/releases/20101019/import/clear_cache.php(30): Mage_CatalogIndex_Model_Indexer->plainReindex()
#10 {main}

I haven’t tried Mihai’s solution because it seems a bit too radical to directly alter the database schema, and also because there are posts saying it does not fix the problem…

Has anybody managed to solve this? Thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
mihaitm
Jr. Member
 
Total Posts:  5
Joined:  2009-09-24
 

Sorry for delay in response,

Use the file from attachment and put it in root of magento and lunch with http://sitename/refresh.php.

About fields them are in database like : display_price_group_x not like the error e.display_price_group_x.

I alter the table adding the fields that missing, because when flat_product are reindexed from frontend , that fields are deleted and not recreated, with this fix i tryed to complete the reindex process.

Just try, if error not corrected , allways you can find reindex button from backend.

If someone find an better solution share with us.

File Attachments
refresh.php  (File Size: 2KB - Downloads: 453)
 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

By the way, today is no longer necessary to use these scripts, you can use:

php -f shell/indexer.php
 
Magento Community Magento Community
Magento Community
Magento Community
 
carmedio
Jr. Member
 
Total Posts:  14
Joined:  2011-02-15
 

and how i have to use indexer.php for clearing the hole cache?
Or did i understand something wrong?

My problem ist , that i cant login in Admin Panel.
If i try i get an Fatal error .
How can i disable cache manually, if i cant login in Backend?

 
Magento Community Magento Community
Magento Community
Magento Community
 
viktor117
Jr. Member
 
Total Posts:  2
Joined:  2011-02-21
 
amartinez - 26 April 2011 01:56 AM

By the way, today is no longer necessary to use these scripts, you can use:

php -f shell/indexer.php

The only thing is that it does not work in browser.
I have resolved this my way:

require_once 'app/Mage.php';
umask(0);

Mage::app()->cleanCache();
flush();

$collection Mage::getSingleton('index/indexer')->getProcessesCollection();

foreach (
$collection as $process{
    
if ($process->isLocked()) {
        $process
->unlock();
    
}
    $process
->reindexEverything();
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
dakinibilyana
Jr. Member
 
Total Posts:  12
Joined:  2009-09-02
 

Hello,

If it helps i started getting this error after deleting the default Store view, because this function looks for default and if it doesn’t find it, it errors.

So i recreated the default store view, important with code: default and it’s now working again.

hope it hopes somebody.

greetings
bilyana

 
Magento Community Magento Community
Magento Community
Magento Community
 
DiHack
Jr. Member
 
Total Posts:  1
Joined:  2012-09-23
 

Hello!

Somebody resolved this issue?

If call Mage::getResourceModel(’catalog/product_flat_indexer’)->rebuild(); from custom module then flat clear but don’t create again

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2