Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

osCommerce W3C Validation


googlejunky

Recommended Posts

osCommerce W3C Validation

 

A few things to fix to make osCommerce Validate

Some are mistakes that should be fixed in osCommerce and some are just nitpicky things

 

 

 

BODY TAG

--------------------

The Body tag in osCommerce is redundant since the CSS file does this already

Not needed

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

Should be <body> only

 

And add this to the BODY in the CSS

padding : 0;

 

 

DOCTYPE

------------------

It isn't really hurting anything but should be in the correct case anyway

 

All files with

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

 

Should be

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

 

 

IMAGE BORDER

-------------------

Image border="0" can't be used

Wrong --> <img src="images/thisimage.gif" border="0" alt="">

 

Has to be in the css file

img
{
border: 0;
}

 

Location to change it:

includes/functions/htmloutput.php

2 places to take out border="0"

 

 

LET OTHERS SEE YOU VALIDATE

Adding HTML and CSS validation images to the site(if you want that sort of thing)

Adding the HTML validation link is simple because W3C offers referrer code.

The CSS link for W3C takes a little more help though.

 

Adding the CSS validation link to your site:

 

Add to /includes/functions/html_output.php file just before the last ?>

// Get current page url for W3C validation

function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
 $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
 $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}

 

 

Then add this to the /includes/footer.php for the CSS Validation link

<?php echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri=' . curPageURL() . '"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>'; ?>

 

 

 

 

If you have anything else then feel free to add your thoughts. I'm sure this has been talked about before at sometime.

 

 

Good luck in all you do,

Google Junky

Link to comment
Share on other sites

Thankyou Googlejunkie for the idiots guide to osCommerce W3C Validation.

 

There are certainly a lot of files to edit, but is ok on the localhost on my PC, now for the website.

Link to comment
Share on other sites

In case you are not aware of it, there is a contribution that goes over some of the code changes necessary for validation. I don't know how useful it is but it is there. I think it is named html validation, or something like that.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

In case you are not aware of it, there is a contribution that goes over some of the code changes necessary for validation. I don't know how useful it is but it is there. I think it is named html validation, or something like that.

 

Jack

Thanks Jack, will check it out.

Link to comment
Share on other sites

The code for the footer causes a secure/insecure warning when going to ssl. Any thoughts?

Try This:

 

<?php
if ( $HTTPS !='on')  {
?>
<?php echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri=' . curPageURL() . '"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>'; ?>
<?php
}
?>

Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Link to comment
Share on other sites

Try This:

 

<?php
if ( $HTTPS !='on')  {
?>
<?php echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri=' . curPageURL() . '"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>'; ?>
<?php
}
?>

Thanks GLcustoms, that worked. I put it in a table to centre it, like:

 

 

<?php

if ( $HTTPS !='on') {

?>

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

<tr>

<td align="center" class="smallText"><?php echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri=' . curPageURL() . '"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>'; ?></td>

</tr>

</table>

<?php

}

?>

 

Now, to apply the rest of the changes to the site.

Link to comment
Share on other sites

In case you are not aware of it, there is a contribution that goes over some of the code changes necessary for validation. I don't know how useful it is but it is there. I think it is named html validation, or something like that.

Do you mean Easy validate osC HTML? It is (mainly) about making sure the & in the url's are changed to & in the links (if you don't use SEO url's) which makes the validator stop complaining about it.

Link to comment
Share on other sites

Do you mean Easy validate osC HTML? It is (mainly) about making sure the & in the url's are changed to & in the links (if you don't use SEO url's) which makes the validator stop complaining about it.
That looks like the one I was thinking about. The description of it says, "Use this if you like to use http://validator.w3.org/ to check your HTML." which indicates it would be for the purpose discussed here. But I've never downloaded it so it may just be as you mention.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I have the INDEX.PHP validated for WC3, and now working through PRODUCT_INFO.PHP, but not sure how to fix the following from the WC3 validator ???:

 

Validation Output: 5 Errors

 

Line 182, Column 131: cannot generate system identifier for general entity "action".

