Blog

99 Magento guides & fixes

Written from real project work since 2011 — security, performance, development and SEO.

2026

Should you leave Magento in 2026? An honest answer from a Magento specialist

2026-07-07 · Business

Magento's store count is shrinking and Shopify keeps growing. Here's an honest framework for deciding whether to stay or migrate — and how to cut Magento's real costs if you stay.

Magento security in 2026: SessionReaper, active attacks, and how to clean a hacked store

2026-07-07 · Magento 2 Security

SessionReaper (CVE-2025-54236, CVSS 9.1) is being mass-exploited and most stores patched late or not at all. How to check if you're vulnerable, signs you're already hacked, and a proven cleanup process.

2021

How to stop carding attack on Magento 2.x store

2021-09-16 · Magento 2 Security

What a carding attack is and how to stop it on a Magento 2 store using server logs and fail2ban.

2019

Magento 2.3.x Data Migration: products show out of stock after migration

2019-10-02 · Magento 2

Fix products showing out of stock after M1 to M2 data migration with one SQL insert into inventory_source_item.

2018

How to increase sales on your Magento store

2018-08-22 · Conversion Optimization

Eight practical conversion tactics for Magento stores: simple homepage, speed, video, email capture, testimonials, upselling, live chat, A/B testing.

2017

Implementing Magento patch SUPEE-10266

2017-09-15 · Magento Patch

How to apply security patch SUPEE-10266 on Magento 1.x by uploading the patch files and executing the shell script.

2015

Applying Magento security patches – SUPEE-6285

2015-07-09 · Magento Security

SUPEE-6285 protects against customer information leaks, request forgery, XSS in wishlist and cart, path disclosure and more.

Magento: adding a new category attribute without creating a module

2015-04-23 · Development

Add an extra category attribute in Magento 1 with a standalone installer script using Mage_Sales_Model_Mysql4_Setup.

2014

Display cross-selling products on the product detail page

2014-08-05 · Development

Code snippet using getCrossSellProducts() to display cross-sell products on the Magento product page.

How to fix Heartbleed for Magento

2014-04-13 · Security

The Heartbleed OpenSSL vulnerability explained and how to patch your Magento server by upgrading OpenSSL and reissuing certificates.

2013

Extension to add an extra fee to your store

2013-12-02 · Extensions

A fee module that adds an additional fee or discount line to orders based on country, delivery type, payment method or subtotal.

Manipulate collections of products in Magento

2013-11-28 · Development

Retrieve product collections, select attributes and apply filters with getResourceModel('catalog/product_collection').

Solve the problem of trailing slashes in URLs

2013-11-25 · SEO

Avoid duplicate-content issues caused by URLs resolving both with and without a trailing slash.

Get a category's products ordered by number of sales

2013-08-07 · Development

Snippet to fetch products of a category sorted by ordered quantity using the reports product collection.

What to check before using a Magento extension

2013-01-20 · Extensions

Audit an extension's config.xml before installing: model/class/controller rewrites, event observers and cron jobs.

2012

Magento Ajax add to cart

2012-11-03 · Extensions

Ajax Add to Cart lets customers add or remove products without page reloads on any page and for every product type.

Display cart summary and grand total in Magento

2012-09-07 · Development

Show cart quantity and grand total anywhere using the checkout/cart helper's getSummaryCount() and getQuote()->getGrandTotal().

Programmatically unsubscribe a customer

2012-05-09 · Development

One-liner: Mage::getModel('newsletter/subscriber')->loadByEmail($email)->unsubscribe().

Display the Magento store contact number

2012-05-09 · Development

Print the store phone anywhere with Mage::getStoreConfig('general/store_information/phone').

Magento in maintenance mode (with allowed IPs)

2012-03-23 · DevOps

Let your own IPs work on the site while everyone else sees maintenance mode by editing index.php.

Get child products of a configurable product

2012-02-02 · Development

Retrieve the child (simple) products belonging to a configurable product in Magento.

2011

Open the compare items page in a pop-up

2011-12-04 · Frontend

Edit sidebar.phtml to open the product compare page in a modal window.

Display product custom options on list.phtml

2011-11-20 · Frontend

Show a product's custom options on the category list page by loading the product and iterating getOptions().

Add a language pack to a Magento store view

2011-10-31 · Configuration

Install a language pack into app/design and app/locale, then create a store view using that locale.

Remove credit card information from sales emails

2011-10-28 · Security

Stop Magento from including card details in order emails by editing payment/info/cc.phtml.

Add a comment box to each product in the cart

2011-10-26 · Frontend

Add a per-item textarea in cart.phtml and item/default.phtml so customers can leave notes per product.

Organize product images in Magento

2011-10-23 · Catalog

Set the first image as default base, small and thumbnail after imports that wrongly set the last image.

