Jump to content

Can't create new Product in 1.6


lamka02sk

Recommended Posts

Hello, I am having trouble with creating new product in PS 1.6 from module. Basically I am working on import module, so it will automatically add or update product in e-shop. I have tried literally everything I found on web. Here is my code:

$product = new ProductCore;
$product->price = $price;
$product->name = [(int)ConfigurationCore::get('PS_LANG_DEFAULT') => 'name'];
$product->quantity = $quantity;
$product->minimal_quantity = 1;
$product->show_price = 1;
$product->wholesale_price = $basePrice;
$product->weight = $weight;
$product->reference = $itemID;
$product->tax_rate = $this->getVatID($vat);
$product->id_manufacturer = $this->getManufacturer($brand);
$product->manufacturer_name = $brand;
$product->ean13 = $ean;
$product->active = 1;

I also tried to remove all unneccessary line so it looked like this >

$object = new ProductCore();
$object->name = [(int)$this->context->language->id => 'name'];

$object->add();

It still return error 500. What am I supposed to do?

Edited by lamka02sk
accidental submit (see edit history)
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...