Post by slgen32 » Wed Aug 10, 2011 2:38 am

Hi there,

I'm making some modifications to opencart for a client. Part of this involves changing the cart and checkout output. I've noticed that the cart contents and totals are generated in catalog/controller/checkout/cart.php and twice in catalog/controller/checkout/confirm.php. It's essentially slightly different versions of the same code in three different places. I was wondering what the rational for doing it this way is, rather than calling a common cartContentsCompose() (or whatever) function.

Thanks

User avatar
Newbie

Posts

Joined
Fri Jul 29, 2011 11:25 pm

Post by Ampeter » Sun Aug 14, 2011 10:23 pm

There's code repetition everywhere. As far as I know it's a design decision... it seems Daniel (the author) wants to keep the cart completely separate from the framework, while some people [citation needed :D] think the current situation is a bit excessive and a compromise should be found between separation and convenience.

I dare say you could reduce opencart code size by more than half if you got rid of some of all that redundant code.

User avatar
New member

Posts

Joined
Thu Jan 13, 2011 5:01 pm

Post by SXGuy » Sun Aug 14, 2011 10:57 pm

its obvious to see reasons behind it.


Products calculate tax seperately to the cart, 1 reason, you may want to charge tax but not display it on products.

Keeping them seperate makes it easier to remove one from the other without re writing the whole thing.

Thats just one example.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by drivenbyweb » Thu Aug 25, 2011 5:27 am

That does not mean anything. Its easy enough to pass a parameter and say when tax == true do something. I love opencart and my 9-5 job is currently making heavy customizations to it for the company I work for. However there is tons of unnecessary redundant code for reasons I don't know. There are no real instantiated objects. Everything is treated as it is static. There are no abstract classes or OO design patterns. Sometimes it runs very expensive queries. For example with categories it runs a seperate query for the category and one for each product and gets back lots of unnecessary information.

Its not perfect. I'm grateful for the developers giving their time to develop this for free. I just think these are some areas where it needs work.

Newbie

Posts

Joined
Mon Jul 25, 2011 3:25 am

Post by Xsecrets » Thu Aug 25, 2011 6:28 am

drivenbyweb wrote:There are no abstract classes or OO design patterns.
If Daniel happens across this thread I can sense an OO programming lecture coming on. :choke:

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US
Who is online

Users browsing this forum: No registered users and 6 guests