Jump to content

Add products


Recommended Posts


Im trying to add dynamically a product but i don't manage. My main issue is that i am able to add it to the database but i can never see it displayed neither in the frontend nor in the admin part. Also when i do insert it through the admin part, in the database the column "indexed" in the table "ps_product" is true, but when i do by code always false although i put the member class of the Product class to true.

Any idea?

Here is my code:

Note: the manufacturer, supplier and category i put harcoded the ones prestashop added me by default

$product = new Product();

$product->name = "test book";
$product->price = "10";
$product->indexed = true;

if ($product->add())

And in here in theory my product is added, appears in the database but never anywhere in the website...

Thanks in advance.

Link to comment
Share on other sites

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...