Jump to content

Problem When Execute $product->save()


tgonzalez

Recommended Posts

Hi, I am trying of create a series of products througth a CSV, when I start a bucle program save firsth product but dont continue doing bucle, why?

Here is my code:

 

  $product = new Product();

  $product->name = [$default_lang=>$description];
  $product->link_rewrite = [$default_lang=>$description];
  $product->price = $precio1;
  $product->quantity = 50;//puesto al azar
    $product->visibility = 'none';
    $product->available_for_order = 1; //true
    $product->description="$description";
    $product->description_short="$description";
    $product->show_price = 1;
  $product->id_category = [3,4];
  $product->id_category_default = 3;
  StockAvailable::setQuantity((int)$product->id, 0, $product->quantity, Context::getContext()->shop->id);
  $product->save();

Greetings and thanks you 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...