0

I'm seeing about 70ish products that have a creation date that is in the future. These products were imported through CSV, so maybe the date field in the import was incorrect?

Has anyone experienced something like this before, and does it have any affect on the products?

Is there any way to change the product creation date other than editing it in the database?enter image description here

2

It wouldn't affect your magento store. But, still if you want to change it, CSV Import/Export need to be done. Following are the steps you can follow to change the created_at

  • Magento Admin Panel -> System -> Import/Export -> Export
  • Choose Entity Type as Products
  • Filter your products based on created_at, in 5th row, where you'll find created_at (Attribute Code), select current date in From, and empty in To
  • Select Continue Button
  • Download the CSV, open it in excel
  • Change the dates in In 12th column of your CSV, you may find, created-at (heading), change the values under it, where values exist
  • After changing the values, Save the file
  • Magento Admin Panel -> System -> Import/Export -> Import
  • Entity Type as Products
  • Browse & locate the CSV file you changed and saved
  • Check Data
  • If File is valid!, Import
1

I also sometimes encounter this problem, to fix the dates you can create a file called fixdates.php with the content below and upload it in the root folder of you Magento store. Then you can run it going to www.example.com/fixdates.php (you should change the 2 dates according to your need, I'd suggest to set to the current day USA format)

<?php

require 'app/Mage.php';
Mage::app('admin');
ignore_user_abort(true);
ini_set('max_execution_time', 0);
set_time_limit(0);
error_reporting(E_ALL | E_STRICT);
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

$collection = Mage::getModel("catalog/product")->getCollection()
    ->addAttributeToFilter('created_at', array("gt" => "2015-06-11"));

foreach($collection as $product){
    $p = Mage::getModel("catalog/product")->load($product->getId());
    echo "<p>{$p->getName()} ({$p->getCreatedAt()})</p>";
    $p->setCreatedAt("2015-05-01");
    $p->save();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.