Jump to content

save product to database


alex32
 Share

Recommended Posts

Hi

I've seen few post on this topic , is there anyone who knows which tables are involved when we import a product through CSV ?
What I need is to save a product directly into MySQL through php script.
All relevant data about it must be saved directly into MySQL tables including the URL of the images...

anybody disclosing such internals of PShop will be much appreciated

Share this post


Link to post
Share on other sites

well for starters, image urls are not stored in the database at all..

it will depend on how your product is structured, ie. do you use combinations? do your products need to be categorised? how complex is your category structure?

products must be added atleast into the home category otherwise they wont show up at all.

product information also finds its way into the search index tables and tags tables.

also, because of how the db is structured you will cant simply add records.. you will have to have a lot of look up queries to find tag/category/combination/image id's and appropriately insert them into multiple tables. To get your images to work they need to be processed and saved as $image_id-$product_id-$size.jpg then you'll have to add the right records to the db so that the front end can find them.

it is a seriously long road i would imagine.. and you can just look at how the prestashop back end does it, the queries are hidden within functions within functions and those functions are defined in files that were included by an initial config file.. and the command is written like ' require $class-var . ".php"; ' so you dont necessarily even know where to start looking.


..now that i've shot down all your hopes and dreams, consider that php can easily automate the production of a product csv.. and since the prestashop import functions can be access by a URL, and its an html form.. CURL can automate this.. or if your more daring, the script that controls that aspect of the backend can be altered so that everything is automated.

i have a thread on how to do some aspects of this, here.
http://www.prestashop.com/forums/viewthread/80611/development/automated_store_update

good luck.

Share this post


Link to post
Share on other sites

Hi siaadmin

thanks for the reply I did see your post but no code is there, could you pls provide it to me as a test drive ?
I'm developing a clean interface just to upload a new product and see all products belonging to each user logged in PShop and maybe your code could be useful there...

many thanks

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