Triggered after a file is added to a product on the
Product Details page.
Please read
this article to learn about
implementing the file upload support on the product details page.
Example:
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onAfterProductFileAdded', $this, 'after_file_added');
}
public function after_file_added($product, $new_file)
{
// Replace existing files with the new one
$files = $product->list_uploaded_files();
foreach ($files as $file)
{
if ($file->id != $new_file->id)
$file->delete();
}
}