Post by keiron1992 » Sun Feb 02, 2014 4:44 am

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
Last edited by keiron1992 on Sun Feb 02, 2014 9:41 am, edited 1 time in total.

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

User avatar
Active Member

Posts

Joined
Sun May 22, 2011 12:54 pm

Post by keiron1992 » Sun Feb 02, 2014 6:06 am

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?

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by nvedia » Sun Feb 02, 2014 6:17 am

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

Donate here to show support if you think I have helped you today!

Opencart Documentation


User avatar
Active Member

Posts

Joined
Sun May 22, 2011 12:54 pm

Post by keiron1992 » Sun Feb 02, 2014 6:17 am

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?

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by keiron1992 » Sun Feb 02, 2014 6:22 am

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

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by keiron1992 » Sun Feb 02, 2014 7:15 am

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.

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by keiron1992 » Sun Feb 02, 2014 9:38 pm

Bump

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by keiron1992 » Mon Feb 03, 2014 6:02 am

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 :D

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by JAY6390 » Wed Apr 09, 2014 4:51 am

nvedia wrote:Peter here has written more about it here, worth a read
http://stackoverflow.com/questions/1347 ... ncart-guru
Who the heck is Peter? I wrote that! :D Did you get this sorted Keiron?

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 120 guests