1

I have the product name with html tags so written simple script to updated the product name below code i have used for update.

Mage::app();
$product_collection = Mage::getModel("catalog/product")->getCollection();
$product_collection->addAttributeToSelect('*');

foreach ($product_collection as $product) {
   $sku = $product->getSku();

   $simple_product = '';
   $simple_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
   if($simple_product != ''){

      $name = $simple_product->getName();
      if($name != strip_tags($name)) {
          $simple_product->setName(strip_tags($name));
          $simple_product->save();
      }      
   }
}

after that i did the reindex by shall command and cleared the cache.

Now my product names are clear without html tag in frond end like (product list , product view ,search ) all pages looks good. But when i go to admin panel

catalog->Manage Products

I have a product name with html tag so i am bit confusing here so please kindly clarify what's going on here. Also let me know wh

1 Answer 1

0

You may have multi store view /multiple website at your system.In magento,product can be set multiple name basic of multiple store views/multiple websites.

As you have Mage::app(); that means you initialized the default store.So it is take data from default store.

In admin at each product,there have left panel Current scope from there you can view/edit store wise attribute value

1
  • Hi Amit, Thanks for the answer, But my application does not have multi store i have only one store "base" store with two language like English, French, As you said i have changed two language but still i am getting product name with html tag in two languages. But now i found that in frond end i have change into french i am getting product name with html tag. Please could you give me any suggestion to complete this. If i get french product name and again run the this script is useful to fix the issue please suggest me.
    – Srihari
    Commented Mar 31, 2016 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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