Jump to content

Script auto insert data feed, image attachmet


Recommended Posts

Hello, I´m try to make a script that import a feed of data of an API that provides product data and also let me download an image wich one is alredy stored in my server, but i dont know where should I store them, I have read in this forums about /img/p/ for products, the name of the image are the id of the product so finally the file with path is like /img/p/252.jpg, how can I tell to ps where is located my file or where and how should I locate them. I´m pretty lost, any clue is helpfull.

I have been trying this.

//adding images for the product
$image = new Image();
$image->id_product = $id_product;
$image->position = Image::getHighestPosition($id_product) + 1;
$image->cover = true; // or false;

if (($image->validateFields(false, true)) === true && ($image->validateFieldsLang(false, true)) === true && $image->add()){
$image->associateTo($shops);		
}

Thanks for your attention.

Edited by JoseLargo (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...