Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

osCommerce should use a templating system


uramagget

Recommended Posts

I have not used osCommerce for long, but I find the system quite inconsistent in the area of templating. There are a number of reasons why osCommerce should use a templating system.

 

The foremost reason being that it makes the process of users setting up a base layout much faster, since they do not have to hunt around the entire source to change the way the output for X feature should look. This would also make templating and distribution so much easier than it is now. Application logic and template logic would then be separated, which again sets apart designers and programmers and it makes upgrading less of a hassle. The most user-friendly and flexible system I can think of is SUIT: suitframework.com.

 

Factoring in that the source is messy enough as is, I am not a fan of DB API calls being made in the same place where a table tag is created. These things require a fair enough level of abstraction. If it is being done for languages, there is no reason why not for templates as well. All in all, there doesn't seem to be any disadvantage toward using one.

 

Please discuss.

Link to comment
Share on other sites

  • Replies 130
  • Created
  • Last Reply

Forgive me, although I'm not sure if I understand why a STS would be necessary if there are other systems that accomplish this but in a more proven true and elegant way. It seems like all of the work put into STS would have been better directed towards generally cleaning OSC's source code and addressing other important issues.

Link to comment
Share on other sites

Arnold,

 

The development team did not create STS, it was created for use by other users as with most of the other contributions. The development team is......let's say.....not very efficient when it comes to keeping up with the times so it is generally others who provide contributions and support.

 

 

Chris

 

ps. Jan, looks like a definite commercial interest.

Link to comment
Share on other sites

Forgive me, although I'm not sure if I understand why a STS would be necessary if there are other systems that accomplish this but in a more proven true and elegant way. It seems like all of the work put into STS would have been better directed towards generally cleaning OSC's source code and addressing other important issues.

I wouldn't know because I have never used the STS contribution myself. However the first uploads of the STS contribution are from 2003. The framework you linked to has a copyright 2008-2010.... osC 2 is pretty old.

Link to comment
Share on other sites

Arnold,

 

The development team did not create STS, it was created for use by other users as with most of the other contributions. The development team is......let's say.....not very efficient when it comes to keeping up with the times so it is generally others who provide contributions and support.

 

 

Chris

 

ps. Jan, looks like a definite commercial interest.

 

That may be true, however it is being included by default in OSC, so it can be equally said that the community should prioritize the importance of a templating system. Granted, STS does not seem to fulfill much; a quick look through the actual templates files:

 

<?php DEFINE ('STS_END_CHAR', '$'); ?>

<?php DEFINE ('STS_CONTENT_END_CHAR', '$'); ?>

 

This should not be there. I do not think it would be a bad idea at all to invest time in having SUIT support built-in to OSC. If it is dependent on a contribution, I have no issue in modifying the core files to make use of the framework.

 

I wouldn't know because I have never used the STS contribution myself. However the first uploads of the STS contribution are from 2003. The framework you linked to has a copyright 2008-2010.... osC 2 is pretty old.

 

I'm assuming that by referring to the year, you are debating the maturity of both. As far as maturity goes, "age is not an accomplishment and youth is not a sin." - SUIT is years of research. It is very stable, suitable for production use, and has the attributes of a true templating system (in my opinion.) I use it on at least three of my own websites.

Link to comment
Share on other sites

'm assuming that by referring to the year, you are debating the maturity of both.

What I mean is that you cannot blame an open source project for not using a system that was developed seven+ years later.

Link to comment
Share on other sites

What I mean is that you cannot blame an open source project for not using a system that was developed seven+ years later.

 

If that is the case, then now that you know of it, I do not see why not. Based on the clean syntax and the flexibility of the rules system it uses, these could be adapted to "suit" ( ;) ) OSC. I don't particularly see why not.

 

By the way, to DunWeb, I find it rude that you assume that I am doing this for my own gain ("commercial interest") when I hold no affiliation with any of the people involved with the project. I find it more appropriate to cite a specific system rather than vaguely recommend using a template system, because not all of them are particularly good. Not everyone who recommends specific software is doing it for their own gain; I am not a drone promoting shamelessly. I am genuinely interested in the quality of the software I use, and the components of it are no exception.

Link to comment
Share on other sites

By the way, to DunWeb, I find it rude that you assume that I am doing this for my own gain ("commercial interest")

