문제

I have imported all of my products as configurable and their options as simple product types, all the simple products have the correct size attributes and the configurable products have the right attribute_set.

What is the best way of associating the product options with their products?

I would rather not do this with SQL, or manually if I can help it!

Thanks in advance

도움이 되었습니까?

해결책

As I understand your question, you want to assign simple products to its' configurable parent? If so, please look at Mage_Catalog_Model_Product_Type_Configurable model. There is method save() which call resource model's method saveProducts($mainProduct, $productIds):

Mage::getResourceModel('catalog/product_type_configurable')
            ->saveProducts($this->getProduct($product), $productIds);

다른 팁

I always thought this wasn't possible using the SOAP-API (as explained e.g. here).

But quickly googling has shown that somebody apparently managed to do this using the SOAP-API. Here's the relevant code from the forum post:

$this->proxy->call($this->session,
    'catalog_product_link.assign',
    array('configurable',
        $newConfigProdId, //This is the product ID of the configurable product
        $createdVariants, //This is an array of product IDs of simple products to associate to the configurable product
        array(ATTR_ID_COLOR, //This is an array of attribute IDs to create as superAttributes for the configurable product.
            ATTR_ID_SIZE //I've defined them as constants...
        )
    )
);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top