Post by Qphoria » Wed Feb 17, 2010 10:43 pm

I touched on this in my earlier discussion on options improvement. But it also affects most other pages as well.

For example, the product page doesn't return fields like "sku" or "location" or quantity if stock is 0. But the model returns all that info to the controller. My proposal is to remove the secondary restructuring of data and pass the full returned data through to the view as an array (i.e. $product_data['xxxx']). Using the controller only to format data for things like price and currency, but as additional fields. So if the model returns "price" as "10.00" and the store currency formats the price to "$12.65" then that should be a new field like 'formatted_price'. This way both values are available.

This would then allow people to quickly add new fields to their product pages and show them on the catalog side with a simple tpl reference.

The same with products on the category & manufacturer pages. This would make things extremely easy for people who want to quickly add additional elements like:
- Being able to list description, model, add to cart, etc on the category & manufacturer pages by simply adding the html to the tpl file
- Add new fields to product pages by simply referencing the table in the html on tpl files
- etc

if you add a new field in the db called "upc_code" and want to show it on the catalog side. You don't have to edit the controller at all. Just add <?php echo $product_data['upc_code']; ?>. The model always returns "Select * From XXX"

This would make life a lot easier for everybody, especially the main developer as all fields would always be there without having to add additional code for each.

For now, this can be easily modded into the existing cart following this mod:


Donate!|OpenCart Basics|GeoZones

User avatar


Tue Jul 22, 2008 3:02 am

Post by Miguelito » Thu Feb 18, 2010 2:28 pm

Q, this sounds very cool (two thumbs up).

What is Daniel's (and others) opinion?

The Finnish OpenCart Forum
"Real programmers don't document. If it was hard to write, it should be hard to understand."

Active Member


Sun Jan 10, 2010 10:11 pm

Post by Sheldmandu » Sun Feb 28, 2010 1:43 am

Yeah, what's been suggested is a pretty good idea and wouldn't take much in terms of changes. To be honest you can quite easily do it now if you need it by assigning original data pulled from the model into a subarray.

New member


Sat Feb 27, 2010 10:43 am
Who is online

Users browsing this forum: No registered users and 5 guests