Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

w3c validation question

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-27-2012, 10:15 AM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 787
 

Default 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?
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote
  #2  
Old 06-27-2012, 10:22 AM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 787
 

Default 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?
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote
  #3  
Old 06-27-2012, 10:52 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #4  
Old 06-27-2012, 12:07 PM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 787
 

Default 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?
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote
  #5  
Old 06-27-2012, 12:56 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default 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.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #6  
Old 06-27-2012, 01:08 PM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 787
 

Default 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.
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote
  #7  
Old 06-27-2012, 01:18 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

Default 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.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #8  
Old 06-28-2012, 04:18 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #9  
Old 06-29-2012, 07:17 AM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 787
 

Default 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?
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote
  #10  
Old 06-29-2012, 07:41 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:14 PM.

   

 
X-Cart forums © 2001-2020