Page 1 of 1

Coding question.

Posted: Sun Dec 15, 2024 3:48 pm
by Dan Cole
I'm updating a bit of code I use for copying products and noticed this code in one of the catalog actions.

Code: Select all

$admin_hooks->call('categories', 'preDuplicateCopyToConfirmAction', $parameters);
I did a search on github but I can't seem to find any other references to it or what is might be used for so I'm wondering if someone might be able to point me in the right direction or give me a brief explanation as what it might be used for? I'm curious.

Dan

Re: Coding question.

Posted: Sun Dec 15, 2024 4:14 pm
by burt
This would be used by a Hook, at the point of confirming when duplicating a product.

EG if shopowner was duplicating a product the shopowner could write a hook to set product_quantity to 1000 instead of (say) duplicating the qty of the prodcut being duplicated.

Shiny Red Apples: 4 in stock
Even Shinier Redder Apples (the dupe): 1000 in stock

Re: Coding question.

Posted: Sun Dec 15, 2024 4:22 pm
by Dan Cole
burt wrote: Sun Dec 15, 2024 4:14 pm This would be used by a Hook, at the point of confirming when duplicating a product.

EG if shopowner was duplicating a product the shopowner could write a hook to set product_quantity to 1000 instead of (say) duplicating the qty of the prodcut being duplicated.

Shiny Red Apples: 4 in stock
Even Shinier Redder Apples (the dupe): 1000 in stock
Ahhh...thanks Gary....I guess it is not in use but could be....I get it. I appreciate it.

Dan

Re: Coding question.

Posted: Sun Dec 15, 2024 5:33 pm
by ecartz
You would need it if you had custom columns in the product. As is, it copies the columns for a core product. If you add custom columns, it won't know to copy those. You'd need to add them to the things to be copied.

Re: Coding question.

Posted: Sun Dec 15, 2024 5:50 pm
by Dan Cole
ecartz wrote: Sun Dec 15, 2024 5:33 pm You would need it if you had custom columns in the product. As is, it copies the columns for a core product. If you add custom columns, it won't know to copy those. You'd need to add them to the things to be copied.
Thanks Matt....I understand and appreciate the explanation. I do have extra columns so I might give that a try. As I update my existing site and dig deeper into the code, I'm totally amazed at the work you guys have done. Awesome stuff.

Dan