Hi,
i added some lines to the magento_products.module to syncronize all user generated field from the magento database.
At this time you have to add this fields same names by hand to your drupal contenttypes but after creating this fields the content comes from magento.
you dont have to create all fields. just the fields you need.

before the line 225:
node_save($node);

you have to add this code:

//productattributes
$raw_productdata = magento_api_catalog_product_info($product['entity_id']);

$array_without = array('product_id', 'sku', 'set', 'type', 'categories', 'websites', 'created_at', 'type_id', 'name', 'description', 'short_description',
'news_from_date', 'news_to_date', 'status', 'url_path', 'category_ids', 'has_options', 'price');

foreach ($raw_productdata as $key=>$value) {
if(!in_array($key, $array_without)){
$field = "field_".$key;
$node->$field = array(array('value'=>$value));
}
}

it would be great to add this to the major drupal-magento module

Comments

themaverick’s picture

to fix a smal bug change the first line of my patch

$raw_productdata = magento_api_catalog_product_info($product['entity_id']);

should look like this:
$raw_productdata = magento_api_catalog_product_full_info($product['entity_id']);

themaverick’s picture

or better
$raw_productdata = magento_api_catalog_product_full_info($product['entity_id'], null);

mmironenko’s picture

Good issue.
We'll prepare release of new version soon. I think this code will replace our version with data in cache. Or we'll merge both variants.
Thank you for your regard.

Maxime Topolov’s picture

Hi themaverick, could you check the code proposed by sndev ?
He moves forward for a full support of magento attributes as CCK fields. With pseudo code.

http://drupal.org/node/642772

Maxime Topolov’s picture

Assigned: themaverick » Unassigned
Status: Patch (to be ported) » Closed (won't fix)

Big changes are currently done on Magento module. We provide full support of Multi-Site structure & configurable products, bundles and so on. So this issue will be donc in V2. Keep updated.