Zen Cart Logo
Forums / General Questions / Validating Product Info Page

Validating Product Info Page

Views: 1,212

Results 1 to 15 of 15
27 Jun 2011, 11:41 AM
#1
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Validating Product Info Page

Hi,

I am trying to validate my product info page and am receiving 40 errors which I am at a loss as to fix.

The first error I receive is -

Line 575, Column 35: document type does not allow element "div" here

<div class="wrapperAttribsOptions"><table border="1" style="border: 1px solid #…

✉

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

The site address is - w w w dot c u z h y dot c o dot uk/index.php?main_page=product_info&cPath=4_41_22&products_id=41

Thanks to anyone that can help.

27 Jun 2011, 2:51 PM
#2
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Validating Product Info Page

anyone?

:hug:

27 Jun 2011, 3:15 PM
#3
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,604
Plugin Contributions:
0

Re: Validating Product Info Page

Moderators note: It has only been a few hours since your initial post - give it some time and don't bump your post.

27 Jun 2011, 4:04 PM
#4
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: Validating Product Info Page

moesoap:

Hi,

I am trying to validate my product info page and am receiving 40 errors which I am at a loss as to fix.

The first error I receive is -

Line 575, Column 35: document type does not allow element "div" here

<div class="wrapperAttribsOptions"><table border="1" style="border: 1px solid #…

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

> 
> The site address is - w w w dot c u z h y dot c o dot uk/index.php?main_page=product_info&cPath=4_41_22&products_id=41
> 
> Thanks to anyone that can help.

> **moesoap:**
>
> anyone?
> 
> :hug:

The main problem is that you are missing closing </table> and </div> throughout the layout.
27 Jun 2011, 4:45 PM
#5
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Validating Product Info Page

Kim:

Moderators note: It has only been a few hours since your initial post - give it some time and don't bump your post.

Apologies, I am anxious to finish this.

Thanks Clyde,

The tables are pulled from the module attributes php file and they all appear to be closed in there. Apart from three tables within the product info page which are closed also.

27 Jun 2011, 4:54 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Validating Product Info Page

The fundamental cause is some editing error when you (or the mod author) added the custom table code to the attributes output.

27 Jun 2011, 5:04 PM
#7
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Validating Product Info Page

gjh42:

The fundamental cause is some editing error when you (or the mod author) added the custom table code to the attributes output.

I added tables to the module below.

<?php
/**
 * Module Template
 *
 * Template used to render attribute display/input fields
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_attributes.php 3208 2006-03-19 16:48:57Z birdbrain $
 */
?>
<div id="productAttributes">
<?php if ($zv_display_select_option > 0) { ?>
<h3 id="attribsOptionsText"><?php echo TEXT_PRODUCT_OPTIONS; ?></h3>
<?php } // show please select unless all are readonly ?>

<?php
    for($i=0;$i<sizeof($options_name);$i++) {
?>
<div class="attcontrolcomments"><table border="1" style="border: 1px solid #FFC000;" bgcolor="#FFFFCC" width="500" cellpadding="3" cellspacing="3"><?php
  if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') {
?>
<tr><td><h3 class="attributesComments"><?php echo $options_comment[$i]; ?></h3></td></tr></table></div>
<?php
  }
?>

<div class="wrapperAttribsOptions"><table border="1" style="border: 1px solid #FFC000;" bgcolor="#FFFFCC" width="500" cellpadding="3" cellspacing="3">
    <tr>
		<td><h4 class="optionName back"><?php echo $options_name[$i]; ?></h4></td>
	</tr>
	<tr>
		<td><div class="back"><?php echo "\n" . $options_menu[$i]; ?></div>
<?php
if ($options_attributes_image[$i] != '') {
?>
<?php echo $options_attributes_image[$i]; ?></td>
</tr>
</table></div>
<?php
}
?>
<?php if ($options_comment[$i] != '' and $options_comment_position[$i] == '1') { ?>
    <div class="ProductInfoComments"><?php echo $options_comment[$i]; ?></div>
<?php } ?>
<?php
    }
?>


<?php
  if ($show_onetime_charges_description == 'true') {
?>
    <div class="wrapperAttribsOneTime"><?php echo TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION; ?></div>
<?php } ?>


<?php
  if ($show_attributes_qty_prices_description == 'true') {
?>
    <div class="wrapperAttribsQtyPrices"><?php echo zen_image(DIR_WS_TEMPLATE_ICONS . 'icon_status_green.gif', TEXT_ATTRIBUTES_QTY_PRICE_HELP_LINK, 10, 10) . ' ' . '<a href="javascript:popupWindowPrice(\'' . zen_href_link(FILENAME_POPUP_ATTRIBUTES_QTY_PRICES, 'products_id=' . $_GET['products_id'] . '&products_tax_class_id=' . $products_tax_class_id) . '\')">' . TEXT_ATTRIBUTES_QTY_PRICE_HELP_LINK . '</a>'; ?></div>
<?php } ?>
</div>
27 Jun 2011, 5:19 PM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Validating Product Info Page

<div class="attcontrolcomments"><table border="1" style="border: 1px solid #FFC000;" bgcolor="#FFFFCC" width="500" cellpadding="3" cellspacing="3"><?php
  if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') {
