wp-e-commerce/WP-e-Commerce — pull request #1659 by benhuson (2014-11-20 23:40:24+00:00)
Title: Duplicate product images fix

For issue #334

When duplicating a product, this now also duplicates the image files using media_handle_sideload().
I haven't stress tested this with a product with lots of large images to see if there would be timeout issues or anything.

After duplicating a product and it's meta data the post cache is cleaned. As meta data is duplicated via SQL query rather than API, using API functions on new duplicate product immediate is not possible without first clearing the cache.

After duplicating image files, if there is a featured image, the duplicated image ID is set as the featured image (if it is one of the duplicated children).

As duplicated attachments are now created by media_handle_sideload(), ensure all base attachment data and meta data is copied across (not overwriting and of the new meta data).

Added `wpsc_duplicate_product` and `wpsc_duplicate_product_child` actions in case there are needed to hook in to duplicate any other additional information (metadata added by 3rd party plugin etc).