…m.au/product_info.php?products_id=27&action=add_product" method="post"><table✉

An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (;). The most common cause of this error is unencoded ampersands in URLs as described by the WDG in "Ampersands in URLs".

 

Entity references start with an ampersand (&) and end with a semicolon (;). If you want to use a literal ampersand in your document you must encode it as "&" (even inside URLs!). Be careful to end entity references with a semicolon or your entity reference may get interpreted in connection with the following text. Also keep in mind that named entity references are case-sensitive; &Aelig; and æ are different characters.

 

If this error appears in some markup generated by PHP's session handling code, this article has explanations and solutions to your problem.

 

Note that in most documents, errors related to entity references will trigger up to 5 separate messages from the Validator. Usually these will all disappear when the original problem is fixed.

 

Line 182, Column 131: general entity "action" not defined and no default entity.

…m.au/product_info.php?products_id=27&action=add_product" method="post"><table✉

This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text. See the previous message for further details.

 

Line 182, Column 137: reference to entity "action" for which no system identifier could be generated.

…roduct_info.php?products_id=27&action=add_product" method="post"><table borde✉

This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text. See the previous message for further details.

 

Line 182, Column 130: entity was defined here.

…om.au/product_info.php?products_id=27&action=add_product" method="post"><tabl

 

Line 200, Column 303: end tag for element "A" which is not open.

…5" vspace="5"><br>Click to enlarge</a>');✉

The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

 

If this error occurred in a script section of your document, you should probably read this FAQ entry.

 

Line 214, Column 137: cannot generate system identifier for general entity "goto".

…meras.com.au/redirect.php?action=url&goto=www.pandi.hp.com%2Fpandi-db%2Fprodi✉

An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (;). The most common cause of this error is unencoded ampersands in URLs as described by the WDG in "Ampersands in URLs".

 

Entity references start with an ampersand (&) and end with a semicolon (;). If you want to use a literal ampersand in your document you must encode it as "&" (even inside URLs!). Be careful to end entity references with a semicolon or your entity reference may get interpreted in connection with the following text. Also keep in mind that named entity references are case-sensitive; &Aelig; and æ are different characters.

 

If this error appears in some markup generated by PHP's session handling code, this article has explanations and solutions to your problem.

 

Note that in most documents, errors related to entity references will trigger up to 5 separate messages from the Validator. Usually these will all disappear when the original problem is fixed.

 

Line 214, Column 137: general entity "goto" not defined and no default entity.

…meras.com.au/redirect.php?action=url&goto=www.pandi.hp.com%2Fpandi-db%2Fprodi✉

This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text. See the previous message for further details.

 

Line 214, Column 141: reference to entity "goto" for which no system identifier could be generated.

…s.com.au/redirect.php?action=url&goto=www.pandi.hp.com%2Fpandi-db%2Fprodinfo.✉

This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text. See the previous message for further details.

 

Line 214, Column 136: entity was defined here.

…ameras.com.au/redirect.php?action=url&goto=www.pandi.hp.com%2Fpandi-db%2Fprod

Link to comment
Share on other sites

I have the INDEX.PHP validated for WC3, and now working through PRODUCT_INFO.PHP, but not sure how to fix the following from the WC3 validator ???:

 

 

 

The & sign needs to be changed to &


it would end up being 
domain.au/product_info.php?products_id=27&action=add_product" method="post">

 

Find this block of code in /includes/functions/general.php around line 154

It is for the tep_get_all_get_params function

 

 

