Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Basic Template Structure v1.0 - For MS2


Brenden

Recommended Posts

I will be supporting Basic Template Structure (BTS) ver1.0 in this thread:

Please post any questions.

Please review the install documentation before reporting bugs.

 

Basic Template Structure Ver1.0

Contribution Author: Brenden Vickery

Contribution Author Email: [email protected]

 

If you like this contribution please donate to the osCommerce core team at  

http://www.oscommerce.com/about/team .

 

 

Basic Overview:

 

This contribution will only work with a base install of osCommerce 2.2 MS2.  It will not work with snapshots newer or older.

 

This contribution creates a basic template structure for osCommerce 2.2 MS2 which makes customizing your sites design easier.This contribution does not give the option to use different themes.

 

Also included in this version is a meta tags optimizer.  This optimizer can be customized to your needs or can be left as is.  The file used for this is includes/meta_tags.php and is plug-and-play on install.

 

 

 

Installation Instructions:

Install osCommerce 2.2 MS2 on your web server.

 

Create the following directories:

 - catalog/includes/javascript

 - catalog/templates

 - catalog/templates/content

 

Open catalog/includes/configure.php

 

Add the following lines of code to catalog/includes/configure.php

 

 define('DIR_WS_TEMPLATES', 'templates/');

 define('DIR_WS_CONTENT', DIR_WS_TEMPLATES . 'content/');

 define('DIR_WS_JAVASCRIPT', DIR_WS_INCLUDES . 'javascript/');

 

Note: Code must be added anywhere after this line of code(usually line 22):

 define('DIR_WS_INCLUDES', 'includes/');

 

Unzip Basic Template Structure v1.0

 

The file structure of the zip file will mirror that of your osCommerce 2.2 MS2 install.

 

Copy files into their corresponding directories overwriting when nessisary.

 

 

 

Use of this contribution:

You can now change the site wide look of your store by modifying catalog/templates/main_page.tpl.php.

 

To change the look of the info boxes used in your store edit boxes.tpl.php.

 

 

 

Example of creating a new template for the information info Box:

 

Open catalog/includes/boxes/information.php

Change line 24 "require(DIR_WS_TEMPLATES . TEMPLATENAME_BOX);"

to "require(DIR_WS_TEMPLATES . TEMPLATENAME_NEW_BOX);"

Save and Exit catalog/includes/boxes/information.php

 

Open catalog/includes/filesnames.php

Add the following line:

define('TEMPLATENAME_NEW_BOX', 'new_box.tpl.php');

Save and Exit catalog/includes/filesnames.php

 

Open catalog/templates/box.tpl.php

Save catalog/templates/box.tpl.php as new_box.tpl.php

Customize the info box to your requirements by changing the HTML and PHP.

Save and Exit.

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

  • Replies 217
  • Created
  • Last Reply

Top Posters In This Topic

Warning: main(DIR_WS_TEMPLATESMAIN_PAGE) [function.main]: failed to create stream: No such file or directory in /home/thecastl/public_html/oscommerce/catalog/index.php on line 150

 

Fatal error: main() [function.main]: Failed opening required 'DIR_WS_TEMPLATESMAIN_PAGE' (include_path='') in /home/thecastl/public_html/oscommerce/catalog/index.php on line 150

followed instructions to the letter on new test install and i get this, any ideas?

Link to comment
Share on other sites

Hi Albert,

 

Double check that you installed all the files. Pay special attention to:

catalog/index.php

catalog/templates/main_page.tpl.php

catalog/templates/content/index_default.tpl.php

catalog/includes/filenames.php

 

And double check that you have added the following lines to catalog/includes/configure.php

 

define('DIR_WS_TEMPLATES', 'templates/');

define('DIR_WS_CONTENT', DIR_WS_TEMPLATES . 'content/');

define('DIR_WS_JAVASCRIPT', DIR_WS_INCLUDES . 'javascript/');

 

Note: Code must be added anywhere after this line of code(usually line 22):

define('DIR_WS_INCLUDES', 'includes/');

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

well i followed the instructions, and yes all those files are there and accounted for, i double checked that, i will play with it and see if i find something unusual here, but it should work, nice clean install of ms2 with no hacks or add ons

 

Al

Link to comment
Share on other sites

Try taking the original catalog/includes/filenames.php file from the BTSv1.zip file and overwriting the one you currently have.

 

If that doesnt work can you provide a url?

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

Warning: main(DIR_WS_TEMPLATESmain_page.tpl.php)

 

The part where it says DIR_WS_TEMPLATES means that its not recognising the directory name.

 

There is a problem with when you added these lines to configure.php

define('DIR_WS_TEMPLATES', 'templates/');

