Simple Cart - Product Import with Pictures

By Perchpole - April 12, 2014

Hello, All -

I need to import a large range of products into simpleCart (from X-cart). I can handle the basic details via the CSV import plugin. The trouble is, how do I import the pictures?

:oS

Perchpole

By gregThomas - April 15, 2014

Hi Perch,

You'll have to write a custom import script to add the images to the section from the CSV. You could either use the php copy function to grab each image from the corresponding URL from the old x-cart site and import them to your new server using the PHP copy function:

http://www.php.net/manual/en/function.copy.php

Or you could manually upload the images you need to import to a temporary directory on your server.

Then you could use the CMS Builder saveUploadFromFilepath function to add the image to the appropriate record. It will automatically crop them and create the thumbnails:

saveUploadFromFilepath($tablename, $fieldname, $recordNum, $preSaveTempId, $filepath);

Here is a breakdown of what each variable is:

  • $tableName: the tablename the record is stored in.
  • $fieldname: the upload field the image needs to be saved to.
  • $recordNum: The record num the image needs to be saved to.
  • $preSaveTempId: leave this empty, just add an empty string.
  • $filePath:  The path to the image you want to add to the record.

If you'd like, we could create this script for you fairlyquickly. If you send an e-mail to consulting@interactivetools.com, we can give you an estimate of how long it will take.

Let me know if you have any questions!

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By gregThomas - April 15, 2014

Hi Perch,

Good to hear you've got them all imported! Writing image import scripts can be a gruelling task. 

Let me know if there is anything else we can help with.

Cheers!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Perchpole - April 15, 2014

Greg -

You could take a look at the CSV Import plugin. It isn't behaving! I always found it pretty reliable - but today it failed at almost every hurdle.

:0/

Perch