When creating a product node for Ubercart, how do I set the product image?
I am using the following code to create a product node.
$node = new stdClass();
$node->name = "Title";
$node->title = $node->name;
$node->body = "Lorem Ipsum";
$node->type = "configurator_product"; //my own product class
$node->created = time();
$node-> changed = $node->created;
$node->promote = 0;
$node->sticky = 0;
$node->format = 2;
$node->status = 1;
$node->language = "en";
$node->default_qty = 1;
$node->sell_price = 55.00;
$node->shippable = 1;
The product node has a field_image_cache field which expects a file (extensions: png, gif, jpg, jpeg). I tried to set this field.
$node->field_image_cache = "Path/to/module/Images/image1.jpeg";
// Results in Fatal error: Cannot unset string offsets in
// path/to/modules/cck/content.module on line 1248
$node->field_image_cache[0]['value'] = "Path/to/module/Images/image1.jpeg";
// No errors, but when viewing the product in store administration there is no image
What is the correct way to set an image for a product?