I want to add samples in downloadable product programmatically.
I am trying this
$samplefiles[] = array(
'file' => '/u/n/untitled_1.png',
'name' => 'Untitled.png',
'size' => 4672,
'status' => 'new'
);
$sampleModel = Mage::getModel('downloadable/sample')->setData(array(
'product_id' => $product->getId(),
'sort_order' => 0,
'sample_url' => '',
'sample_file' => json_encode($samplefiles),
'sample_type' => 'url',
));
$sampleModel->save();
But its not working..And how to save sample title