Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

DiamondSea

[contribution] Simple Template System (sts)

Recommended Posts

Thanks Bill for those hints I'll be looking at your references and get back to you in a day or so. I have looked at all the required code and still can't seem to figure out why it won't pop the image. But, I'll go back and read the manual again and sts_blank_template.html and compaire it to what is going on with my template. Oh, yes if I go back to and turn off sts it will pop. I really think that it has something to do with the XHTML not serving up the javascript correctly.

 

 

 

Getting back to you. If I turn on debug I can see where sts loads the script but for reasons beyond me it just won't pop. Looks like this in debug

 

 

 

<script language="javascript"><!--

document.write('<a href="java script:popupWindow(\'http://www.rcxjets.com/catalog/popup_image.php?pID=28\')"><img src="images/f106catalog.gif" border="0" alt="Foamie F-106" title=" Foamie F-106 " width="100" height="80" hspace="5" vspace="5"><br>Click to enlarge</a>');

//--></script>

<noscript>

<a href="http://www.rcxjets.com/catalog/images/f106catalog.gif" target="_blank"><img src="images/f106catalog.gif" border="0" alt="Foamie F-106" title=" Foamie F-106 " width="100" height="80" hspace="5" vspace="5"><br>Click to enlarge</a>

</noscript>

 

 

I just can't seem to find the offending area of the code that will not let this pop. If I turn off sts then it works just fine. The anchor in the bottom line has the information to write the popup however this is where I get lost. Feeling helpless here!

Share this post


Link to post
Share on other sites

Bill, Great News! I think I solved the problem :D .

 

 

 

I looked all over the net and found a function that would eleminate the javascript popup that good old XHTML refused to prase. Anyway here is the code for anyone that has this problem with XHTML in there product_info.php pages.

 

 

 

First you have to delete the javascript code at the top of the file. Look for these lines of code

 

 

 

<script language="javascript"><!--

 

function popupWindow(url) {

 

window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res

izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le

ft=150')

 

}

 

//--></script>

 

 

 

and replace it with this function

 

 

 

var newWindow = null;

 

function closeWin(){

if (newWindow != null){

if(!newWindow.closed)

newWindow.close();

}

}

 

function popUpWin(url, type, strWidth, strHeight){

 

closeWin();

 

if (type == "fullScreen"){

strWidth = screen.availWidth - 10;

strHeight = screen.availHeight - 160;

}

 

var tools="";

if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";

if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";

newWindow = window.open(url, 'newWin', tools);

newWindow.focus();

}

 

 

Next, look for this line of code

 

 

<script language="javascript"><!--

 

document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

 

//--></script>

 

<noscript>

 

 

 

Replace it with this line

 

 

<a href="http://www.yoursite.com/catalog/popup_image.php?

 

$product_info

 

" target="popUpWin" onclick="popUpWin(this.href,'standard',400,600);return false;"></a>

 

 

 

This eleminates the problem javascript call that XHTML will not allow by replaceing it with a function call and html thus allowing the popup to ah! POP!

 

 

Hope this makes since. As I'm not a php, js, or XHTML programmer. Note I haven't yet ported this to my regular page but it can be seen at

 

 

http://www.rcxjets.com/catalogold/product_...?products_id=28

 

 

 

Hope this may help someone else that is having this problem.

 

 

Guy

 

Share this post


Link to post
Share on other sites

Well looks like I was wrong on this one guys so don't use the above code it is not correct - Guy

 

 

 

Bill, Great News! I think I solved the problem :D .

 

 

 

I looked all over the net and found a function that would eleminate the javascript popup that good old XHTML refused to prase. Anyway here is the code for anyone that has this problem with XHTML in there product_info.php pages.

 

 

 

First you have to delete the javascript code at the top of the file. Look for these lines of code

 

 

 

<script language="javascript"><!--

 

function popupWindow(url) {

 

window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res

izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le

ft=150')

 

}

 

//--></script>

 

 

 

and replace it with this function

 

 

 

var newWindow = null;

 

function closeWin(){

if (newWindow != null){

if(!newWindow.closed)

newWindow.close();

}

}

 

function popUpWin(url, type, strWidth, strHeight){

 

closeWin();

 

if (type == "fullScreen"){

strWidth = screen.availWidth - 10;

strHeight = screen.availHeight - 160;

}

 

var tools="";

if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";

if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";

newWindow = window.open(url, 'newWin', tools);

newWindow.focus();

}

 

 

Next, look for this line of code

 

 

<script language="javascript"><!--

 

document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

 

//--></script>

 

<noscript>

 

 

 

Replace it with this line

 

 

<a href="http://www.yoursite.com/catalog/popup_image.php?

 

$product_info

 

" target="popUpWin" onclick="popUpWin(this.href,'standard',400,600);return false;"></a>

 

 

 

This eleminates the problem javascript call that XHTML will not allow by replaceing it with a function call and html thus allowing the popup to ah! POP!

 

 

Hope this makes since. As I'm not a php, js, or XHTML programmer. Note I haven't yet ported this to my regular page but it can be seen at

 

 

http://www.rcxjets.com/catalogold/product_...?products_id=28

 

 

 

