Magento – Can’t initialize indexer process

Share
Posted on November 30th, 2012 | Posted by admin

Can’t initialize indexer process – this is one of those frustrating errors that can sometimes interfere with the daily operation of an established Magento store. It is quite common to see large online stores upgrade to newer versions of Magento and later on meet the above error. Let’s look into a couple of solutions that I have used to tackle this issue.

I came across this error for a few of our client’s websites. And sometimes I was able to resolve this error with the following sql statement:

DELETE cpop.* FROM catalog_product_option_price AS cpop
INNER JOIN catalog_product_option AS cpo
ON cpo.option_id = cpop.option_id
WHERE
cpo.type = ’checkbox’ OR
cpo.type = ’radio’ OR
cpo.type = ’drop_down’;

DELETE cpotp.* FROM catalog_product_option_type_price AS cpotp
INNER JOIN catalog_product_option_type_value AS cpotv
ON cpotv.option_type_id = cpotp.option_type_id
INNER JOIN catalog_product_option AS cpo
ON cpotv.option_id = cpo.option_id
WHERE
cpo.type <> ’checkbox’ AND
cpo.type <> ’radio’ AND
cpo.type <> ’drop_down’;

How to fetch data from custom table in magento

Share
Posted on November 29th, 2012 | Posted by admin

Fetching data from custom table in magento is quite difficult because its data store in entity attribute value (EAV) model therefore most of the table structure are in EAV model. So joining one table with other tables is different from other database system. Here is a query example of sample table which helps you to use join, select, group, filter data from custom table .

Here are some examples of code which helps you to retrieve data from custom table using join, select.

1)
<?php
$collection = Mage::getModel('rewardpoints/points')-&gt;getCollection();
			$collection-&gt;addFieldToFilter('source','product');
			$collection-&gt;addFieldToFilter('recipient_email',Array('neq'=&gt;''));
			$expr = 'COUNT(points_id)';
			$collection-&gt;setOrder($expr,'DESC');
			$collection-&gt;setGroup('source_id');
			$collection-&gt;addProductData();
?>

2)
protected function _prepareCollection()
		{
			$read = Mage::getSingleton('core/resource')-&gt;getConnection('core_read');

			$firstname  = Mage::getResourceSingleton('customer/customer')
-&gt;getAttribute('firstname');
			$middlename = Mage::getResourceSingleton('customer/customer')
-&gt;getAttribute('middlename');
		    $lastname   = Mage::getResourceSingleton('customer/customer')
-&gt;getAttribute('lastname');
			$email      = Mage::getResourceSingleton('customer/customer')
-&gt;getAttribute('email');

Images Disppear after Flushing Image Storage Cache in Magento

Share
Posted on November 28th, 2012 | Posted by admin

Over the weekend we moved our website to a new server. We had our hosting provider do the migration over the weekend to minimise any disruptions and it all went fairly well.

The copy of the website was exactly the same as it was on the older server, which was all according to plan. We switched the name servers and the website was up and running. So far so good.

In our testing we found a few images here and there to be missing, so normally the thing to do is to flush the cache and reindex. That is when things started to turn for the worse!

After we flushed the image storage cache, we took a look at the site and all of the products had disappeared from the main page and as listings on the category pages. All we could see was the header, sidebar, breadcrumbs and pager. The rest of the page was empty and the footer was gone. We could still browse the product by the URL, which showed up everything as it should minus the image.

We spent hours disabling the cache, reindexing the data, making sure every folder has been migrated from the older server, checking that the images were still linked in each product. We Googled the issue and a potential solution was to disable all the products and then re-enable them, that didn’t work. I added a few new products with new images, that wasn’t showing any images either.

Tearing my hair out by this stage I pointing the nameservers back to the old server and once it replicated it was back to normal, although we still had a broken copy of the newer, faster, better server.

Adding customer attributes and displaying them in the Magento admin

Share
Posted on November 27th, 2012 | Posted by admin

No doubt, many a work hour has been dedicated to adding custom customer data to Magento Commerce. Magento is an extremely robust and flexible e-commerce engine, allowing you to customize products with an infinite number of attributes, but this level of customization has not been applied to configuration of customer data.

One of the most common customer attributes has to be an account number. This is especially common with wholesalers. In this post I’ll go over how I added an account number attribute to a Magento site I’m working on for my employer. The basic principles covered here should carry over to any basic customer data you want added to the Magento admin tool. I am assuming you are already familiar with building modules for Magento;

Getting Started

We have basically two objectives:

  1. Provide an input field in the Magento admin tool to add and store the account number
  2. Display the account number in the customer profile section of the admin tool

A possible third objective would be to display this data to the customer on the front end, but we’ll hold off on that part for another day.

Magento Installation pdo_mysql, mcrypt extensions error

Share
Posted on November 26th, 2012 | Posted by admin

Magento Installation pdo_mysql, mcrypt extensions error

Magento is becoming more and more popular and whilst installing Magento many clients come across the following message

PHP Extension “pdo_mysql” must be loaded
PHP Extension “mcrypt” must be loaded

To resolve the issue, firstly you would need to find out which php.ini file is used by your website. This can be achieved using phpinfo().

phpinfo() is commonly used to check configuration settings and for available predefined variables on a given system. If you don’t already have an info.php page in your hosting space. Please create a new text file and upload it to your hosting space. You will need to name the file info.php

Your new info.php page should have 1 line of code only. Please put the following code in your new file:

Code:

That’s all you need, now save the file to your hosting space, and view the php page in your browser.
Once you view info.php in your web browser, it will populate the page with all the PHP settings and values. It is a good resource to determine what the current settings are for your PHP installation.

Page 1 of 612345»...Last »