Simple function for Configurable product in Magento

IN PROGRESS
Bids
1
Avg Bid (USD)
$50
Project Budget (USD)
$30 - $250

Project Description:
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 required:
Magento, PHP
About the employer:
Verified
Public Clarification Board
Bids are hidden by the project creator. Log in as the employer to view bids or to bid on this project.
You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.


Hire Makor
$ 50
in 0 days