Author Topic: Minor W3C bug fix  (Read 1245 times)

OpenGlobal

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 316
    • OpenGlobal E-commerce Web Design in Gloucester
Minor W3C bug fix
« on: June 06, 2012, 12:25:36 pm »
One of the javascript declarations breaks W3C compliance according to the W3C validator (although I think this is a bug in the validator rather than Virtuemart) because it contains "HTML" within a script block.

Code: [Select]
vmSiteurl = 'http://www.willowsshop.co.uk/' ;
vmLang = ""
vmCartText = ' was added to your cart.' ;
vmCartError = 'There was an error while updating your cart.' ;
loadingImage = '/components/com_virtuemart/assets/images/facebox/loading.gif'  ;
closeImage = '/components/com_virtuemart/assets/images/facebox/closelabel.png' ;
Virtuemart.addtocart_popup = '0' ;
faceboxHtml = '<div id="facebox" style="display:none;"><div class="popup"><div class="content"></div> <a href="#" class="close"></a></div></div>'

The last line appears to contain HTML to the W3C validator. The Joomla $document->addScriptDeclaration() function should really add a CDATA block around everything for completeness, but it doesn't.

So a 2 minute cut and paste bug fix would be to change:

Code: [Select]
                $document = JFactory::getDocument();
                $document->addScriptDeclaration($jsVars);

to:

Code: [Select]
                $document = JFactory::getDocument();
                $document->addScriptDeclaration("//<![CDATA[\n".$jsVars."\n//]]>");

in administrator/components/com_virtuemart/helpers/config.php in function jPrice().

OpenGlobal