Delete any order in Magento with an SQL query

2011-10-20 · Database

Magento doesn't allow deleting orders from admin; this SQL removes a specific order by increment_id (backup first).

Increase session timeout to one day

2011-10-12 · Configuration

Raise Magento's session lifetime for long-running admin work like large product imports.

Back button on the product detail page

2011-10-10 · Frontend

Add a back-to-category button in view.phtml using the product's current category.

Create a shopping cart price rule programmatically

2011-10-02 · Development

Create cart price rules in code: rule information, conditions and actions.

Adding lightbox.js to Magento

2011-09-25 · Frontend

Add Lightbox to your theme to show larger product images with a brief description.

Display most viewed products

2011-09-15 · Development

Use the reports/product_collection with addViewsCount() to show the most viewed products.

Magento price rule reindex fix

2011-09-11 · Database

Fix reindexing stuck on product price with a SQL cleanup (backup your database first).

Add multiple products to cart at once

2011-09-06 · Frontend

Add checkboxes and quantity fields to list.phtml so customers can add several products to the cart in one action.

Add a new field to Magento registration

2011-09-04 · Development

Four steps to add a custom field to the new-customer registration form via register.phtml.

Move the Magento mini-cart to the header

2011-09-03 · Frontend

Move the mini-cart block into the header via checkout.xml and getChildHtml().

Change the column count for product listing

2011-08-31 · Frontend

Change the number of products per row by editing the product_list block in catalog.xml.

Creating a session in the Magento frontend

2011-08-28 · Development

Set and read custom session variables in the frontend using Mage::getSingleton('core/session').

Display store categories on the homepage

2011-08-25 · Frontend

Show all store categories with their images on the homepage via a custom phtml template and CMS block.

How to add a new country in Magento

2011-08-24 · Configuration

Steps to add a country missing from Magento's directory tables.

Make quick search find the exact phrase or word

2011-08-20 · Catalog

Stop Magento search returning loose matches (e.g. 'earrings' matching 'rings') by switching to exact match.

Import/Export Magento category extension

2011-08-19 · Extensions

A free extension to bulk import and export categories: install app and skin folders, clear cache, run from admin.

Create a daily deal page programmatically

2011-08-15 · Development

Build a daily-deal feature in three parts: create the attribute, code view.phtml, update style.css.

Magento Works is one month young

2011-08-13 · News

Thanks to all members and visitors after the first month; more free plugins and themes coming.

Import bulk categories in Magento

2011-08-09 · Catalog

Import large numbers of categories from a two-column CSV placed at var/import/importCategory.csv.

Magento initial SEO steps

2011-08-06 · SEO

Six first SEO steps for a new Magento store: robots visibility, robots.txt, page titles, meta tags, XML sitemap, canonical links.

Get all customers with billing and shipping addresses

2011-08-03 · Development

Customer collection joined with billing and shipping address attributes: street, postcode, city, phone, region, country.

Display a formatted date in Magento

2011-07-29 · Development

Format dates per locale with Mage::app()->getLocale()->getDateFormat() and date()->toString().

Magento dialog/notification types

2011-07-29 · Development

addError, addWarning, addNotice and addSuccess session messages and how to display them.

Magento Google +1 extension

2011-07-26 · Extensions

Add the Google +1 button to product pages to bring social recommendations to search.

Layered navigation on the product detail page

2011-07-23 · Frontend

Create layeredview.phtml and show layered navigation filters on the product page.

Display products with paging on the home page

2011-07-21 · Frontend

Add a paged product list to the homepage with Update Layout XML in the CMS page — no code files needed.

'Shop by brand' in the sidebar

2011-07-09 · Frontend

Create productbrand.phtml listing brand attribute values as links in the sidebar.

Create a customer by code

2011-07-08 · Development

Create customer accounts programmatically with the customer model.

Change the admin URL in Magento

2011-07-06 · Security

Rename the /admin frontName in app/etc/local.xml to harden your backend against attacks.

Display category bestsellers

2011-07-06 · Development

Reports collection with addOrderedQty() filtered by the current category, ordered by quantity sold.

Display the cart grand total

2011-07-04 · Development

Fetch the quote's grand total and format it with the checkout helper.

Remove compare products from the sidebar

2011-07-04 · Frontend

Remove the catalog.compare.sidebar block from catalog.xml.

Send every store activity email to the store owner

2011-07-01 · Development

BCC all transactional emails to the owner by editing the core email template model (better: use a rewrite).

Get the customer group ID

2011-06-30 · Development

Check login state with customer/session then read the group ID from the session.

Custom form module with email notification

2011-06-30 · Development

Build a small custom module (MageWorks_Contact) with module XML, config.xml and a notification email.

Get a nicely formatted final price

