Case Sensitive Issue – Magento Products

While shifting the your magento site which is hosted in the Windows server to the Linux server you will see strange thing is that the actual product images are not get dispalyed instead magento default product images
appear in all the product.

This problem has discussed in magento forum a lot. I have to thanks Mr.Chris Jones.

How to fix this ? ….. 🙂

Below is the solution is given by the Mr. Chris Jones in Mangeto Forum

<?php

fix_magento_catalog(“/yourmagentoinstall/media/catalog/product”, “mysql_host”, “mysql_user”, “mysq_password”,
“mysql_db”);

function list_files_and_folders($path=”.”)
{
$files = array();
if (is_dir($path))
{
$fh = opendir($path);
while (($file = readdir($fh)) !== false)
{
if (strcmp($file, “.”)==0 || strcmp($file, “..”)==0) continue;
$filepath = $path . “/” . $file;
if ( is_dir($filepath) )
{
array_push($files, $filepath);
$files = array_merge($files, list_files_and_folders($filepath));
}
else
{
array_push($files, $filepath);
}
}
closedir($fh);
}
else
{
$files = false;
}
return $files;
}

function fix_magento_catalog($path, $mysql_host, $mysql_username, $mysql_password, $mysql_db)
{
$files = list_files_and_folders($path);
foreach ($files as $val)
{
echo “Converting {$val} to”.strtolower($val).” \n”;
rename($val, strtolower($val));
}

$conn = mysql_connect($mysql_host,$mysql_username,$mysql_password);
mysql_select_db($mysql_db);

$query = mysql_query(“select value_id, value from catalog_product_entity_media_gallery”) or die(mysql_error());

while($result = mysql_fetch_assoc($query)) {
echo “Converting database value {$result[‘value_id’]} to “.strtolower($result[‘value’]).” \n”;
mysql_query(“update catalog_product_entity_media_gallery set value='”.strtolower($result[‘value’]).”‘ where value_id='{$result[‘value_id’]}'”) or die(mysql_error());
}
}
?>

In the above code, we are renaming the media/catalog/product subfolders and the files to lowercase and also the changing the the url image path to the loweecase in the following table is must.

  • catalog_product_entity_media_gallery
  • catalog_product_entity_varchar
  • catalog_product_flat_1
  • catalog_product_flat_2
  • catalog_product_flat_3
  • catalog_product_flat_4
  • catalog_product_flat_5
  • catalog_product_flat_6
  • catalog_product_flat_7
  • catalog_product_flat_8
  • catalog_product_flat_9

Note:
Above code, the Database update query part is done only for catalog_product_entity_media_gallery table so we have
to do update for other 10 tables.

Advertisements

Magento User Guide

I found some useful manual for Magento User guide for both developer and designer. Here i am sharing with you. Please follow the link,

Developer Guide

Designer Guide

Magento : Introduction

Magento is an Open Source ecommerce web application launched on March 31, 2008. It was created by Varien, building on components of the Zend Framework.

Magento is available under the Open Software License version 3.0. Since version 1.1.7 some parts are licensed under the Academic Free License version 3.0.

History

Magento officially started development in early 2007 Seven months later on August 31, 2007, the first public beta version was released.
The German magazine t3n featured Magento in the December 2007 edition.
In March 2008, Magento was selected to present at the Under the Radar: The Business of Web Apps conference,
where it won the audience favorite.
Magento 1.0 was released on March 31, 2008.
Magento 1.1 was released on July 25, 2008. This version provides fixes for many bugs and also makes Magento faster, with more responsive UI.

The latest updates on the Magento Commerce available on the below URL,

Magento Commerce

Magento Commerce

http://www.magentocommerce.com/

The updated Version, Downloader and Sample Data is available in online on the below links,

Version Update

Version Update

http://www.magentocommerce.com/download

The queries and how to install the Magento Commerce Version help can get from the Magento Forum by navigating to
the below links,

Forum

Forum

http://www.magentocommerce.com/boards