Hope this may help someone else that is having this problem.

 

 

Guy

 

Edited by starcad

Share this post


Link to post
Share on other sites

Hi All,

 

Firstly, STS is AWESOME, and thankyou to all that developed and supported it.

 

I have a small issue that i cannot seem to sort out.

 

I have changed the size/colour of the breadcrumbs in the header for the index pages, but when i go to a product listing, it reverts back to the original size. Same for search results.

 

Is there somewhere that this can be globally changed by default? I have looked, but cannot find.

 

Many thanks in advance.

 

Rob


Rob Bell - Inspired Graphix

Customising osCommerce in Australia, and the world!

View my profile for web and email links.

 

I'm sorry, but i cannot offer Free support via PM etc, and osCommerce forums prohibit me from putting any reference to paid support in my signauture.

However viewing my profile may provide links to my website or something like that which you may find useful.

Share this post


Link to post
Share on other sites
Guest

By default, the breadcrumbs use the "headerNavigation" style, so you have to change this style in your stylesheet.css to see a difference.

 

If you want to use another style, you'll find the breadcrumbs creation in the file catalog/includes/classes/breadcrumb.php

 

- Rigadin

Share this post


Link to post
Share on other sites

I am sorry if this has been answered before, I couldn't wade through all 158 pages to find an answer...

 

I have enabled Product Info in the STS modules area. However if I add tags like: $productname, nothing shows up on my template. I don't understand, there are very poor instructions regarding this stage in the readme. What extra step do I need to take to get my ProductInfo section working on my index template?

 

To see what I mean go here: http://www.herbalsecure.com/

 

Thanks!

Share this post


Link to post
Share on other sites
Guest

Product info tags are made for product_info.php page and are not processed on other pages.

 

If you have only 1 product in your store and want to display it on index.php, you'll need to make some changes in STS, like a mix between the index and the product_info STS modules (find them in includes/modules/sts).

 

- Rigadin

Share this post


Link to post
Share on other sites
Well looks like I was wrong on this one guys so don't use the above code it is not correct - Guy

 

Any resolution to the Pop-ups not appearing when stsis enabled?

Share this post


Link to post
Share on other sites
Any resolution to the Pop-ups not appearing when stsis enabled?
The pop-ups work fine. You just need to adjust your template so that it looks in the default javascript folder of osc.

 

I have provided the proper code for this to work in the "sts_blank_template.html" in the "test" template folder but here it is again for those who may be searching this thread:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html $htmlparams>
<head>
<meta http-equiv="Content-Language" content="en-us">
<!--$headcontent-->
 <link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<p>This is a blank template. Replace this text with your content. Enjoy! 
Template by: Bill Kellum</p>
</body>
</html>

 

You need the <html $htmlparams> and the <!--$headcontent--> along with your stylesheet link to make any custom templates work for your osCommerce shop. With the code above, you can literally use any HTML page a osCommerce template along with the added placeholders that you want to include.

 

Hope this has helped,

 

Bill Kellum


Bill Kellum

 

Sounds Good Productions

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

Share this post


Link to post
Share on other sites
Product info tags are made for product_info.php page and are not processed on other pages.

 

If you have only 1 product in your store and want to display it on index.php, you'll need to make some changes in STS, like a mix between the index and the product_info STS modules (find them in includes/modules/sts).

 

- Rigadin

I am sorry, I am not very tech saavy. I don't understand how I can mix the templates. Do you have an example of a mixed file? What do I call the file? Or do I replace the index template with it?

 

Thanks... sorry for the annoyance.

Share this post


Link to post
Share on other sites

Hi everybody: :P

Please come here to help me ,I need your help,thanks a lot!

I want modify the $content in the index.php page,And the $categorybox just like:Take a Look

What files should I need to Modify,If you know, Please tell me ! thank you very much!

Share this post


Link to post
Share on other sites
for some reason my template wont show the $content

check what i mean here.... http://motorgym.com/storests/

 

also, what is the code for the login box?

 

none of the pages will display any information :blink:

 

 

 

Just by chance you may want to check your image folder and make sure it is chmod 777 as properties show that the image is there just not being written to the file.

Share this post


Link to post
Share on other sites

no, it has nothing to do with the images folder.

i didnt say i had a problem with displaying images...

 

im having trouble displaying the $content item.

i have tried to merge STS+infobox into my php-multishop install. cant seem to get it quite right yet.

 

guess i will have to try the merge again....dont think anyone will realy know what the problem is, as its probably in my merge somewhere. <_<

Share this post


Link to post
Share on other sites
no, it has nothing to do with the images folder.

i didnt say i had a problem with displaying images...

 

im having trouble displaying the $content item.

i have tried to merge STS+infobox into my php-multishop install. cant seem to get it quite right yet.

 

guess i will have to try the merge again....dont think anyone will realy know what the problem is, as its probably in my merge somewhere. <_<

Check to make sure you have the following in your index.php file:

 

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

 

This is the line of code that the STS variable $content pulls from to populate your content area.

Hope this was able to get you going in the right direction.

Edited by bkellum

Bill Kellum

 

Sounds Good Productions

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

