If a product is cloned, then the variations are edited, the original product variations are changed as well. After spending the time to create many product variations, the product should be able to be cloned and new variations created, without altering the variations on the source product.

Example:
Product: Drupal T-Shirt
Sizes: Small, Large
Variations: sku-drupal-shirt-small, sku-drupal-shirt-large

Clone the Drupal T-Shirt product. Edit the variations in the clone:
Product: Commerce T-Shirt
Sizes: Small, Large
Variations: sku-commerce-shirt-small, sku-commerce-shirt-large

Now, when looking at the original source product, the SKU's have been changed to read "sku-commerce-shirt-small" and "sku-commerce-shirt-large".

Without the ability to clone or product, or bulk create variations, the time needed to add products with variations is increased by several magnitudes.

Comments

jbova created an issue. See original summary.

drugan’s picture


Commerce Bulk

Feel free to request any new feature for the module.

bojanz’s picture

How are you performing the clone? Via some kind of UI? Or $entity->createDuplicate()?

The open question here is how to handle the variation SKUs upon clone.
We clone the product, we clone each variation, then we need to ensure that the SKUs are still unique.
This requires either having a custom UI (which will ask for the SKUs), or appending some kind of string to the SKUs, which might not be ideal.

Of course, these are all only problems when cloning products. Once we add a clone button to variations we'll at least address a part of the need.

jbova’s picture

bojanz, I was cloning the product by navigating to Commerce -> Products. Then selecting "Clone", in the context menu that provides options for Edit, Delete, etc...

Another result of this, is that if you clone a product, then delete the newly created clone, it also deletes every variation from the source product. I cloned a product last night to try to avoid setting up hundreds of variations a second time. After this issue occurred, I deleted the new product (the clone). As a result, the hundreds of product variations on my source product are now gone forever.

drugan, I installed Commerce Bulk last night. So far, so good. This should ease the pain of having to re-create the hundreds of variations that I've lost. Thank you.

bojanz’s picture

bojanz, I was cloning the product by navigating to Commerce -> Products. Then selecting "Clone", in the context menu that provides options for Edit, Delete, etc...

That's not provided by Drupal or Commerce. A contrib is providing it, would love to know which one.

drugan’s picture

@jbova

Do not forget to test the Commerce Generate submodule of the Commerce Bulk. What it basically does creates legal products just with lorem ipsum text for title and body and dummy images for a variation image if it is added to a variation type. So, let's say you have a product with 1000 possible variations and you want to create 1, 2, 20 products then go to admin/config/development/generate/products, choose store to which to assign the products (currency will be taken from the store's default currency) then set the minimal and maximum price the same and press Generate button. After products are created just edit the title and body on them and you are done. Products are ready for sale.

In order to ease adding variations images I have a plan to instruct a user to name their images in a particular manner like my-image-0.png, my-image-1.png, etc., so when the script sees the first image is ending with integer (my-image-0) then it checks if the next exists (my-image-1.png) and automatically adds it to the variation in a loop OR based on attribute value so variation having Red option will be searched for my-image-red.png, Green for my-image-green.png, etc OR user just specifies a folder where to look for the images.

bojanz’s picture

Status: Active » Closed (duplicate)