define('DIR_WS_CONTENT', DIR_WS_TEMPLATES . 'content/');

define('DIR_WS_JAVASCRIPT', DIR_WS_INCLUDES . 'javascript/');

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

Glad that's fixed Albert. Enjoy.

 

Bug Report:

catalog/includes/boxes/tell_a_friend.php

Add this line immidiately after line 21:

$boxContent .= '</form>'

 

Not having the form close causes problems with any form after the tell a friend info box. (Usually languages and currencies infobox forms.)

 

I will be updating the current release to reflect any bug fixes after more time passes.

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

Bug Report:

catalog/includes/boxes/tell_a_friend.php

Add this line immidiately after line 21:

 $boxContent .= '</form>'

That should read:

  $boxContent .= '</form>';

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

2 Bug reports, fix for one of them

 

 

Bug 1

On the checkout pages the NAVBAR_TITLE isn't being set properly so the text NAVBAR_TITLE is literally showing up in the page.

 

I'm still familarizing myself with the code so not sure what's wrong here. I do know that that language file for this page defines two variables, NAVBAR_TITLE_1 and NAVBAR_TITLE_2. Not sure of the logic with sets NAVBAR_TITLE.

 

 

Bug 2 + fix

there is a missing definition in:

/includes/filenames.php

 

checkout process wasn't being defined so I couldn't finish my test order. The following code needs to be added and it then it will work fine.

 

  define('CONTENT_CHECKOUT_PROCESS', 'checkout_process');

 

and

 

  define('FILENAME_CHECKOUT_PROCESS', CONTENT_CHECKOUT_PROCESS . '.php');

 

I just followed the standard in the file and put each line in it's logical place.

 

Brenden I just did a fresh install on my local machine just so I could test this mod since I'm very interested in it. If you need me to do any specific testing let me know. I'll continue to look for bugs.

Link to comment
Share on other sites

Brenden I thought of one addition that would be super useful moving forward. How difficult would it be to create a new folder in the /templates/ directory which would house all of the current files there now? Call it /templates/default/ and then set a parameter in configure.php which would define the current theme as "default". I think this would be a great addition since it would allow users to easily create new themes in the template folder. This would let people work on them, test them out by changing the setting in configure, then changing it back if they don't like it. If this was in place I would be interested in writing a small admin mod which would store this template choice in the database. I don't want to turn this into a big project especially if you aren't envisioning this, but I think at least having seperate theme named folders in the /themes/ folder would be awesome.

 

Let me know what you think.

Link to comment
Share on other sites

Hi Tim,

 

Thanks for the bug reports. Kind of embarrassing not noticing these bugs but there were alot of files touched by this contribution.

 

Im going to make a patch for all known bugs and make it availible on my own web site, then once more time passes and all bugs are worked out ill release an updated version.

 

Bug Report:

Known files which the meta tag optimizor is not working for:

create_account_success.php

checkout_shipping.php

checkout_payment.php

checkout_payment_address.php

checkout_confirmation.php

checkout_success.php

 

Brenden I thought of one addition that would be super useful moving forward. How difficult would it be to create a new folder in the /templates/ directory which would house all of the current files there now?

 

This shouldnt be difficult to do.

 

Create directory catalog/templates/default/

Create directory catalog/templates/default/content/

Create directory catalog/templates/test/

Create directory catalog/templates/test/content/

 

Copy/Paste all files in catalog/templates/ to catalog/templates/default/

Cut/Paste all files in catalog/templates/ to catalog/templates/test/

 

Copy/Paste all files in catalog/templates/content/ to catalog/templates/default/content/

Cut/Paste all files in catalog/templates/content/ to catalog/templates/test/content/

 

Open catalog/includes/configure.php

Change define('DIR_WS_TEMPLATES', 'templates/');

to define('DIR_WS_TEMPLATES', 'templates/default/');

 

Customize files in catalog/templates/test/

 

To test files in catalog/templates/test/

 

Open catalog/includes/configure.php

Change define('DIR_WS_TEMPLATES', 'templates/default/');

to define('DIR_WS_TEMPLATES', 'templates/test/');

 

This works in theory not practice :) (Untested)

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

No need to be embarrassed about bugs. Coming up with a template system mod for oscommerce is no small task. The only way to make sure it works properly and bugs are found is to just release it and let people test it.

 

Thanks for the info on the theme folder idea. I should have figured that out myself instead of taking up your time to explain it. I just wanted to make sure it wasn't a big task. I'm going to test the idea out to see how it works. One issue I do see is the stylesheet. It doesn't look like you are putting that in the template folder. Do you think this is something that should be moved into the template folder anyway? Also if this theme folder structure I've proposed works is it something you would consider adding to the core mod?

Link to comment
Share on other sites