?>
<tr><td><h3 class="attributesComments"><?php echo $options_comment[$i]; ?></h3></td></tr></table></div>
<?php
  }
?>

You open the div and table, and then close them inside a conditional segment so they will actually only close if the condition is true. If the condition is false, they never close.
Move the closing </table></div> to below the } so they are always executed.```

<div class="attcontrolcomments"><table border="1" style="border: 1px solid #FFC000;" bgcolor="#FFFFCC" width="500" cellpadding="3" cellspacing="3"><?php if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') { ?> <tr><td><h3 class="attributesComments"><?php echo $options_comment[$i]; ?></h3></td></tr> <?php } ?> </table></div> ```
27 Jun 2011, 5:35 PM
#9
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Validating Product Info Page

gjh42:

<div class="attcontrolcomments"><table border="1" style="border: 1px solid #FFC000;" bgcolor="#FFFFCC" width="500" cellpadding="3" cellspacing="3"><?php if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') { ?>

<tr><td><h3 class="attributesComments"><?php echo $options_comment[$i]; ?></h3></td></tr></table></div> <?php } ?> ``` > You open the div and table, and then close them inside a conditional segment so they will actually only close if the condition is true. If the condition is false, they never close. > Move the closing </table></div> to below the } so they are always executed.``` <div class="attcontrolcomments"><table border="1" style="border: 1px solid #FFC000;" bgcolor="#FFFFCC" width="500" cellpadding="3" cellspacing="3"><?php if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') { ?> <tr><td><h3 class="attributesComments"><?php echo $options_comment[$i]; ?></h3></td></tr> <?php } ?> </table></div> ```

Thanks, Its removed those errors but now I am getting the following validation errors -

Line 574, Column 155: end tag for "table" which is not finished

…;" bgcolor="#FFFFCC" width="500" cellpadding="3" cellspacing="3"></table></div>

✉

Most likely, you nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, in HTML the <head> element must contain a <title> child element, lists require appropriate list items (<ul> and <ol> require <li>; <dl> requires <dt> and <dd>), and so on.
27 Jun 2011, 7:07 PM
#10
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Validating Product Info Page

Thanks to gjh42 this is now down to 6 errors.

I am still receiving the one listed above and have now noticed that easypopulate 1.2.5.4 is converting <ul id="productDetailsList"> into <ul id=â&#128;productDetailsListâ&#128;> when I add it to the database.

Anyone know why? or the answer to the table error above?

Thanks.

28 Jun 2011, 8:59 AM
#11
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Validating Product Info Page

moesoap:

Thanks to gjh42 this is now down to 6 errors.

I am still receiving the one listed above and have now noticed that easypopulate 1.2.5.4 is converting <ul id="productDetailsList"> into <ul id=”productDetailsList”> when I add it to the database.

Anyone know why? or the answer to the table error above?

Thanks.

Solved the easypopulate errors by changing the ul id name, I now only have 4 errors can someone offer a solution to this table error?

Line 575, Column 155: end tag for "table" which is not finished

…;" bgcolor="#FFFFCC" width="500" cellpadding="3" cellspacing="3"></table></div>

✉

Most likely, you nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, in HTML the <head> element must contain a <title> child element, lists require appropriate list items (<ul> and <ol> require <li>; <dl> requires <dt> and <dd>), and so on.

:flex:

28 Jun 2011, 9:47 AM
#12
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Validating Product Info Page

Ok, the last 4 errors are caused by the comments section of the attributes box. The table that I have wrapped around the comment section in module.attributes.php is being pulled into the page even when I dont have comments for those particular attributes selected.

I could add comments to those attributes and that will remove the errors, however that is not ideal as it spoils the page layout.

Is there anyway to switch comments off for particular attributes that are being used?

:(

28 Jun 2011, 10:41 AM
#13
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Validating Product Info Page

Solved...

I changed the following line in module.attributes.php from

<?php
  if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') {

to

<?php
  if ($options_comment[$i] != '1' and $options_comment_position[$i] == '0') {

This brings the comment box in whether or not a comment is present.

Thanks to all who assisted.

:bigups:

28 Jun 2011, 11:23 AM
#14
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Validating Product Info Page

The best way to solve the problem is to move the entire custom div/table inside the conditional so none of it is output when there is no comment.```php

<?php if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') { ?> <div class="attcontrolcomments"><table border="1" style="border: 1px solid #FFC000;" bgcolor="#FFFFCC" width="500" cellpadding="3" cellspacing="3"> <tr><td><h3 class="attributesComments"><?php echo $options_comment[$i]; ?></h3></td></tr> </table></div><?php } ?> ```
28 Jun 2011, 1:17 PM
#15
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Validating Product Info Page

gjh42:

The best way to solve the problem is to move the entire custom div/table inside the conditional so none of it is output when there is no comment.```php

<?php if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') { ?> <div class="attcontrolcomments"><table border="1" style="border: 1px solid #FFC000;" bgcolor="#FFFFCC" width="500" cellpadding="3" cellspacing="3"> <tr><td><h3 class="attributesComments"><?php echo $options_comment[$i]; ?></h3></td></tr> </table></div><?php } ?> ```

Just brilliant, you are a legend. Thanks for your help on this! :clap: