PHP Script to Import Sexshop365 into osCommerce
As I mentioned in the previous post I wanted to write a script to take the online CSV file from Sex Shop 365 and be able to import it directly into my osCommerce shops.
I’ve tested it and it works fine with my installation. You will have to modify it though as I’ve added an extra field (RRP) and modified the products_price based on this. If you’d like it, you can get the code from this page
PHP Code For Importing CSV Into osCommerce
Latest version for download as .txt file
The script should do the following:
- Extract top level categories and import into database if not already there
- Take sub categrories and import into database if not already there
- Exrtact all products and import main information into products table
- Add products name and description into products_description table
- Match products to categories
Someone might find this useful. As per usual - back everything up first! No warranty is implied or given. Do write to me if you much up your database - I enjoy a good laugh (harsh, but for your own good newbies)


Monday, September 10th 2007 at 6:37 pm
Hi there,
Thanks for sharing your script with us. I am new to all this but was wondering where do I put the actual script?
Also do I have to change any of the names in the csv file from sex shop 3 6 5
Thanks for your help
Take care
Paul
Tuesday, September 11th 2007 at 6:49 am
Hi Paul,
If you’re using the default osCommerce then you should be fine leaving the names the same as they are in the original CSV file.
I put mine in the admin directory along with the CSV file and then just load it up in your browser. Just change the values for your database connection and it’ll work fine
Andy
Tuesday, September 11th 2007 at 3:20 pm
Hi again,
Thanks again for your help, I have tried doing that but i keep getting these errors, i havnt changed any of the file apart from the database connection information and the the destination of the csv file.
Parse error: syntax error, unexpected T_STRING in /home/enj100/public_html/toys/stock.php on line 2
Thanks
Paul
Wednesday, September 12th 2007 at 8:17 am
Hi Paul,
My fault! When I put the code on the blog it changed some of the characters, that’s why you’re getting the error.
Try downloading sexshop.txt and renaming it to a .php file. That should work.
Make sure you back everything up first though cos I haven’t had chance to test this one
Cheers
Andy
Wednesday, September 12th 2007 at 8:55 am
Thanks Andy,
Just tried but got error:
Parse error: syntax error, unexpected T_STRING in /stock.php on line 113
really appreciate ur help
Thank you
Paul
Wednesday, September 12th 2007 at 9:07 am
Andy,
I have got it to work, it creates categories and the sub categories but does’nt put any products in the cats why would this happen?
I must say ur a legend for doing this
Thanks
Paul
Wednesday, September 12th 2007 at 9:41 am
also andy what should i remove from the code if i dont want the RRP that you have modified just the standard products_price.
cheers paul
Monday, September 17th 2007 at 5:08 pm
Hi Paul,
My fault again! I missed a bit of editing. This version (sexshop.txt) should work OK. I’ve also removed the RRP bit which I think was what was causing the products to not be added.
Let me know how it goes
Cheers
Andy