Micheal S
Micheal S

Reputation: 1

Altering an attribute value after items have been implented, Magento

Good day,

So i'll get straight to it, I've imported a ton (6000~) of products into my shop and it appears that the visibility value that I stated in the CSV I used for importanting has been ignored / neglected during the importing process. I'm currently using this code.

<?php require 'app/Mage.php'; Mage::app();

 $products = Mage::getModel('catalog/product')->getCollection()
 ->addAttributeToSelect('visibility')
 ;
 foreach ($products as $product) {
 $roundup = $product->setVisiblility($product->'visibility', 4);
 echo ceil($roundup);
 $product->save();
 }

 ?>

But it doesn't seem to work, any thoughts?

Upvotes: 0

Views: 102

Answers (2)

Max
Max

Reputation: 8836

foreach ($products as $product) {
  $product->setVisiblility(4);
  $product->save();
}

Upvotes: 2

Sergey
Sergey

Reputation: 258

For what you are doing this?

Go to Admin->Catalog->Manage Products

Click "Select All" link and then in Actions set to "Update Attributes" -> Submit

In Attributes list find attribute Visibility and set it value to what you need, then click Save and all Done (may be you must clean cache and reindex data after this - I don't remember)

One of the reasons of attribute is not imported correctly may be that when you doing import you have not English language in admin area - set it to english before import or in csv/xml use Value on your language

As I remember this future with languages for standart attributes in import changed from magento 1.4.2

Upvotes: 1

Related Questions