Magento Create a product attribute that is a whole

So it’s obvious that the support you get from Varien when you buy Enterprise Edition is next to useless, so I hope someone here can lead me in the right direction.

In Magento, I would like to create a product attribute, which is an int type. When I create an attribute from the admin panel, it creates it as a varchar.

What I'm ultimately trying to do is create a generic sold attribute so that I can use it to sort by most of the products sold on the category display. The problem with this being varchar is that when you sort by this parameter, it sorts it as a string, not a number.

Varien told me that in order for this to be an integer, I would need to do a database update. It seems to me that I would have to change the backend_type column in the eav_attribute table to int, and we hope to move the values ​​to the catalog_product_entity_int table instead of going to the catalog_product_entity_varchar table. Does this make sense? Has anyone else done this before?

Now that I have this question, is this what I should expect from Varien support? So far, their support seems rather useless. It seems that asking how to do something so simple will not be a big problem (especially since I asked them how to do it, and not do it for me)

+3
source share
4 answers

, mysql. ; , , , - . , , , EAV , , .

, ( "Final Array of Key Value Pairs" "). , , , .

+5

backend_type eav_attribute, catalog_product_entity_int, INSERT INTO SELECT query, catalog_product_entity_varchar .

( , ), int mysql-install . , .

- varchar , int. , .

, , JD

+3

, , , .. , , , , .

- , = , , ..

Cheers,

0

. , .

magento (System/ImportExport/Profiles). Export: " ". sku , integer .

sql :

mysql4--0.1.0.php   

$installer->startSetup();
$installer->updateAttribute('catalog_product', '<<your_attribute_code>>', array(
'backend_type'    => 'int',
));
$this->endSetup();
?>

Later, it is very important to override product_attribute and product_flat_data.

The next step is to mark all products that use this attribute, and using the "update attributes" action, you must set the value to 100, for example.

Now reindex again !!!

and import the file with another profile into the data stream.

Good luck

0
source

Source: https://habr.com/ru/post/1763705/


All Articles