Post by jty » Fri Oct 24, 2008 8:04 pm

I see a 'model' field in admin > product
I also see a model folder in both admin and catalog but I don't see it do anything anywhere
It looks special cuz it is a mandatory field

No, I did not delete it cos Qphoria will do the rolling eyes again

EDITED - I see it showing in the cart. Is that all? Anywhere else?
Last edited by jty on Fri Oct 24, 2008 8:24 pm, edited 1 time in total.

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by Qphoria » Fri Oct 24, 2008 9:30 pm

Yea, it should really be shown on the product page, along with weight and qty in stock (But all those options should be enabled/disabled from the admin). So it is planned for the next version of OC after 0.7.9 final

To preempt your next questions.
Q. What does the "model" folder do?
A. Nothing yet, its just a placeholder for the proper MVC framework. It is used in 1.x. But no, I don't recommend deleting it.

Q. How much wood does a wood chuck, chuck?
A. All the wood he can chuck until he up-chucks.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by hm2k » Wed Dec 03, 2008 8:49 pm

I was looking at this again today.

It seems in our case the model layer is actually merged into the controller level.

Anywhere that information is manipulated should be part of the "model" layer, and controller should be used purely for handling events.

Due to the current structure it seems to me as if the "library" is being used as the "model" layer.

MVC in web development is a big topic just lately, here's some URLs:

http://toys.lerdorf.com/archives/38-The ... ework.html
http://www.pointy-stick.com/blog/2008/1 ... aitjacket/
http://advogato.org/article/993.html
http://tech.slashdot.org/article.pl?sid ... %2F1938204

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by JNeuhoff » Wed Dec 03, 2008 9:39 pm

The model would normally be used for the object-oriented layer for accessing the database, rather than querying the database directly from the controller. At the moment, there is no Object Relational Mapping used for the MySQL in OpenCart's model.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by hm2k » Wed Dec 03, 2008 10:38 pm

Well there kind of is, that's what "library/database/database.php" is used for.

You'll also see that "model" is the handling of data into information, which is essentially what most of the library classes do.

ORM isn't part of the MVC construct, but it would be part of the database model.

Better use of the "model" construct and true MVC would be better, but it would mean big structure changes.

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by Qphoria » Thu Dec 11, 2008 9:56 pm

One downfall of the model implementation, or at least the way I saw it used in 1.x for reports,  is that it adds another layer of what seems to be hardcoding.

In 0.x, to add a new report for the admin, the new files can be completely self-contained. The proper way to make a contrib

In 1.x, the model folder had additional references of a special case for each of the core reports in the report.php file, which means you would need to edit that core file to add the special case for your new report, thus breaking the rule of keeping files as self-contained as possible. I wasn't thrilled with it for sure.

I'm no expert on MVC, so I'm not sure if that was just a not-so-good way of implementation, or if that is how it really is. If that is how it was meant to be, then i think I'm happy with just VC & library

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 2 guests