嗨,我有一个从magento获取所有产品数据的脚本,出现了一个问题,即有些产品的名称相同但不同,我想附加具有相同值的产品名称,而其他具有唯一值的产品名称不应该附加...
<?php
@ob_start();
@session_start();
ini_set('display_errors', 1);
include '../../../../app/Mage.php';
umask(0);
Mage::app('default');
function empty_pk($data){
if($data!=''){return $data;}
else {return " ";}
}
$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('status', 1);
//arsort($collection);
//echo'<pre>';
//print_r($collection);die();
echo 'count===='.count($collection).'<br/>';
$i=0;
foreach ($collection as $product_all) {
//echo $product_all->getId().'<br/>';
if($i==10) break;
$id = $product_all->getId();
$neew = Mage::getModel('catalog/product')->load($id);
//echo'<pre>';
$product_id = $neew->getId();
$created_at = ' 2013-01-26 00:53:46';
$description = $neew->getdescription();
$short_description = $neew->getshort_description();
$sku = $neew->getsku();
$size_fit = $neew->getsize_fit();
$style_ideas = $neew->getstyle_ideas();
$name = $neew->getname();
我怎样才能做到这一点