Integrity constraint violation: 1052 Column ‘position’ in order clause is ambiguous

Tuesday, 30. August 2011

This is a small bug on core file located here:

~/app/code/core/Mage/Catalog/Model/Layer.php

The error will usually happen when you perform a simple search on your Magento site. To locate and fix the bug do the following:

Search for method getFilterableAttributes() and look for something relating to the code below.

public function getFilterableAttributes() {
....
        $collection->getSelect()->distinct(true);
        $collection
            ->setAttributeSetFilter($setIds)
            ->addStoreLabel(Mage::app()->getStore()->getId())
            ->setOrder('position', 'ASC');
.....
}

The setOrder needs to look something like code below:

public function getFilterableAttributes() {
....
        $collection->getSelect()->distinct(true);
        $collection
            ->setAttributeSetFilter($setIds)
            ->addStoreLabel(Mage::app()->getStore()->getId())
            ->setOrder('main_table.position', 'ASC');
.....
}

NOTE

I would NEVER recommend you edit core files directly. If you can not create a custom extension to override this method you should at least copy and edit this file in your local Mage folder.

So you should have something like:

~/app/code/local/Mage/Catalog/Model/Layer.php

Then do the changes here as explained above.

Magento Grouped Products | HowTo Get Associated Grouped Products

Thursday, 25. August 2011

If you are working with Magento Grouped Products and want to list all its associated products (links) here is a snippet script on how to do just that:

if ($_product->isGrouped()) {
  foreach ($_product->getGroupedLinkCollection() as $linkprod) {
    /**
    ......Your implementation here
    */    
    var_dump($linkprod->debug());
  }
}

Locale Mage en_GB | Magento Local Module For GB

Tuesday, 23. August 2011

In order to install the Locale_Mage_community_en_GB you will need this module here:

Locale_Mage_community_en_GB

Enjoy!

Ogone Payment | Detected an illegal character in input string in ..app/code/core/Mage/Ogone/Model/Api.php

Tuesday, 23. August 2011

For Ogone Payment users, If you have ever come across such error during checkout process the issue is actually really simple:

Basically, you have an illegal/invalid character on your Product name somewhere and since the product name is also posted to Ogone for payment processing, this will cause an error:

To fix it: as you may already guessed, please remove the bad character and try again!

Magento SagePay Orphaned Transactions : What are they and What do They Mean?

Monday, 22. August 2011

Magento SagePay Orphaned Transactions:

what are they and why are they there in the first place? You may learn something from this post!

I have always wondered myself why and what these messages do mean and most importantly, do they have any negative effect on client’s sites?

After a bit of digging, I came to narrow it down to a number of points:

1) This seems to be (but not limited to) SagePay Direct protocol.

2) These are simply informational reports rather than errors on your page or SagePay. It simply SagePay trying to be useful and informational to you by being causing a little confusion!

The reason why this happens in the first place is that by default all transactional requests to SagePay (especially with SagePay Direct protocol) will always return an OK response on the very first attempt.

Locally, SagePay will create and hold an orphan child and wait for the final order completion to process the final payments and then update this orphan record to complete or processing etc.

Now if for any reason the customer did not complete the order successfully, these orphan records remains on the system and SagePay will then notify you about them suggesting there is transactions happened but there is no order associated with them.

So, personally I will probably not loose any sleep on these but rather on finding our why customers choose not to complete their order and how to minimize shopping cart abandonment.

Drop a comment if you have any more insights on this and/or if you would like to suggest something more interesting!

Mage_Adminhtml_Block_Widget | Fatal error: Call to a member function setData() on a non-object in /includes/src/Mage_Adminhtml_Block_Widget_Grid.php on line 299

Monday, 22. August 2011

Magento Compilation is great but can easily piss you off especially when you encounter an error such as this.

I have been approached for too many times in regards to this error, I think it will benefit many if share it on my blog!

The simple and quick way to solve this is by:

1) Access you site root folder via FTP or Control Panel or Any way you can get to the index.php file!

2) Open the index.php folder and look for the following block of code

$compilerConfig = 'includes/config.php';
if (file_exists($compilerConfig)) {
    include $compilerConfig;
}

