Jump to content

attachment, product and unique identifier


Recommended Posts

hello.
I have a product with an id = 9 and i have created a module for customize this product with custom attributes.
In pratice i have created a custom .tpl template and a controller with the logic for customize this product.
I used attributes.
Now i must attach to this product a file, a .pdf and i must manage the upload before it move the product to the cart.
I saw attachment and product attachment classes but i can't understand how it works.
The first misunderstand is that in the constructor i create the product like:

 $this->product = new ProductCore(9, false, 1);

but the id is 9 and is 9 for all my configured products!
There isn't an unique identifier that is a value for each product instance?

How i can create an attachment and add it to the product?
i see that the product_attachment table has an id_product and an id_attachment but if the id is always 9 how i can configure the single product with the attachment.
I don't understand the instance creation and how i can use an unique identifier  in prestashop that identify the instance of product and not the product in general.

a workaround (or may be the correct solution)is to place a custom attribute that is a file ?.

how?

I'm some confused.

sorry for my english.

Link to comment
Share on other sites

×
×
  • Create New...