Exporting Products from Magento – making it quicker

The phrase take only what you need springs to mind when it comes to exporting products in Magento. The lack of a check all button to ignore all field options in the export can lead to a waste of time if you only want 2 or 3 specific columns. Enter developer tools in (some/most modern browsers) Chrome and a little bit of Javascript magic.

Entering this in the console tab in the developer tools (right click and choose inspect from the menu that appears)  and all the checkboxes are checked and you can spend your time selecting which columns it is you need.

Code comes from here

Fix Form_key validation for T-Shirt Magento Template #58506

If you have purchased the T-shirt #58506 template from Template Monster you may well find it doesn’t work with FormKey validation enabled.

Here is the fix for it.

Open the following file:

And add the following code to line 217 just inside the </form> tag (they forgot to include it, or possibly didn’t update it when patch SUPEE-9767 came out):

 

 

 

 

 

Adding Custom CSS for Print

You may want to setup a custom css file for your magento store – for your order details as an example.

Adding the following code to your custom layout.xml file will add a custom_print.css file from the location of /skin/frontend/base/default/css/custom_print.css

 

Ordering a Category Collection by the Newest to Oldest

Well it sounds simple and it is – but only once you remember that there is no “id” field in the flat catalog tables. Every time you add a new category or product – it is assigned a new incremented entity_id there by ordering by the field in DESCENDING order you will always get the newest ones at the top.

 

Re-indexing Magento 2: Command Line

You can no longer do any re-indexing manually through Magento Dashboard – you can either do it through a cron-job or using a series of commands on the command line.

You can specify an optional reindexer name to re-index a specific index otherwise the above command will re-index all of them one after the other.

Read More Here

Deleting Duplicate Records using MySQL

I recently had a table which ended up with some duplicate records being imported. A simple way to achieve this is to use a subquery as follows:

If you want to keep the row with the lowest id value:

If you want the id value that is the highest:

Original Article: Stack Overflow

Use Developer tools to select DB tables quickly.

If like me you find yourself emptying the same tables again and again (test orders etc) it can be frustrating to check 20-30 tables. Why not let the developer tools in Chrome do it for you.
For example the javascript below will select all the sales data tables you will need to empty if you want to reset all the order tables. Just open the inspector and paste the Javascript into the console.

To customise this to suit your requirements simply replace the value=”; with your database table names.

How to enable a theme for your Magento mobile web site?

You can use execeptions (the good kind) to show different templates on mobile devices.

To add exceptions for the mobile devices, navigate to the Magento administrative area -> System -> Configuration -> Design -> Themes. Click on the Add Exceptions buttons besides the Templates, Skin and Layout labels.

Enter the following line in the Matched Expression field:

iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini

In the Value field enter the name of your newly installed mobile theme and Save the changes.

Then you can open your web site through your computer and your mobile phone. You will see that it loads with two different themes depending on the device.