Chris alluded to the reason why I edited your first post. First posts immediately linking to external websites are highly suspicious in my experience. Lots of spam gets deleted every day from this forum...

 

Of course it is not always spam, only 98% or so of the cases :D

Link to comment
Share on other sites

Chris alluded to the reason why I edited your first post. First posts immediately linking to external websites are highly suspicious in my experience. Lots of spam gets deleted every day from this forum...

 

Of course it is not always spam, only 98% or so of the cases :D

 

My case is definitely a part of the 2% minority, then, considering what has gone down as of now.

Link to comment
Share on other sites

There are dozens upon dozens of conversations on these forums on the use of template systems, for/against, whether or not the dev team should use templating systems, the current state of templating in osC v3, STS vs BTS, STS vs nothing, etc. There is a lot of material that you can use to get further educated on this topic. It'll be faster than re-hashing it. :)

 

-jared

Link to comment
Share on other sites

There are dozens upon dozens of conversations on these forums on the use of template systems, for/against, whether or not the dev team should use templating systems, the current state of templating in osC v3, STS vs BTS, STS vs nothing, etc. There is a lot of material that you can use to get further educated on this topic. It'll be faster than re-hashing it. :)

 

-jared

 

It seems more to me like the development team has been ignoring this because they believe that over-simplifying these issues with watered down libraries is the best of ideas. You're right; I should stop re-hashing these conversations and in comparison to the others that have attempted, but failed to get them to use a real templating system, actually get the conversion done. <_<

Link to comment
Share on other sites

There is nothing to stop you from forking on github, then integrating suit (or any other templating system).

 

Once complete, come back and let us know, then we can merge the changes on our own github forks if we feel your changes are good.

 

Easy as 123. I look forward to seeing it, in fact, I'd be happy to help in my spare time.

Link to comment
Share on other sites

There is nothing to stop you from forking on github, then integrating suit (or any other templating system).

 

Once complete, come back and let us know, then we can merge the changes on our own github forks if we feel your changes are good.

 

Easy as 123. I look forward to seeing it, in fact, I'd be happy to help in my spare time.

 

I will do that, seeing as I've found the github repository for OSC v3. Although I'm a bit doubtful that you would just help a random stranger with a fork. ;)

 

You like templates. You have many choices for that. It is very shallow to think we all like template systems.

 

Irrelevant; this is not a question of liking them, because that does not change the fact that a good web app. separates its concerns, templates being no exception to this. It is not shallow to be considerate of the people that do not want to sort through spaghetti code and markup just to change a few elements of the catalog. You've been here for six years and this sounds like someone who has no idea of how web apps. should be structured.

Link to comment
Share on other sites

Irrelevant; this is not a question of liking them, because that does not change the fact that a good web app. separates its concerns, templates being no exception to this. It is not shallow to be considerate of the people that do not want to sort through spaghetti code and markup just to change a few elements of the catalog. You've been here for six years and this sounds like someone who has no idea of how web apps. should be structured.

 

I apologize if I've misread the tone of your post, but you've been here for less than 6 months and apparently haven't read any of the hordes of similar email threads started other folk who are equally well-intentioned but also equally underinformed about the history of the project. You make good points, but they are points that have been made many times before. Have you looked at v3?

 

In many ways, you're preachin' to the choir. Spend some time searching the forums on this topic. Look at the project release history and timeline. Look at the coding style and structure of other projects that were released around the same time as the 2.2 code base was initially released. Look at the comments that have been made by the actual development team (present and past) on this subject. You'll understand more after that.

 

One of the beauties of FOSS is that you can put your own resources behind it, forking it if you want, to make the project any way you like. In the meantime, you're not going to endear yourself to potentially helpful community members by complaining. If you don't like osC, don't use it. You didn't pay for it either in $$ or in community forum assistance (judging solely on your account history).

 

We're not the devs, but we know the project. If you have an actual question, feel free to ask and we'll help how/where we can. If you just want to complain, please take your complaints elsewhere.

 

Enjoy!

 

-jared

Link to comment
Share on other sites

I apologize if I've misread the tone of your post, but you've been here for less than 6 months and apparently haven't read any of the hordes of similar email threads started other folk who are equally well-intentioned but also equally underinformed about the history of the project. You make good points, but they are points that have been made many times before. Have you looked at v3?

 

