Magento : Get product URL In Export CSV

Magento : Get product URL In Export CSV

October 18, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento : Get product URL In Export CSV

Exporting Magento Products: Getting Full URL Paths in CSV

When it comes to exporting products from your Magento store, you might find yourself wanting more than just basic details like SKU or price. Sometimes, you need the full product URL for each item in your export file.

This can be particularly useful when migrating between platforms or integrating with third-party systems that require complete URLs. Unfortunately, this isn’t a feature built into the core Magento export functionality.

To achieve this, we’ll need to modify some of the default export behavior and add the necessary logic to include the full product URL in our CSV files.

Understanding the Magento Export Process

Before diving into the code changes, let’s quickly review how Magento’s export process works. The core export mechanism is defined in app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php.

The export process essentially involves iterating over the desired product collection and mapping each attribute to a corresponding column in the CSV output.

Adding Product URLs to the Export

To include full product URLs in our exports, we’ll need to extend the existing logic. We’ll modify the getColumnValues method in app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php.

First, make a backup of this file and then open it for editing.

public function getColumnValues($row)
{
    // ... (-existing code)

    $url = Mage::getModel('core/url')->getUrl('*/*/index', array('_store' => $storeId));
    $col['url'] = $url;

    return $col;
}

What we’ve done here is create a new column called ‘url’ and populate it with the full path to the product. We’re using Mage::getModel('core/url')->getUrl to generate the URL, passing in the controller action (‘//index’) and the appropriate store ID.

Testing Your Changes

After making this adjustment, save your changes and flush Magento’s cache. Now, when you conduct an export, you should see a new column titled ‘url’ that contains the full product path for each item in your CSV file.

It’s important to note that this code assumes you’re using the default Magento URL structure. If your site has custom URL rewrites or SEO-friendly URLs enabled, you might need to modify the URL generation logic accordingly.

Conclusion

Including full product URLs in your Magento exports isn’t a built-in feature, but it is achievable with some strategic code modifications. By extending the core export process and adding our own ‘url’ column, we can generate complete path information for every product in our CSV files.

Remember to test this change thoroughly before relying on the exported data, as URL generation can be complex depending on your site’s configuration.

Catalog Pricing Import/Export

Our network