Simple function for Configurable product in Magento

Job Description :

I have a configurable product in Magento. It is in the object $myproduct

The product may be new (ie not saved yet) or it may be an existing configurable product with colour/size attributes attached.

I need a function with the following parameters

function setMyConfigurableAttributes(&$product, $attributeArray)

// $product is the Configurable product object (passing by reference)

// $attributeArray is an array of the ID’s of Magento attributes that will be configurable on this product

The size of the array could be 1, 2 or 3 elements

Sample calls :

setMyConfigurableAttributes($myproduct, array(12,15)); // would make the configurable attributes 12 and 15

setMyConfigurableAttributes($myproduct, array(9,8,10)); // remove any existing configurable attributes and change to 9 and 8 and 10

setMyConfigurableAttributes($myproduct, array()); // would remove any existing configurable attributes (may not make sense – ignore if this is not possible)

In the examples shown above, the numbers 8,9,10,12 and 15 are Magento ID numbers for the required attributes (eg Colour/Size/Style etc)

I think the Magento function I need to use is $product->setConfigurableAttributesData, but I don’t know how to use it. I also think I may need $product->setCanSaveConfigurableAttributes(true), but I am unsure on this.

I do not need any test cases. The code is being spliced into an existing program

If it is not possible to change the configurable attributes on an existing product, I can write code to delete the product and create a new product before it is passed into setMyConfigurableAttributes to make it easier.

The resulting code must use Magento Objects. It cannot use direct database read/write

Skills: Magento, PHP

See more: magento setconfigurableattributesdata, magento function setconfigurableattributesdata, product setconfigurableattributesdata, function setconfigurableattributesdata, program in direct, php function for, numbers function, how to make use cases, how to create use cases, function of numbers, function numbers, configurable magento, php create function, how to make new product, how to create product, description of product and how is use, remove object, product test, product colour change, magento job, magento database, function, create magento product, size function, product description sample

About the Employer:
( 3 reviews ) Surfers Paradise, Australia

Project ID: #1091155

Awarded to:


hi, please check PM

$50 USD in 0 days
(21 Reviews)