In many ways, you're preachin' to the choir. Spend some time searching the forums on this topic. Look at the project release history and timeline. Look at the coding style and structure of other projects that were released around the same time as the 2.2 code base was initially released. Look at the comments that have been made by the actual development team (present and past) on this subject. You'll understand more after that.

 

One of the beauties of FOSS is that you can put your own resources behind it, forking it if you want, to make the project any way you like. In the meantime, you're not going to endear yourself to potentially helpful community members by complaining. If you don't like osC, don't use it. You didn't pay for it either in $$ or in community forum assistance (judging solely on your account history).

 

We're not the devs, but we know the project. If you have an actual question, feel free to ask and we'll help how/where we can. If you just want to complain, please take your complaints elsewhere.

 

Enjoy!

 

-jared

 

Allow me to clarify; this is not a complaint topic. This is a discussion topic, as I had clearly pointed out in my first post. As I have stated to the posters that you have missed in your displacement with me, I have seen the topics, and I cannot see how they make my words have any less merit. I have seen STS implemented in v3 through the latest revision, and I find the actual STS system unsuitable for what the needs of an e-commerce application are. Hence, I volunteered to fork it and implement a more SUITable alternative, to which a veteran responded may be included if they like the changes. Thus, I would not be complaining; I would be solving. Seen in this light, your conclusion of my intentions is based on a misunderstanding.

 

As such, I apologize if my original post came off as exceedingly rude.

Link to comment
Share on other sites

I'm looking forward to seeing the fork! If it takes you less than a few years, then it will be faster than the current development cycle. :)

 

-jared

Link to comment
Share on other sites

Surely oscommerce with a template system would end up like zencart. Then you would have two different products using exactly the same code.Os commerce is not that hard to alter, so why is a template system needed. I say personnally reduce the code, make it easier. if version 3 is ever finished it may be worth a look, but so far there are tooo few contributions to make it worth while using.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

Surely oscommerce with a template system would end up like zencart. Then you would have two different products using exactly the same code.Os commerce is not that hard to alter, so why is a template system needed. I say personnally reduce the code, make it easier. if version 3 is ever finished it may be worth a look, but so far there are tooo few contributions to make it worth while using.

 

From my experience with Zencart, it is very sub par in contrast to OSC. Your point in 'two different products using exact same code' is also rather fallacious, as having a templating system does not necessarily make you "exactly the same as other software." Plus, Zencart uses Smarty, which is not even comparable. I concede the point that OSC is not very hard to alter, but that is only true if you are used to reading your application logic mangle with your markup, which can get really nasty and confusing when it reaches the size of OSC, because you just may end up accidentally breaking your application altogether when all you were trying to do was move x component to y place. OSCv3 seems to be a step in the right direction, so I will attempt to work with what's there to get this conversion done. :D

Link to comment
Share on other sites

That may be true, however it is being included by default in OSC, so it can be equally said that the community should prioritize the importance of a templating system. Granted, STS does not seem to fulfill much; a quick look through the actual templates files:

 

<?php DEFINE ('STS_END_CHAR', '$'); ?><?php DEFINE ('STS_CONTENT_END_CHAR', '$'); ?>

This should not be there. I do not think it would be a bad idea at all to invest time in having SUIT support built-in to OSC. If it is dependent on a contribution, I have no issue in modifying the core files to make use of the framework.

 

 

Why shouldn't that be in there? These are simple defines that make the variables work in each of the template pages. STS allows users who KNOW PHP to insert PHP code directly into the template page to add functionallity. You don't have to use it if you don't want to. Otherwise, design your layout using HTML, Flash, Ajax, JavaScript, etc.

 

I don't think you actually gave STSv4.6 with osC RC2a a look at all but rather commenting on something you haven't reviewed in depth. This makes any comments you made relating to STS shallow and unfounded. Install it, learn to use it and then provide your review.

 

STS is NOT implemented in osCv3.

 

The stable version of osCommerce is osC RC2a, which should be used for live shops. This is the version that STSv4.6 was designed for.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Also, SUIT does basically the same thing that STSv4.6 ALREADY does for osCommerce. It uses variables to bring in the dynamic functionallity of osCommerce. ALL of the variables are defined in separate PHP files just like SUIT claims to do.

 

