X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   w3c validation question (https://forum.x-cart.com/showthread.php?t=64111)

keystone 06-27-2012 10:15 AM

w3c validation question
 
I get this error from w3c validator

Quote:

Error Line 278, Column 23: document type does not allow element "style" here

<style type="text/css">


I have had this error before on other sites too but am not sure how to make it valid. Anyone know?

keystone 06-27-2012 10:22 AM

Re: w3c validation question
 
I also have an error caused by this line of code in /common_files/customer/main/product_prices.tpl

Code:

<div id="wl-prices"{if not $product_wholesale} style="display: none;"{/if}>

the validator doesn't like that
Code:

id="wl-prices"
is repeated on a page with multiple variants because id is supposed to be unique. If I change the line to
Code:

class="wl-prices"

it validates fine but I don't know if that will break functionality or not. Anyone know if changing that is wrong?

balinor 06-27-2012 10:52 AM

Re: w3c validation question
 
Styles need to go in the head tag - can't be in the body.

The unique ID one is one you are going to have to live with - but it doesn't affect display so just ignore it.

keystone 06-27-2012 12:07 PM

Re: w3c validation question
 
So if the styles were part of a mod and they had them in the .tpl should I just cut them out and past them in with my main.css file?

cherie 06-27-2012 12:56 PM

Re: w3c validation question
 
Yep, you can consolidate the styles if that part of the validation is really important.

If the same id is appearing more than once it is probably a bug and may need to be reported.

keystone 06-27-2012 01:08 PM

Re: w3c validation question
 
I'm not sure it is a bug because I think the multiple id's only shows up because I am using BCSE Easy Variant View mod which takes all the variants and lays them out in a table so customers can see all the products at once without having to click on each one from a drop down list. When the mod loops through all the variants it repeats the code from /common_files/customer/main/product_prices.tpl for each one. That is where the id is repeated. Not sure really how to fix that though. Like balinor said, I may just have to ignore it. I like having valid code though so I may start twitching once in while. :)

cflsystems 06-27-2012 01:18 PM

Re: w3c validation question
 
You can even change it to "class" or use the loop to add a number to it "wl-prices-1(2,3...)". This id is probably used by default cart js code to find/change wholesale pricing but since you have this bcse mod and you have the id repeating the cart will not know where to apply changes if needed anyway so that id is useless. If you don't have wholesale pricing it is not important anyway, if you have wholesale pricing they will not work as intended with the id repeating.

balinor 06-28-2012 04:18 AM

Re: w3c validation question
 
Yes, I usually take the css files for the mods and combine them with the main CSS file or put them in the head where they belong.

keystone 06-29-2012 07:17 AM

Re: w3c validation question
 
I'm attempting to set up the counter to add a number to the end of id="wl-prices" like Steve suggested. I'm not sure how to do it correctly. Here is what the set up is.

from /common_files/customer/main/bcse_evv.tpl:

Code:

{foreach from=$variants key=vntid item=vnt}{*Loop through variants*}
        {assign var='bcse_evv_disabled' value=0}
...

{if $product.forsale ne "B"}{include file="customer/main/product_prices.tpl" product_wholesale=$vnt.wholesale}{/if}

...

{/foreach}{*/variants*}


from customer/main/product_prices.tpl:
Code:

<div id="wl-prices"{if not $product_wholesale} style="display: none;"{/if}>
...


I'm thinking that I need to initiate a counter maybe here? (not quite sure of correct bracketing, etc)

/common_files/customer/main/bcse_evv.tpl:
Code:


$counter = 0;
{foreach from=$variants key=vntid item=vnt}{*Loop through variants*}
$counter++;
        {assign var='bcse_evv_disabled' value=0}
...



then append the number to wl-prices like this somehow in
customer/main/product_prices.tpl:
Code:

<div id="wl-prices$counter"{if not $product_wholesale} style="display: none;"{/if}>

Am I even close? :)

cflsystems 06-29-2012 07:41 AM

Re: w3c validation question
 
Just change it to class and make your life easier :) Either way the XC builtin code will not work for wl-prices


All times are GMT -8. The time now is 05:26 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.