Jump to content

Tell me how to create the right product with the pictures?


RussinBDA
 Share

Recommended Posts

Hello!

Tell me how to create the right product with the pictures?

 

The goods I create something like this:

 

$object = new Product();

$object->price = 22;

$object->id_tax_rules_group = 0;

$object->name = 'test';

$object->id_manufacturer = 0;

$object->id_supplier = 0;

$object->quantity = 1;

$object->minimal_quantity = 1;

$object->additional_shipping_cost = 0;

$object->wholesale_price = 0;

$object->ecotax = 0;

$object->width = 0;

$object->height = 0;

$object->depth = 0;

$object->weight = 0;

$object->out_of_stock = 0;

$object->active = 0;

$object->id_category_default = 18;

$object->category = 18;

$object->available_for_order = 0;

$object->show_price = 1;

$object->on_sale = 0;

$object->online_only = 1;

$object->meta_keywords = 'test';

if($object->save())

$object->add();

 

$img_files = $_FILES['files']['tmp_name'];

if (!empty($img_files)) {

foreach ($img_files as $namefile) {

$image = new Image();

$image->id_product = (int)$id;

$image->position = Image::getHighestPosition($id) + 1;

$image->cover = false;

$image->data = file_get_contents ( $namefile );

$image->add();

}

}

 

 

That's only in the /img/p/ not what is created.

Tell me what to do.

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

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