Been there, done that.

 

thumbsup.gif Give STSv4.6 a try and then come back and speak your mind.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

The next alpha version will be very different from what you can download now. Here is Harald's github repository if you would like to compare differences so far.

 

Yes. That was the same github repository I downloaded earlier, hence my comment on OSCv3 having significantly improved in the cleanliness department (plus for using namespaces.) Out of curiosity, why was a a home brew Database API used for the current OSCv3 when a solution such as ADOdb, which is cross-compatible with other relational database systems such as MySQL, SQLite, PostgreSQL and even Oracle?

 

Why shouldn't that be in there? These are simple defines that make the variables work in each of the template pages. STS allows users who KNOW PHP to insert PHP code directly into the template page to add functionallity. You don't have to use it if you don't want to. Otherwise, design your layout using HTML, Flash, Ajax, JavaScript, etc.

 

Those variables should be defined outside of the template, not inside. If you allow code to be executed in your template, then that is a security risk, because if an attacker gains access to your templates somehow, it would all be a matter of inserting some arbitrary code in the end that compromises you. SUIT doesn't allow direct code execution in templates of course, making it much more secure in this respect. If you want to add functionality to your templates in SUIT, you can either make a rule for it, which is explained in the documentation, or you can use the [call /] and [transform /] rules for the templating module to call a function.

 

I don't think you actually gave STSv4.6 with osC RC2a a look at all but rather commenting on something you haven't reviewed in depth. This makes any comments you made relating to STS shallow and unfounded. Install it' date=' learn to use it and then provide your review[/b'].

 

STS is NOT implemented in osCv3.

 

The stable version of osCommerce is osC RC2a, which should be used for live shops. This is the version that STSv4.6 was designed for.

 

Also, SUIT does basically the same thing that STSv4.6 ALREADY does for osCommerce. It uses variables to bring in the dynamic functionallity of osCommerce. ALL of the variables are defined in separate PHP files just like SUIT claims to do.

 

Been there, done that.

 

thumbsup.gif Give STSv4.6 a try and then come back and speak your mind.

 

Oh, silly me; you are correct; OSCv3 does not use STS. Upon further lookup, it uses nothing particularly close to templating, which makes it all the more of a justification for SUIT to replace the current homebrew solution. I have seen the source for STS and have seen examples of it in action; it's not a templating system in the strictest sense of the term. Templating is not about simply replacing some tokens with variables. While we are discussing OSCv3 (I don't feel like discussing OSCv2, considering it will be surpassed by OSCv3 which looks insurmountably better than OSCv2,) allow me to pitch in some food for thought with the current table_based.php template in v3's repo. Compare that to the below version formatted with SUIT:

 

[trim]
[comment]
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2007 osCommerce

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License v2 (1991)
 as published by the Free Software Foundation.
[/comment]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="[var]language.textDirection[/var]" xml:lang="[var]language.code[/var]" lang="[var]language.code[/var]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=[var]language.characterset[/var]" />
<title>[var]config.STORE_NAME[/var][if condition='pageTitle'][var]pageTitle[/var][/if]</title>
<base href="[url conn='AUTO' add_sid='false' /]" />
<link rel="stylesheet" type="text/css" href="templates/[var]template.code[/var]/stylesheet.css" />

[if condition='pageTags']
   [var]pageTags[/var]
[/if]

[if condition='javascript']
   [var]javascript[/var]
[/if]
<meta name="Generator" content="osCommerce" />
</head>
<body>

