Open kevinm2 opened 9 years ago
Index Management>Product Prices>Index product prices, freezes up and does NOT re-index.
Error is "Cannot initialize the indexer process".
When I removed the package it immediately re-indexed!
Any solutions?
I have managed to solve this problem for cela tries to copy me your file (configurable.php) /app/code/community/OrganicInternet/SimpleConfigurableProducts/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Price/configurable.php
Thank you for the reply. my directory tree stops /app/code/community/. It does not have /OrganicInternet/. Directory /app/code/community/ contains Cm, Empiro, Phoenic folders!
It's weird! It is possible to contact on skype?
Unfortunately not. Don't have access to skype.
If you use closed fillezilla completely reopens it and tries reconnect you and redo handling for access to the path of the file
Is the configurable.php for magento-configurable-simple? If yes, I had uninstall it. Let me re-install...
You install it by the magento connect manager?
Yes I did. Sorry for that. I re-installed and I found the configurable.php file.
Perfect. Copy me
Excuse the ignorance, but how do I do that.
It is necessary to open it with a text editor such as: Sublime text or notepad for windows user
I have notpad++. I have it opened. Should I paste the content here?
Yes you can copy here
<?php class OrganicInternet_SimpleConfigurableProducts_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price_Configurable extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price_Configurable { protected function _isManageStock() { return Mage::getStoreConfigFlag(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK); }
#Don't pay any attention to cost of specific conf product options, as SCP doesn't use them
protected function _applyConfigurableOption()
{
return $this;
}
#This calculates final price using SCP logic: minimal child product finalprice
#instead of the just the entered configurable price
#It uses a subquery/group-by hack to ensure that the various column values are all from the row with the lowest final price.
#See Kasey Speakman comment here: http://dev.mysql.com/doc/refman/5.1/en/example-maximum-column-group-row.html
#It's all quite complicated. :/
protected function _prepareFinalPriceData($entityIds = null)
{
$this->_prepareDefaultFinalPriceTable();
$write = $this->_getWriteAdapter();
$select = $write->select()
->from(
array('e' => $this->getTable('catalog/product')),
array())
->joinLeft(
array('l' => $this->getTable('catalog/product_super_link')),
'l.parent_id = e.entity_id',
array())
->join(
array('ce' => $this->getTable('catalog/product')),
'ce.entity_id = l.product_id',
array())
->join(
array('pi' => $this->getIdxTable()),
'ce.entity_id = pi.entity_id',
array())
->join(
array('cw' => $this->getTable('core/website')),
'pi.website_id = cw.website_id',
array())
->join(
array('csg' => $this->getTable('core/store_group')),
'csg.website_id = cw.website_id AND cw.default_group_id = csg.group_id',
array())
->join(
array('cs' => $this->getTable('core/store')),
'csg.default_store_id = cs.store_id AND cs.store_id != 0',
array())
->join(
array('cis' => $this->getTable('cataloginventory/stock')),
'',
array())
->joinLeft(
array('cisi' => $this->getTable('cataloginventory/stock_item')),
'cisi.stock_id = cis.stock_id AND cisi.product_id = ce.entity_id',
array())
->where('e.type_id=?', $this->getTypeId()); ## is this one needed?
$productStatusExpr = $this->_addAttributeToSelect($select, 'status', 'ce.entity_id', 'cs.store_id');
if ($this->_isManageStock()) {
$stockStatusExpr = new Zend_Db_Expr('IF(cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0,' . ' 1, cisi.is_in_stock)');
} else {
$stockStatusExpr = new Zend_Db_Expr('IF(cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1,' . 'cisi.is_in_stock, 1)');
}
$isInStockExpr = new Zend_Db_Expr("IF({$stockStatusExpr}, 1, 0)");
$isValidChildProductExpr = new Zend_Db_Expr("{$productStatusExpr}");
$select->columns(array(
'entity_id' => new Zend_Db_Expr('e.entity_id'),
'customer_group_id' => new Zend_Db_Expr('pi.customer_group_id'),
'website_id' => new Zend_Db_Expr('cw.website_id'),
'tax_class_id' => new Zend_Db_Expr('pi.tax_class_id'),
'orig_price' => new Zend_Db_Expr('pi.price'),
'price' => new Zend_Db_Expr('pi.final_price'),
'min_price' => new Zend_Db_Expr('pi.final_price'),
'max_price' => new Zend_Db_Expr('pi.final_price'),
'tier_price' => new Zend_Db_Expr('pi.tier_price'),
'base_tier' => new Zend_Db_Expr('pi.tier_price'),
));
if (!is_null($entityIds)) {
$select->where('e.entity_id IN(?)', $entityIds);
}
#Inner select order needs to be:
#1st) If it's in stock come first (out of stock product prices aren't used if not-all products are out of stock)
#2nd) Finalprice
#3rd) $price, in case all finalPrices are NULL. (this gives the lowest price for all associated products when they're all out of stock)
$sortExpr = new Zend_Db_Expr("${isInStockExpr} DESC, pi.final_price ASC, pi.price ASC");
$select->order($sortExpr);
/**
* Add additional external limitation
*/
Mage::dispatchEvent('prepare_catalog_product_index_select', array(
'select' => $select,
'entity_field' => new Zend_Db_Expr('e.entity_id'),
'website_field' => new Zend_Db_Expr('cw.website_id'),
'store_field' => new Zend_Db_Expr('cs.store_id')
));
#This uses the fact that mysql's 'group by' picks the first row, and the subselect is ordered as we want it
#Bit hacky, but lots of people do it :)
$outerSelect = $write->select()
->from(array("inner" => $select), 'entity_id')
->group(array('inner.entity_id', 'inner.customer_group_id', 'inner.website_id'));
$outerSelect->columns(array(
'customer_group_id',
'website_id',
'tax_class_id',
'orig_price',
'price',
'min_price',
'max_price' => new Zend_Db_Expr('MAX(inner.max_price)'),
'tier_price',
'base_tier',
#'child_entity_id'
));
$query = $outerSelect->insertFromSelect($this->_getDefaultFinalPriceTable());
$write->query($query);
#Mage::log("SCP Price inner query: " . $select->__toString());
#Mage::log("SCP Price outer query: " . $outerSelect->__toString());
return $this;
}
}
I find the problem The 87 line adds: 'group_price' => new Zend_Db_Expr('pi.group_price'), The 88 line adds: 'base_group_price' => new Zend_Db_Expr('pi.group_price'),
The 131 line adds: 'group_price', The 132 line adds: 'base_group_price',
Saves your file sending the on your server in the path that I is you give and now try to reindex
should eliminate commas from the end of following? The 88 line adds: 'base_group_price' => new Zend_Db_Expr('pi.group_price'), 132 line adds: 'base_group_price',
Made like this
Got it.
I will re-index and keep you posted.
You made a little mistake to line 131 viewing my file and hold
OK. Is this correct?
Yes now place the file in the path that I you are give and go in your admin and reindexer
Sorry for the delay. I was doing some testing. Success:)
No more re-indexing errors, and Category page started displaying the price as well.
Thank you very much.
The problem is resolved?
Yes sir.
This was a pleasure to help you. In the future try to have skype contact directly
I'll work on it right away.
I am having a similar reindexing product price issue with magento 1.9. My file seems to be correct, though, as seen below. Help is appreciated!!
<?php class OrganicInternet_SimpleConfigurableProducts_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price_Configurable extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Indexer_Price_Configurable { protected function _isManageStock() { return Mage::getStoreConfigFlag(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK); }
#Don't pay any attention to cost of specific conf product options, as SCP doesn't use them
protected function _applyConfigurableOption()
{
return $this;
}
#This calculates final price using SCP logic: minimal child product finalprice
#instead of the just the entered configurable price
#It uses a subquery/group-by hack to ensure that the various column values are all from the row with the lowest final price.
#See Kasey Speakman comment here: http://dev.mysql.com/doc/refman/5.1/en/example-maximum-column-group-row.html
#It's all quite complicated. :/
protected function _prepareFinalPriceData($entityIds = null)
{
$this->_prepareDefaultFinalPriceTable();
$write = $this->_getWriteAdapter();
$select = $write->select()
->from(
array('e' => $this->getTable('catalog/product')),
array())
->joinLeft(
array('l' => $this->getTable('catalog/product_super_link')),
'l.parent_id = e.entity_id',
array())
->join(
array('ce' => $this->getTable('catalog/product')),
'ce.entity_id = l.product_id',
array())
->join(
array('pi' => $this->getIdxTable()),
'ce.entity_id = pi.entity_id',
array())
->join(
array('cw' => $this->getTable('core/website')),
'pi.website_id = cw.website_id',
array())
->join(
array('csg' => $this->getTable('core/store_group')),
'csg.website_id = cw.website_id AND cw.default_group_id = csg.group_id',
array())
->join(
array('cs' => $this->getTable('core/store')),
'csg.default_store_id = cs.store_id AND cs.store_id != 0',
array())
->join(
array('cis' => $this->getTable('cataloginventory/stock')),
'',
array())
->joinLeft(
array('cisi' => $this->getTable('cataloginventory/stock_item')),
'cisi.stock_id = cis.stock_id AND cisi.product_id = ce.entity_id',
array())
->where('e.type_id=?', $this->getTypeId()); ## is this one needed?
$productStatusExpr = $this->_addAttributeToSelect($select, 'status', 'ce.entity_id', 'cs.store_id');
if ($this->_isManageStock()) {
$stockStatusExpr = new Zend_Db_Expr('IF(cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0,' . ' 1, cisi.is_in_stock)');
} else {
$stockStatusExpr = new Zend_Db_Expr('IF(cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1,' . 'cisi.is_in_stock, 1)');
}
$isInStockExpr = new Zend_Db_Expr("IF({$stockStatusExpr}, 1, 0)");
$isValidChildProductExpr = new Zend_Db_Expr("{$productStatusExpr}");
$select->columns(array(
'entity_id' => new Zend_Db_Expr('e.entity_id'),
'customer_group_id' => new Zend_Db_Expr('pi.customer_group_id'),
'website_id' => new Zend_Db_Expr('cw.website_id'),
'tax_class_id' => new Zend_Db_Expr('pi.tax_class_id'),
'orig_price' => new Zend_Db_Expr('pi.price'),
'price' => new Zend_Db_Expr('pi.final_price'),
'min_price' => new Zend_Db_Expr('pi.final_price'),
'max_price' => new Zend_Db_Expr('pi.final_price'),
'tier_price' => new Zend_Db_Expr('pi.tier_price'),
'base_tier' => new Zend_Db_Expr('pi.tier_price'),
'group_price' => new Zend_Db_Expr('pi.group_price'),
'base_group_price' => new Zend_Db_Expr('pi.group_price'),
));
if (!is_null($entityIds)) {
$select->where('e.entity_id IN(?)', $entityIds);
}
#Inner select order needs to be:
#1st) If it's in stock come first (out of stock product prices aren't used if not-all products are out of stock)
#2nd) Finalprice
#3rd) $price, in case all finalPrices are NULL. (this gives the lowest price for all associated products when they're all out of stock)
$sortExpr = new Zend_Db_Expr("${isInStockExpr} DESC, pi.final_price ASC, pi.price ASC");
$select->order($sortExpr);
/**
* Add additional external limitation
*/
Mage::dispatchEvent('prepare_catalog_product_index_select', array(
'select' => $select,
'entity_field' => new Zend_Db_Expr('e.entity_id'),
'website_field' => new Zend_Db_Expr('cw.website_id'),
'store_field' => new Zend_Db_Expr('cs.store_id')
));
#This uses the fact that mysql's 'group by' picks the first row, and the subselect is ordered as we want it
#Bit hacky, but lots of people do it :)
$outerSelect = $write->select()
->from(array("inner" => $select), 'entity_id')
->group(array('inner.entity_id', 'inner.customer_group_id', 'inner.website_id'));
$outerSelect->columns(array(
'customer_group_id',
'website_id',
'tax_class_id',
'orig_price',
'price',
'min_price',
'max_price' => new Zend_Db_Expr('MAX(inner.max_price)'),
'tier_price',
'base_tier',
'group_price',
'base_group_price',
#'child_entity_id'
));
$query = $outerSelect->insertFromSelect($this->_getDefaultFinalPriceTable());
$write->query($query);
#Mage::log("SCP Price inner query: " . $select->__toString());
#Mage::log("SCP Price outer query: " . $outerSelect->__toString());
return $this;
}
}
Downloaded ver. 0.7.4 from Magento Connect. Installed without any problems on version 1.9.1.1.
Fully functional on specific product page.
Problem on the category display page: Shows Price From: $0.00.
Picture Frame Style A $0.00 View Details