function tep_get_all_get_params($exclude_array = '') {
global $HTTP_GET_VARS;

if (!is_array($exclude_array)) $exclude_array = array();

$get_url = '';
if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) {
  reset($HTTP_GET_VARS);
  while (list($key, $value) = each($HTTP_GET_VARS)) {
	if ( (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) {
	  $get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&';

The last line here that says
$get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&';

Change the & to &

Let me know if it works for you. I wasn't able to test it, but it looked to be the solution.

Link to comment
Share on other sites

The & sign needs to be changed to &
it would end up being 
domain.au/product_info.php?products_id=27&action=add_product" method="post">

 

Find this block of code in /includes/functions/general.php around line 154

It is for the tep_get_all_get_params function

function tep_get_all_get_params($exclude_array = '') {
global $HTTP_GET_VARS;

if (!is_array($exclude_array)) $exclude_array = array();

$get_url = '';
if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) {
  reset($HTTP_GET_VARS);
  while (list($key, $value) = each($HTTP_GET_VARS)) {
	if ( (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) {
	  $get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&';

The last line here that says
$get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&';

Change the & to &

Let me know if it works for you. I wasn't able to test it, but it looked to be the solution.

 

Thanks GoogleJunky!

 

I still have 3 more errors in PRODUCT_INFO.PHP

 

 

Validation Output: 3 Errors

 

Line 200, Column 303: end tag for element "A" which is not open.

…5" vspace="5"><br>Click to enlarge</a>');✉ The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

 

If this error occurred in a script section of your document, you should probably read this FAQ entry.

 

Line 214, Column 137: cannot generate system identifier for general entity "goto".

…meras.com.au/redirect.php?action=url&goto=www.pandi.hp.com%2Fpandi-db%2Fprodi✉

An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (;). The most common cause of this error is unencoded ampersands in URLs as described by the WDG in "Ampersands in URLs".

 

Entity references start with an ampersand (&) and end with a semicolon (;). If you want to use a literal ampersand in your document you must encode it as "&" (even inside URLs!). Be careful to end entity references with a semicolon or your entity reference may get interpreted in connection with the following text. Also keep in mind that named entity references are case-sensitive; &Aelig; and æ are different characters.

 

If this error appears in some markup generated by PHP's session handling code, this article has explanations and solutions to your problem.

 

Note that in most documents, errors related to entity references will trigger up to 5 separate messages from the Validator. Usually these will all disappear when the original problem is fixed.

 

Line 214, Column 137: general entity "goto" not defined and no default entity.

…meras.com.au/redirect.php?action=url&goto=www.pandi.hp.com%2Fpandi-db%2Fprodi✉ This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text. See the previous message for further details.

 

Line 214, Column 141: reference to entity "goto" for which no system identifier could be generated.

…s.com.au/redirect.php?action=url&goto=www.pandi.hp.com%2Fpandi-db%2Fprodinfo.✉

This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text. See the previous message for further details.

 

Line 214, Column 136: entity was defined here.

…ameras.com.au/redirect.php?action=url&goto=www.pandi.hp.com%2Fpandi-db%2Fprod

Link to comment
Share on other sites

Line 200, Column 303: end tag for element "A" which is not open.

…5" vspace="5"><br>Click to enlarge</a>');✉

in product_info.php find

<script language="javascript" type="text/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>

change to:

<script language="javascript" type="text/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>

 

Line 214, Column 137: cannot generate system identifier for general entity "goto".

…meras.com.au/redirect.php?action=url&goto=www.pandi.hp.com%2Fpandi-db%2Fprodi

in includes/functions/banner.php find:

	  $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>';

change to:

	  $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>';

 

then try revalidating

 

Tom

Link to comment
Share on other sites

There is a WRAP issue on the CONTACT_US.PHP page

 

Validation Output: 1 Error

 

Line 209, Column 50: there is no attribute "WRAP".

… <td><textarea name="enquiry" wrap="soft" cols="50" rows="15"></textarea></✉ You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

 

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

 

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

Link to comment
Share on other sites

Not sure if this has been covered, but one small validation problem I was having was with the OTF Autothumb contribution.

Basically the & needed to be &

 

In includes > functions > html_output.php find this line:

 

$image = '<img src="product_thumb.php?img=' . $src . '&w=' .

tep_output_string($width) . '&h=' . tep_output_string($height) . '"';

 

and replace it with:

 

$image = '<img src="product_thumb.php?img=' . $src . '&w=' .

tep_output_string($width) . '&h=' . tep_output_string($height) . '"';

SolarFrenzy

Solar powered gadgets at down to earth prices.

 

CheekyNaughty

Promoting British Design

Link to comment
Share on other sites

There is a WRAP issue on the CONTACT_US.PHP page

 

I don't see any real use in it.

I have taken the WRAP portion out of mine.

 

You can read about it here and make your own decision

http://www.htmlcodetutorial.com/forms/_TEXTAREA_WRAP.html

 

 

 

includes/functions/html_output.php

At about line 189
function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {

Replace with this line
function tep_draw_textarea_field($name, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {

 

 

2 lines after that you will see

$field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

Replace with 
$field = '<textarea name="' . tep_output_string($name) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

 

 

 

/checkout_payment.php

At about line 330
this line of code
<td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?></td>

Replace with 
<td><?php echo tep_draw_textarea_field('comments', '60', '5', $comments); ?></td>

 

 

 

/checkout_shipping.php

At about line 385 you will see
<td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>

Replace with 
<td><?php echo tep_draw_textarea_field('comments', '60', '5'); ?></td>

 

 

/contact_us.php

At about line 114
<td><?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15); ?></td>

Replace with
<td><?php echo tep_draw_textarea_field('enquiry', 50, 15); ?></td>

 

 

/product_reviews_write.php

At about line 164
<td class="main"><?php echo tep_draw_textarea_field('review', 'soft', 60, 15); ?></td>

Replace with
<td class="main"><?php echo tep_draw_textarea_field('review', 60, 15); ?></td>

 

 

/tell_a_friend.php

At about line 199
<td><?php echo tep_draw_textarea_field('message', 'soft', 40, 8); ?></td>

Replace with
<td><?php echo tep_draw_textarea_field('message', 40, 8); ?></td>

Link to comment
Share on other sites

  • 4 weeks later...

i have this big error when trying to validate..i tried using all the doctypes but nothing..w3c can't find my doctype

 

DOCTYPE Override in effect!

The detected DOCTYPE Declaration "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">" has been suppressed and the DOCTYPE for "HTML 4.01 Transitional" inserted instead, but even if no errors are shown below the document will not be Valid until you update it to reflect this new DOCTYPE.

 

and a lot of additional errors

Link to comment
Share on other sites

i have this big error when trying to validate..i tried using all the doctypes but nothing..w3c can't find my doctype

 

DOCTYPE Override in effect!

The detected DOCTYPE Declaration "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">" has been suppressed and the DOCTYPE for "HTML 4.01 Transitional" inserted instead, but even if no errors are shown below the document will not be Valid until you update it to reflect this new DOCTYPE.

 

and a lot of additional errors

 

 

 

Do you mind showing your sites url in the forum so I can take a look?

Link to comment
Share on other sites

Do you mind showing your sites url in the forum so I can take a look?

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.onlinetemplates.org%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

 

thank you

Link to comment
Share on other sites

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.onlinetemplates.org%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

 

thank you

 

 

You may want to find why the first 3 lines are coming up as the following

 

<br />
<b>Warning</b>: extract(): First argument should be an array in <b>/home/content/l/u/x/luxurystore/html/templates/includes/application_top.php</b> on line <b>223</b><br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

 

I think that is where the problem is. The validator shows these lines when using the option "Show Source"

Link to comment
Share on other sites

You may want to find why the first 3 lines are coming up as the following

 

<br />
<b>Warning</b>: extract(): First argument should be an array in <b>/home/content/l/u/x/luxurystore/html/templates/includes/application_top.php</b> on line <b>223</b><br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

 

I think that is where the problem is. The validator shows these lines when using the option "Show Source"

yes i see that too..but when i look at the source code i don't see that. this is line 223 from application.top:

extract($_SESSION, EXTR_SKIP);

 

i've got seo urls and the register globals module...very strange

Link to comment
Share on other sites

  • 4 months later...

I'm trying to sort out all my errors, and there's a few I can't do:

 

Line 374, Column 245: cannot generate system identifier for general entity "eu"

 

…und Sterling</option><option value="&eu">Euro</option><option value="USD">US

 

Does anyone know how to solve this one?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...