Back to JKShop Support


Hey man, could you please add Duplicate feature please? I think I already asked for it.

It's very useful. I already made a code for it (its simple, but working)

in Product.php:

      public function onDuplicate(){

        $selectedId = post('id');

        $selectedProduct = Product::where('id', $selectedId)->first();

        $duplicatedProduct = $selectedProduct->replicate();

        $duplicatedProduct->slug = $selectedProduct->slug . 'duplicate';

        $duplicatedProduct->title = $selectedProduct->title . 'duplicate';



In update.htm (product controller):



                    data-request-data="id: <?=$this->params[0] ?>"


                    class="btn btn-default oc-icon-copy">



It not taking the picture for some reason, but at least it's there. I have project which products are based on the same structure. And there is lot's of vestions on the product which cannot be under custom param.

Thanks and good luck!


I would also be intersted in this feature. I am trying to get something similar to work but with all the product relationships as well.

What I want is this: User selects item from list of products - there is a checkbox to select, the id of the selection is sent through to controller, we grab data on the product and build up a list of the product relations ready to duplicate.

public function onTesting() { $product_type_id = post('checked'); $product_type = ProductType::with('product', 'productMode', 'productAttributes', 'relatedToProductTypes', 'relatedFromProductTypes', 'accreditations', 'media')->find($product_type_id); $new_product_type = $product_type->replicate(); $new_product_type->push(); return [ 'product_type' => $product_type ]; }

The issue I am having at the moment is that the replicate function doesnt appear to be found, it should be as I have loaded in the ProductType model

Last updated

Jiri Kubak
Jiri Kubak


thanks for it i will add this feature in new version ;)

Regards Jiri

Jiri Kubak
Jiri Kubak

mike.last22290 said:

Awesome thanks


duplicate function will be add in a new version today.


1-5 of 5