Share this post


Link to post
Share on other sites

cheers, i did another merge and it came out better htis time. 6th time lucky i guess ;)

 

the only other problem i have encountered is with my admin page...

it seems to have changed the headings in the menu...

 

BOX_HEADING_ADMINISTRATOR

BOX_ADMINISTRATOR_MEMBERS

BOX_ADMINISTRATOR_BOXES

Configuration

Catalog

Modules

Customers

Locations / Taxes

Localization

Reports

Tools

 

as u can see it has changed the titles of admin and the subsequent menu's. do you know where this might have occured during the merge? thanks heaps.

Share this post


Link to post
Share on other sites
cheers, i did another merge and it came out better htis time. 6th time lucky i guess ;)

 

the only other problem i have encountered is with my admin page...

it seems to have changed the headings in the menu...

 

BOX_HEADING_ADMINISTRATOR

BOX_ADMINISTRATOR_MEMBERS

BOX_ADMINISTRATOR_BOXES

Configuration

Catalog

Modules

Customers

Locations / Taxes

Localization

Reports

Tools

 

as u can see it has changed the titles of admin and the subsequent menu's. do you know where this might have occured during the merge? thanks heaps.

Appears to be an FTP problem. You are not getting all of the data uploaded to your server...looks like you will have to try again. :'(

Bill Kellum

 

Sounds Good Productions

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

Share this post


Link to post
Share on other sites

your a genius! i would never have thought.... i just uploaded a few files again and she's all apples.

thanks a bunch.

Share this post


Link to post
Share on other sites
So no one can help me with an index/product hybrid template?
Brad, give us a more detailed post regarding what you are trying to do and what you have tried so far. I'm sure it has been done before by some STS user out there.

 

:thumbsup:


Bill Kellum

 

Sounds Good Productions

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

Share this post


Link to post
Share on other sites

Hello

 

Good contribution!

 

I installed it in version "osCommerce 2.2 Milestone 2 Update 051113" and work well but installing in new version "osCommerce 2.2 Milestone 2 Update 060817" not active the template, when I edit option "Use Templates?" and set to true it change to false,

I do this:

 

Admin >> Modules >> STS >> Default template (v1.0.4) : click on Install button

then I edit this option and change to true in "Use Templates?", I click Update button to save changes but appear in false that option "Use Templates?", I cant change it, but with version Update 051113 yes.

 

I supposed that is for any changes in code with "osCommerce 2.2 Milestone 2 Update 060817" that affect the correct funtion of this contribution

 

I try manual install and in a clean install osCommerce, and with files files of folder clean_osc.

Share this post


Link to post
Share on other sites
Hello

 

Good contribution!

 

I installed it in version "osCommerce 2.2 Milestone 2 Update 051113" and work well but installing in new version "osCommerce 2.2 Milestone 2 Update 060817" not active the template, when I edit option "Use Templates?" and set to true it change to false,

I do this:

 

Admin >> Modules >> STS >> Default template (v1.0.4) : click on Install button

then I edit this option and change to true in "Use Templates?", I click Update button to save changes but appear in false that option "Use Templates?", I cant change it, but with version Update 051113 yes.

 

I supposed that is for any changes in code with "osCommerce 2.2 Milestone 2 Update 060817" that affect the correct funtion of this contribution

 

I try manual install and in a clean install osCommerce, and with files files of folder clean_osc.

STS 4.2 does not have any issues with osc 2.2 060817. Check your installation of STS 4.2 again to be sure you have uploaded all of the files needed.

Bill Kellum

 

Sounds Good Productions

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

Share this post


Link to post
Share on other sites

Actually, there's a bug in that update that may cause this problem (anything you change won't be updated in the modules), which's been reported. You may want to try Steve Ratcliffe/sterat's suggestion:

 

In the file compatibility.php, add 'reset($ar)' to the end of the do_magic_quotes_gpc function, like this:

 

function do_magic_quotes_gpc(&$ar) {

if (!is_array($ar)) return false;

while (list($key, $value) = each($ar)) {

if (is_array($ar[$key])) {

do_magic_quotes_gpc($ar[$key]);

} else {

$ar[$key] = addslashes($value);

}

}

reset($ar);

}

The bold face code is the added line.

 

Good Luck!

 

Ken

...but installing in new version "osCommerce 2.2 Milestone 2 Update 060817" not active the template, when I edit option "Use Templates?" and set to true it change to false,

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Share this post


Link to post
Share on other sites

Thanks! I go to try that

 

 

Actually, there's a bug in that update that may cause this problem (anything you change won't be updated in the modules), which's been reported. You may want to try Steve Ratcliffe/sterat's suggestion:

 

In the file compatibility.php, add 'reset($ar)' to the end of the do_magic_quotes_gpc function, like this:

 

function do_magic_quotes_gpc(&$ar) {

if (!is_array($ar)) return false;

while (list($key, $value) = each($ar)) {

if (is_array($ar[$key])) {

do_magic_quotes_gpc($ar[$key]);

} else {

$ar[$key] = addslashes($value);

}

}

reset($ar);

}

The bold face code is the added line.

 

Good Luck!

 

Ken

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×