Patches for BTS ver1.0 can be found here http://www.w3design.ca/files/

 

One issue I do see is the stylesheet. It doesn't look like you are putting that in the template folder. Do you think this is something that should be moved into the template folder anyway? Also if this theme folder structure I've proposed works is it something you would consider adding to the core mod?

Hey Tim,

If you want the stylesheet to change with the theme

 

Open catalog/templates/main_page.tpl.php

Change line 10 from <link rel="stylesheet" type="text/css" href="stylesheet.css">

to <link rel="stylesheet" type="text/css" href="<?php echo DIR_WS_TEMPLATES; ?>stylesheet.css">

 

Cut/Paste catalog/stylesheet.css

to where DIR_WS_TEMPLATES is defined to be in catalog/includes/configure.php

 

I would consider including something like this in the mod, however simplicity is one of the objectives of this contribution. With a couple minutes work this can be achieved for those who want it.

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

I completely understand how your aim is simplicity. I only bring up including these ideas because I'm pretty sure people will be interested in having them and I'd hate to make a mod of a mod for it. This is of course your baby and I'm just throwing ideas out there that I think enhance it. Anyway...

 

2 more minor bugs with easy fixes:

 

account_edit.php

line 123 was:

  $javascript = 'formcheck.js.php';

should be:

  $javascript = 'form_check.js.php';

 

 

account_password.php

line 68 was:

  $javascript = 'formcheck.js.php';

should be:

  $javascript = 'form_check.js.php';

 

 

This was breaking these files since the javascript was coming up missing.

Link to comment
Share on other sites

Tim,

 

Thanks for all the help searching out bugs. I have more things planned for this contribution and I will be working on it in the future.

 

Keep in mind that this is a template structure, not a template system. Once the template structure is completed the way I envision it(not far off) I may start work on using this in a template system.

 

The problem is that it is not part of the oscommerce code and keeping something like that up to date is very time consuming.

 

That said, I have no problem with anyone taking this code and making mods for it or upgrading it or doing anything they like with it. This is open source and released under GPL remember.

 

Thanks again for the testing tim :D .

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

bug report :)

 

from the 7/13 tep commits:

 

products_new.tpl.php - Line 53

 

<td colsp?an="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

 

should read:

 

<td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

 

Thanks for the hard work Brenden, its a great contrib!

Link to comment
Share on other sites

Fatal error: Call to undefined function: tep_output_warning() in /usr/www/html/catalog/templates/warnings.tpl.php on line 23

 

this was thrown up because my configure.php was writable...

 

g.

Link to comment
Share on other sites

Chad,

 

Thanks for the bug report :) .

 

Fatal error: Call to undefined function: tep_output_warning() in /usr/www/html/catalog/templates/warnings.tpl.php on line 23

this was thrown up because my configure.php was writable...

g.

 

Hi gilesw,

 

You are using an old version of the template structure. I would recommend downloading the new version here which says "07/16/2003 - BTSv1.zip. This is the updated version that works with osC 2.2 MS2.

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

any demo i can see soemone, before i install this , I won't know if this is the right contrib for me unless i reallly se a demo

 

Hi David,

 

There is no demo for this because the demo would look exactly the same as the osCommerce 2.2 MS2 demo.

 

This contribution does not change the default look of the store in any way. Basic Template Structure (BTS) is designed to speed the development when changing the look of your store.

 

Site wide changes can be made by editing one file, catalog/templates/main_page.tpl.php. You can take this a step further if you desire by editing catalog/templates/box.tpl.php. Editing this file will change the look of all info boxes in your store.

 

Furthermore, seperate templates can be made of main_page.tpl.php so that certain pages in your store can have 3 columns, others can have 2 columns and others can have a single column. By making more box templates(box.tpl.php) each individual box can have its own look and feel.

 

For an example of how to make a new box template see the install documentation.

Perdure - Transparent Object Relational Persistence
Link to comment
Share on other sites

Great work, i really think your on to a winner here!

 

I shall deffo be using this patch on my store, it aint 100% what i wished for but hey! it will speed up the development of the site 10 Fold!

 

Nice work!

Link to comment
Share on other sites

Hey Brenden,

 

I am having trouble figuring out how to duplicate this random bug from happening.

 

Heres what happens: The installation of the structure + bug updates was flawless but every so often when I click on a product or a link.. the footer gets thrown off center and ends up on the left side.

 

This happens randomly when I click on a product in the "What's New" Info Box on column_left

 

Now, I can't get it to happen for every product.. like I said its weird.. but for some reason, everytime the Hewlet Packard Printer comes up in the Whats New product box, and I click it.. it will throw the footer off and mess up the styles of the "Powered By.." and "Copyright" text.

 

Any Ideas?

 

Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...