Magento: Problem with reindexing process for “Product flat data” indexes

Problem with reindexing process for "Product flat data" indexes

Problem with reindexing process for "Product flat data" indexes


Reindexing of Product flat data index gives unknown reindexing error or “Some problem with reindexing process” error message or reindexing of Product flat data index is never completed.

Attempt to reindex it via command line gives the following error message:

$ php -f shell/indexer.php -- --reindex catalog_product_flat
Product Flat Data index process unknown error:
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (<result 2 when explaining filename '#sql-'>, CONSTRAINT ´FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID´ FOREIGN KEY (´entity_id´) REFERENCES ´catalog_product_entity´ (´entity_id)' in lib/Zend/Db/Statement/Pdo.php:228


Magento: How to get current currency in Magento?

How to get current currency in Magento?

How to get current currency in Magento?

We know Magento support multiple currency. I have found the solution to check current currency in the Magento site frontend

To get Current Currency

<?php echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?>

If you looking for current currency symbol use :

echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();

Magento: Automated Bash Script Installer

Magento: Automated Bash Script Installer

Magento: Automated Bash Script Installer

The following SSH script will automate the process of installing Magento, with or without sample data. It will walk you through everything, and the only thing you need to setup first is the database and assign a user to the database.

You will need SSH access to use this. SSH is similar to FTP, in that it requires software that you’ll need to download in order to connect to your site. If you don’t have an SSH client, you can download PuTTY for free.

Magento: “There has been an error processing your request”

The following error message is shown instead of your usual Magento page:
There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 1286489434787

Usually, it is caused by calling incompatible classes in themes, extensions or templates, database connectivity issues or resource shortage (i.e. insufficient diskspace or PHP memory_limit option).

Magento shows blank/empty page. How do I solve this?

Blank page is shown in Magento Frontend, Backend or Magento Connect Manager

If you see a blank page opening your Store in browser, it indicates that there is a PHP syntax error somewhere in the code of your site.
This usually happens when you modified files, templates or extensions manually, or installed a theme or extension with PHP syntax errors.

Before starting investigation please try to Disable Magento Compiler and Clear cached Magento data , in the most cases it should solve the issue.
To see the actual error message you need to login via FTP to your Store and use the following instructions:

Setting a new theme for a developer only

I found a really simple solution:

– I made another store wiew
– I assigned a new theme to it
– I removed store view list from pages

now, I can easily switch between themes:
……/?___store=new_theme – new theme for developing purposes
……/?___store=default – current theme

and customers will still see and old theme

How to set the default sort order for catalog pages?

If you only want to change default sort order you can do it in catalog.xml just by adding the following action:

<action method="setDefaultDirection"><dir>desc</dir></action>

This action will work in any block of type “catalog/product_list_toolbar”, so the XML snippet would be:

<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
        <action method="setDefaultDirection"><dir>desc</dir></action>
    <!-- The following code shows how to set your own pager increments -->
        <action method="setDefaultListPerPage"><limit>4</limit></action>
        <action method="setDefaultGridPerPage"><limit>9</limit></action>
        <action method="addPagerLimit"><mode>list</mode><limit>2</limit></action>
        <action method="addPagerLimit"><mode>list</mode><limit>4</limit></action>
        <action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
        <action method="addPagerLimit"><mode>list</mode><limit>8</limit></action>
        <action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>

This block is used twice in catalog.xml once for normal product lists and once for layered navigation product lists, so just make the same change in both places.

///////////// uncompleted //////////////

<action method="setDefaultOrder"><field>entity_id</field></action>