Page 1 of 1
Learn how to develop in Opencart
Posted: Sun Feb 02, 2014 4:44 am
by keiron1992
So I've finally got round to mastering HTML + CSS and my PHP is developing.
I've learnt how to create my own forms, scripts and how to save the data in a DB.
Now I'm looking to start developing within OC.
So I've been looking at the OC and the it's files/code. I've learnt how to create my own custom page so now I can run PHP within my own custom page.
I'm starting to understand the MVC+L structure that OC uses and I'm venturing out into storing and pulling info from the DB.
I've created a table within my DB. Now I want to learn how to query the DB and insert data to it within OC but I have no idea how to do this. I don't understand how to do it using the MVC stucture and I don't know how to get the DB login using OC's variables. If you guys could help me learn I would be extremely grateful.
Thanks,
Keiron
Re: Learn how to develop in Opencart
Posted: Sun Feb 02, 2014 5:55 am
by nvedia
Re: Learn how to develop in Opencart
Posted: Sun Feb 02, 2014 6:06 am
by keiron1992
Yes but the model file is not used. I want to enter my own SQL to query and insert data. How do I query the DB using the model and if I create a form how do I insert the data to the DB?
I can do this on its own entering all the DB login details etc but how can I do this within my custom tpl,model and controller?
Re: Learn how to develop in Opencart
Posted: Sun Feb 02, 2014 6:17 am
by nvedia
You can use $db to query and run the sql and then use the result
Peter here has written more about it here, worth a read
http://stackoverflow.com/questions/1347 ... ncart-guru
If you want to edit existing files, you can also do it using vqmod
Let me hit a PM to you with my skype and I can help you with one flow on how things work
Re: Learn how to develop in Opencart
Posted: Sun Feb 02, 2014 6:17 am
by keiron1992
I've followed this tutorial so far:
http://forum.opencart.com/viewtopic.php?t=59542
So now I want to allow customers to submit a comment
I've created a form in the TPL file but what do I put as the action? Normally I would point to another PHP file with DB login (host, db, user, password) etc then grab the POST and save these as variables and insert them to the DB but how do I do this within OC?
Re: Learn how to develop in Opencart
Posted: Sun Feb 02, 2014 6:22 am
by keiron1992
nvedia wrote:Let me hit a PM to you with my Skype and I can help you with one flow on how things work
If you can go through this with me on Skype I'd be happy to send some cash your way for the help.
I'll have a read through that now but let me know if you would be willing to give me some training and I'll compensate you for your time.
Thanks,
Keiron
Re: Learn how to develop in Opencart
Posted: Sun Feb 02, 2014 7:15 am
by keiron1992
Yeah I'm really going to need your help. It's a useful doc but I need help inserting data to the DB. Please add me, my username is live:keiron1992 or
keiron1992@hotmail.com I'm online now.
Re: Learn how to develop in Opencart
Posted: Sun Feb 02, 2014 9:38 pm
by keiron1992
Bump
Re: Learn how to develop in Opencart
Posted: Mon Feb 03, 2014 6:02 am
by keiron1992
nvedia has been really helpful so far
If I ever manage to figure this out I will write up a nice tutorial for the beginners here

Re: Learn how to develop in Opencart
Posted: Wed Apr 09, 2014 4:51 am
by JAY6390
Who the heck is Peter? I wrote that!

Did you get this sorted Keiron?