[if condition='template.pageHeader']
<table border="0" width="100%" cellspacing="0" cellpadding="2" id="pageHeader">
 <tr>
   <td id="headerLogo">
       <a href="[url page='[var]config.FILENAME_DEFAULT[/var]' /]" id="siteLogo">[image src='[var]config.DIR_WS_IMAGES[/var]store_logo.jpg' title='[var]config.STORE_NAME[/var]' /]</a>
   </td>
   <td id="headerIcons" align="right">
       <a href="[url page='[var]config.FILENAME_ACCOUNT[/var]' conn='SSL' /]">[image src='[var]config.DIR_WS_IMAGES[/var]header_account.gif' title='[var]language.my_account[/var]' /]</a>  
       <a href="[url page='[var]config.FILENAME_CHECKOUT[/var]' conn='SSL' /]">[image src='[var]config.DIR_WS_IMAGES[/var]header_cart.gif' title='[var]language.cart_contents[/var]' /]</a>  
       <a href="[url page='[var]config.FILENAME_CHECKOUT[/var]' params='shipping' conn='SSL' /]">[image src='[var]config.DIR_WS_IMAGES[/var]header_checkout.gif' title='[var]language.checkout[/var]' /]</a>
   </td>
 </tr>
 <tr id="headerBar">
   <td id="breadcrumb">
   [if condition='breadcrumb']
       [var entities='false']breadcrumb[/var]
   [/if]
   </td>
   <td align="right">
   [if condition='customer.loggedOn']
     <a href="[url page='[var]FILENAME_ACCOUNT[/var]' params='logoff' conn='SSL' /]" class="headerNavigation">[var]language.sign_out[/var]</a> | 
   [/if]

   <a href="[url page='[var]config.FILENAME_ACCOUNT[/var]' conn='SSL' /]" class="headerNavigation">[image src='[var]config.DIR_WS_IMAGES[/var]header_account.gif' title='[var]language.my_account[/var]' /]</a>  
   <a href="[url page='[var]config.FILENAME_CHECKOUT[/var]' conn='SSL' /]" class="headerNavigation">[image src='[var]config.DIR_WS_IMAGES[/var]header_cart.gif' title='[var]language.cart_contents[/var]' /]</a>  
   <a href="[url page='[var]config.FILENAME_CHECKOUT[/var]' params='shipping' conn='SSL' /]" class="headerNavigation">[image src='[var]config.DIR_WS_IMAGES[/var]header_checkout.gif' title='[var]language.checkout[/var]' /]</a>
   </td>
 </tr>
</table>

<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>

[if condition='left_content']
   <td id="pageColumnLeft" valign="top">
     <div class="boxGroup">
       [var entities='false']left_content[/var]
     </div>
   </td>
[/if]

   <td id="pageContent" valign="top">
       [if condition='stack_header']
           [var]stack_header[/var]
       [/if]

       [var entities='false']content_before[/var]
       [var entities='false']content[/var]
       [var entities='false']content_after[/var]
   </td>

[if condition='content_right']
   <td id="pageColumnRight" valign="top">
     <div class="boxGroup">
       [var entities='false']content_right[/var]
     </div>
   </td>
[/if]
 </tr>
</table>

[if condition='template.pageFooter']
   <table border="0" width="100%" cellspacing="0" cellspacing="2">
     <tr id="footerBar">
       <td>
           [var]datetime_long[/var]
       </td>
     </tr>
     <tr>
       <td>
           <p align="center">[execute][var entities='false']language.footer[/var][/execute]</p>
       </td>
     </tr>
   </table>
   [if condition='osc_banner']
       <p align="center">[var entities='false']oss_banner[/var]</p>
   [/if]
[/if]
</body>
</html>
[/trim]

 

108 lines of a much more simplified, friendly on the eyes and less intimidating to users base template. Now it is valid to say that it is truly easy to customize osCommerce whether you are a coder or not; no flexibility is lost in the process either, so in the end it is a win-win for both parties. Therefore I see no real reason, besides the ones I have described, for any programming snippets to be in the templates in the first place. Besides the very simplistic syntax provided by Rulebox's Templating rules being notable, a lot of processing logic that does not really belong in the templates has been stripped, to preferably have them moved to a more SUITable (I like using SUIT puns if you haven't noticed ;]) location. In particular, the content and its hooks (after and before.) If you prefer the previous mess (with all due respect to the developers) then I don't know what else to tell you. Incidentally, this snippet conversion took me quite a while to write up; this is how it would look for the most part in the fork unless I change my mind on a few things. A lot of work to do; wish I had some help from the veterans here that are willing to at least make one more aspect of their software a competitive point when faced against other shopping carts. :( - "OSC has SUIT; just look at the syntax for its templates in contrast to the mess that ZenCart made with Smarty."

Link to comment
Share on other sites

Yes. That was the same github repository I downloaded earlier, hence my comment on OSCv3 having significantly improved in the cleanliness department (plus for using namespaces.) Out of curiosity, why was a a home brew Database

 

(...)

 

 

Valid points

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...