Magento 1.9保存产品,不会出现在前端

I have a problem seeing products on the frontend of Magento.

I have created a script, save.php:

<?php
set_time_limit(0);

// require magento core
require_once 'app/Mage.php';

// execute on admin store
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

$products = Mage::getModel('catalog/product')->getCollection();
foreach($products as $product) {
    echo $product->getName() . '<br/>';
    // save the product
    $product->save();
}

echo 'DONE';
?>

After I run it with php -f /var/www/shell/save.php, I still don't see the product on frontend. If I save product with backend I see it, why is that?

Please Clarify your question: If you are simply wanting to see your echos of the product name and the final 'done', it could be either Permissions may need to be set to 644 or the script is not in magento root.

If that is not your question: Your current code is saving objects who's record(s) are already in your DB, without changing any data to save..

The proper way to duplicate is:

$newProduct = clone $product;
$newProduct->setData('sku','wowaNewSkuString');
$newProduct->save();

The proper way to just edit, is:

$product->setData('sku','wowaNewSkuString');
$product->save();

And of course, with Magento always flush cache and reindex after major changed/edits to ensure your flat tables (if enabled) are up to date.