3) Comment it out completely.

4) Log back in to your admin and finish the compilation process. Make sure its back to being disabled after the process finishes.

5) Uncomment the block of code in the index.php file you commented out in step 2.

NOTE
You can also disable compilation from command line with the following line

php magentodir/shell/compiler.php disable

All done!!

Magento vs Persistent Shopping Cart – Magento Supported Feature out of the box!

Saturday, 20. August 2011

If you have been following the various stages of Magento 1.6.0.0 release you would have noticed that from now, Magento do support Persistent Shopping Cart out of the box!

To most store owners Persistent Shopping Cart will bring smile to their faces and if you have been wondering how on earth this was not supported much earlier, wonder no more!

Persistent Shopping Cart.

what is it after all?

Well, to answer this shortly, Persistent Shopping Cart allows customer’s shopping carts to be persisted or saved across sessions.

What this means is that, Imagine a customer has added a few items in the shopping cart and then gets an emergency to attend to before finishing her checkout process. Under the current settings the session will preserve her contents for a short period of time before it expires and looses all the cart settings.

When the customer returns the next day for example, she will have to add the items to the cart all over again and usually while cursing your system, a lot!! (We have all done this!)

With Persistent Shopping Cart, when she returns tomorrow to her laptop and goes to your website again, all her contents will be right there waiting for her to finalize the checkout process. In fact, Magento will support persistence for customers across user sessions, browsers and devices.

I think this is fantastic! Can you imagine how many happy customers you will make and most importantly how many abandoned shopping carts you are going to save?

Obviously this is not the ultimate solution to your shopping cart abandonment issues (Yes, I am sure you have them!) but it can help save those few ones which were abandoned simply because a customer was pissed off and couldn’t be asked to “re-fill” the cart again.

Persistent Shopping Cart by diagram

Magento Persistent Shopping Cart
Note: The user must log in once per browser/device combination to establish persistent shopping

Quoting MagentoThe user will not be able to complete the checkout process or access account information unless they are officially logged in. Persistent shopping cart is completely configurable by merchants, provides an additional way for the merchant to strengthen customer satisfaction and loyalty and helps increase conversion rates.

Drop us a comment if you found this helpful and/or you want to add your experience or views on this topic.

WordPress – Turn Off Comments On WordPress Pages Only

Thursday, 18. August 2011

If you have been wondering how on earth one can turn off the comments on wordpress pages but still have commenting on posts, here is the solution for you.

I was somehow sure this is a simple matter of unchecking a single checkbox but I was wrong. To successfully turn achieve this:

1) Locate your theme’s page.php page.

2) Look for and uncomment this line

<?php #comments_template(); ?>

Save file and test your pages!

Magento Help – Need Magento Developer Urgently?

Thursday, 18. August 2011

Get Magento Help, Magento Advice, Magento Developers UK

Hire Magento Developer

Do you need Magento Help, Advice or an experienced Magento Developer to simply lean on in times on need?

Well, look no further! You have come to the right place and we at Zone-Connect would like to welcome you at our company and most important, provide you with the necessary help you need to run your Magento store with no hussle.

Why wait any longer click this link to get in touch with us today and we will make sure we help you in any way we can.

We guarantee you will feel at home with us!

Mysql – Got a packet bigger than ‘max_allowed_packet’ bytes

Friday, 12. August 2011

If you have been restoring a database backup via a command line utility and came across this type of error, this command my help you out if you give it a try!

It allows you to set up the max packet limitations only for this command run

mysql --max_allowed_packet=200M -uroot -p mydb < mydump.sql

If you want to alter you entire server configurations, you will need to do the following:

1) Locate your my.cnf or my.cnf file
2) Locate the section [mysqld] and somewhere underneath you can change/add this line:

[mysqldump]
max_allowed_packet = YOUR_VALUE

You can now change YOUR_VALUE to your new preferred limit.

You can also use command line facility to execute the following commands on your machine/server:

set global net_buffer_length=SOME_BIG_VALUE;  (i.e 1000000)
set global max_allowed_packet=SOME_BIG_VALUE; (i.e. 1000000000;