2011-06-28 · Development

Combine the tax helper's getPrice() with the core helper's currency() for a formatted final price including tax.

Product image switcher on mouseover

2011-06-28 · Frontend

Swap the main product image on hover by editing media.phtml.

Set the base currency programmatically

2011-06-26 · Development

Change the store's base currency from code at bootstrap.

Login with Facebook account extension

2011-06-26 · Extensions

Set up a Facebook app with API key and secret to let customers log in with Facebook.

Moving Magento from one host to another

2011-06-24 · DevOps

Checklist for migrating a Magento installation between hosts: backups, database credentials in local.xml, base URLs, cache flush.

Fixing catalog price rules issues

2011-06-24 · Database

Resolve catalog price rules not applying after reindex.

Running a custom SQL query in Magento

2011-06-23 · Database

Use core/resource core_read connection to run raw SQL against Magento's EAV tables.

Display all product attributes in the shopping cart

2011-06-23 · Frontend

Iterate a product's visible frontend attributes and show them per cart item in default.phtml.

Magento methods: getModel and getData

2011-06-22 · Development

What Mage::getModel() instantiates and how magic getters like getName() and getPrice() map to data keys.

Change the color of 'Availability: In stock'

2011-06-22 · Frontend

Style the stock availability label by editing the product type template.

Magento single page checkout extension

2011-06-21 · Extensions

EasyCheckout converts the multi-step checkout into a single page.

Display featured products randomly on the homepage

2011-06-21 · Frontend

Random featured products via a CMS block calling a custom homepage.phtml based on list.phtml.

Speed up your Magento site

2011-06-20 · Performance

Enable Gzip compression via .htaccess and switch catalog to flat tables to speed up Magento.

Get all product reviews on a CMS page

2011-06-20 · Development

Loop the product collection and load each review summary to list all reviews on one page.

Show available quantity in a dropdown on list.phtml

2011-06-20 · Frontend

Render a qty dropdown limited by the product's stock quantity on the category page.

Magento flat table option for products

2011-06-20 · Performance

Why EAV is slow and how the flat resource option (Magento 1.5+) speeds up product data fetching.

Magento advanced (Ajax) layered navigation

2011-06-19 · Extensions

Free extension converting layered navigation to Ajax with multi-select filters, SEO links and backend configuration.

Disabling a Magento extension manually

2011-06-18 · DevOps

Set the module's active flag to false in its app/etc/modules XML file.

Get the current category

2011-06-17 · Development

Mage::registry('current_category')->getName().

Run a script outside the Magento folder

2011-06-17 · Development

Bootstrap Mage.php from an external script to batch-update product images and data.

Creating a product programmatically

2011-06-17 · Development

Full example building and saving a simple product: SKU, attribute set, categories, prices, stock data.

Edit the thank-you message on the contact page

2011-06-17 · Frontend

Change the contact form success message shown after submission.

Limit the number of images per product

2011-06-17 · Development

Enforce an image limit in the admin ProductController saveAction.

Display a static .phtml page from the CMS backend

2011-06-16 · Frontend

Include a template file in a CMS page via a block directive.

Display an image from the skin folder

2011-06-16 · Frontend

<img src="<?php echo $this->getSkinUrl('images/sitelogo.jpg');?>" />.

Check if a customer is logged in

2011-06-16 · Development

Mage::getSingleton('customer/session')->isLoggedIn().

Remove SID from Magento URLs

2011-06-16 · SEO

Stop session IDs appearing in URLs (also configurable via System → Configuration → Web → Session Validation).

Get the product ID on the frontend

2011-06-16 · Development

Echo the product ID with the catalog output helper.

Display currency with PHP number_format

2011-06-15 · Development

number_format($_product->getFinalPrice(), 2).

Get product IDs from a specific order

2011-06-15 · Development

Load an order and iterate getAllItems() collecting name, price, SKU, product ID and quantity.

Get the base URL in Magento

2011-06-15 · Development

Fetch the store's base URL from code.

Magento addAttributeToFilter reference

2011-06-10 · Development

Filter product collections: eq, neq, gt, lt, gteq, lteq, like, in, notnull and more.

Product thumbnail image switcher

2011-06-10 · Frontend

Swap the main image when a thumbnail is clicked by editing media.phtml.

Get all top and sub categories

2011-06-04 · Development

Build a nested category navigation with the catalog/category helper and getChildrenCategories().

Add a CMS static block to a page with PHP

2011-03-09 · Development

createBlock('cms/block')->setBlockId('identifier')->toHtml().

Get all addresses of a customer

2011-03-05 · Development

Retrieve every address of a customer by email address.

Display category products with SQL in list.phtml

2011-03-03 · Database

Fetch product IDs of a category with raw SQL against catalog_category_product.