当前位置: 动力学知识库 > 问答 > 编程问答 >

How to set product name attribute as unique in magento

问题描述:

I'm using a search box that shows a list of product names in a drop-down list.

When the user selects one of the product name and clicks search, the page will be redirected to the product associated to that name.

The problem here is: if the product contains more than one similar name, we will fail to redirect the user to the correct product. That's whey Iwould like to add an unique product name.

I wasn't able to set it as unique in admin's Manage attribute tab.

I tried to change it via database by changing its value from 0 to 1 in eav_attribute table, but it does not make any sense.

So, how can I add unique option to the product name?

网友答案:
UPDATE 'eav_attribute' SET is_unique = 1 WHERE `entity_type_id` = 4 and  `attribute_code` like 'name'

Its the best way.

分享给朋友:
您可能感兴趣的文章:
随机阅读: