Jump to content

Hook to modify the creation of product


Go to solution Solved by renaud2263,

Recommended Posts

Hi All,

 

Actually when I create a new product with my PS 1.6.1, I need the reference is the same of the ID (which I don't know at this stage due to the auto-increment. )

 

So what should be the best way to do that ?

Overriding AdminProductController ? The class ? I saw the function add and the hook actionProductSave called.

But where is this hook ?

 

Or maybe I have to create a module with this kind of hook  :

public function hookActionProductSave()
{
  
    $id = Tools::getValue('id_product');
    $product = new Product($id);
    $product->reference = ($id;
    
   
    $product->save();
 

} 

Could you give me some indications ? Thanks !

Share this post


Link to post
Share on other sites

Hi,

 

During product creation you have the time to grab the product ID from the browser url and put it in the reference field.

If you add the product title, description, price etc hit save & stay. Grab the id from the browser url and paste it.

 

Of course you can automated by using hooks or overrides.

Share this post


Link to post
Share on other sites
  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More