2026 Executive BenchmarkMid-Market Enterprise Modernization: How leaders across unify Commerce, Odoo ERP & AI in 90 days.
MAGENTO COMMERCE

How to get product sku or details using product name CSV in magento

If you Have Product Name and get product details for import product csv use this. Create php file and put code foreach ($product_collection as $product) { echo ‘”; //exit; } echo ”...

Akshar Group Technologies
Dec 25, 2020
1 min read
Verified Source

If you Have Product Name and get product details for import product csv use this. Create php file and put code

php
<?php
require_once '../app/Mage.php';
Mage::app();
$row = 1;
echo '
‘; if (($handle = fopen(Yourcsvname.csv', r')) !== FALSE)
{ while (($data = fgetcsv($handle, 1000, ,')) !== FALSE) { $num = count($data);
//echo ' $num fields in line $row: n'; $row++; for ($c=0; $c < $num; $c++)
{ echo '; echo ‘'; $product_collection = Mage::getResourceModel(‘catalog/product_collection')
->addAttributeToSelect(‘*') ->addAttributeToFilter(‘name',$data[$c]) ->load();
foreach ($product_collection as $product) { echo ‘'; //exit; } echo '; } } fclose($handle); } echo ‘
‘.$data[$c].  ‘.$product->getSku() . 
‘; ?>
After this same location put your CSV File. In csv File your product Name must be compulsory and save this. You Get your csv product all Details.
Share this playbook
LET'S BUILD WHAT'S NEXT

What's Holding Your Business Back?

Tell us where you want to go, what's getting in the way, and we'll help you figure out the technology to get there.

No sales pitch. Confidential strategic advisory.