Filter Products By Attribute With NULL values In Magento

Monday, 30. September 2013

One little tip for someone who wants to select a set of items or products in Magento based on attribute with a NULL value.

$collection = Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToFilter('ATTRIBUTE_CODE', array('null' => true)) 
    ->getAllIds();

unable to complete request error while saving attributes

Monday, 20. May 2013

There is a strange error sometimes happens when you upgrade your Magento install and not being able to assign attributes to attribute sets

If you have have across this error: unable to complete request error then this solution could be what you just need to do to solve it.

1) Flush your Magento cache storage
First point of call, should be flushing your magento cache storage.

System -> Cache Management -> Flush cache storage

Now try to assign the attributes again.

If that fails – disable cache management all together for the duration of the assignment process

System -> Cache Management -> Disable All Cache

You may also want to delete the cache files all together should you still have problems. /var/cache/

enjoy!

Street Address is a required value. street address must be equal to or greater than 2 characters

Thursday, 9. May 2013

Came across this Magento buggy message while going through checkout steps.

Magento installation 1.7.0.2. Strangely enough, the problem only occours on the Mobile theme but the desktop version is just fine!

Anyway, the quick/workaround fix to this problem can be done from Magento admin panel

Simply navigate to:

System > Configuration > Customers > Customer Configuration > Name and Address Options

Then look for a field: Number of Lines in a Street Address

If it is set to 2 – clear it and save your configurations.

Back to the checkout page and hopefully there will be a smile on your face!

Enjoy!

Error 501 net::ERR_INSECURE_RESPONSE Unknown error Plesk

Friday, 5. April 2013

I have had this issue while accessing plesk control panel. With a lot of forums about this issue I was still unable to go pass this error until I found out the issue could actually be due to SSO (Single Sign-On)

Jumped to my command terminal and whacked in this commend to disable sso – and whallah! I could now access the Plesk control panel as usual..

/usr/local/psa/bin/sso --disable

Fatal error Declaration of Zend Pdf FileParserDataSource File __construct

Wednesday, 3. April 2013

Had this issue printing Magento invoices on Windows server which was a bit odd.

On Linux development Machine everything thing appears to be working absolutely fine. Moving to live server which is a Windows Server machine, I kept getting this error

Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct() in …\lib\Zend\Pdf\FileParserDataSource\File.php on line 41

A bit of browsing on the internet suggests re-installing the OS which was not an option for me! So to work around the issue, I simply accessed this file and function

Zend_Pdf_FileParserDataSource

And commented out the construct function. Not very efficient but solved the issue (atleast for now). If you have a better idea or a moment of Eureka, please drop a line!

# abstract public function __construct();

Category Tree Not Showing In Magento Admin Product Edit Pages After Upgrade

Wednesday, 3. April 2013

I have come across this issue recently after an upgrade and site merging of two Magento stores in version 1.7.0.2.

The issues in the end came to be that the categories migrates from Site B to Site A somehow lost the Child_Count values in the catalog_category_entity table

To solve this particular problem I had to do the following. You will need access to database to implement this solution with IDE like PhPMyAdmin or something similar.

1. Create a temporary table containing count values
This step will depend on the path values on your database. For me, the Root category was of ID 340.. So all you need to do is to replace the 340 with your root category ID or the ID of the category you want to fix.

CREATE TABLE temp_category_child_count (entity_id INT(11), child_count INT(11));
INSERT INTO temp_category_child_count
SELECT parent_id, COUNT(entity_id) total  FROM `catalog_category_entity` WHERE path LIKE '1/340/%' GROUP BY parent_id ORDER BY parent_id;

2. Now move the counts to the entity table
This step will now move the children count values from the temp table back to the main category entity table.

UPDATE `catalog_category_entity` a, temp_category_child_count b 
SET a.children_count = b.child_count
WHERE a.entity_id = b.entity_id;

3. Finally refresh your Magento indexes
This is important step to ensure your Magento database is up to speed with your changes. The important index to refresh is the Category Flat Data

Hopefully now when you go to your Product Edit pages again, you will see your category tree nice and clear!

Enjoy!

Upsell, Cross-Sell and Related Products Not Showing Magento Frontend

Tuesday, 26. March 2013

If you have come across the situation where you have assigned Up-sells, cross-sells or related products to a certain product but when you go to the Frontend, you can’t see them this solution may help.

There maybe several reasons as to why such problem occurs i.e your theme doesn’t have the upsell, cross-sell or related product block enabled OR simply that the block is set to render on the right column layout but you are on left column layout.

However, if everything else seems to be in place but just a simple matter of you are not seeing the products, it maybe that your indexes are out of date. So simply:

 
Go to System -> Index Management 
Select: Product Flat Data, Category Flat Data, Category Products
Reindex Data

Magento google sitemap generation on multistore setup

Friday, 15. February 2013

If you have tried to install/configure sitemaps for a multi-store magento installation on latest versions (1.6+) – you may have come across a situation where you could not create a file with a different name other than “sitemap.xml”

These changes are only available on latest version and I personally don’t understand the main reason behind it other than the fact that its probably easier for Search Bots?!

Anyway, to work around this problem – you will need to create your sitemaps on sub-folders and use your robots.txt file to communicate with bots on locations of your sitemap files.

You could have a folder structure such as this:

sitemaps/store1
sitemaps/store2
etc

You then set up the sitemap.xml file to be generated to each sub-folder respectively of each store

And finally, define the locations on your robots.txt file as such

# Website Sitemap
Sitemap: http://yourdomain.com/itemaps/store1/sitemap.xml
Sitemap: http://yourdomain.com/itemaps/store2/sitemap.xml

Magento SSL Error 310 net::ERR_TOO_MANY_REDIRECTS

Friday, 25. January 2013

Had this issue today when moving the new Magento 1.7.0.2 upgraded site to the live server which caught me off guard!

Contacting the hosting guys was the sensible decision and it turned out that the latest version of Magento makes an emphasis on case sensitivity with secure variable HTTPS

So to make things work.. you can add this bit on your htaccess file:

############################################
## Fix Case sensitivity fix for Magento 1.6+
SetEnvIf HTTPS On HTTPS=on

OR – simply contact your hosting company and kindly ask them to sort it out for you..

Enjoy!

Remove My Application Link from Customer Account Page

Monday, 17. December 2012

If you ever wanted to remove the “My Application” link from customer’s My Account page here is the layout file to look for

app/design/frontend/[YOUR PACKAGE]/[YOUR PACKAGE]/layout/oauth.xml

Around line 118 – you will see a block of code similar to snippet below which you can simply comment it out.

<!-- My Applications-->
    <customer_account>
        <reference name="customer_account_navigation">
            <action method="addLink" translate="label" module="oauth">
                <name>OAuth Customer Tokens</name>
                <path>oauth/customer_token</path>
                <label>My Applications</label>
            </action>
        </reference>
    </customer_account>