VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Virtuemart 1.1 Development (Archiv) => Quality & Testing VirtueMart 1.1.x => Topic started by: doorknob on July 14, 2008, 23:56:43 PM

Title: Bugs in shop.browse & shop.product_details (updated 4thAug)
Post by: doorknob on July 14, 2008, 23:56:43 PM
I have tracked down a couple of problems with the description meta tag.
1 Ampersands and double quotes are invalid in the description tag and cause an xhtml compliance failure. The proposed update replaces any ampersands with 'and', and double quotes with single quotes (which are valid).
2 The function used is deprecated in J1.5 and should be replaced by using a different function (as is already the case in shop.product_details).
shop.browse (lines 70-71)
/* Prepend Product Short Description Meta Tag "description" when applicable */
$mainframe->prependMetaTag( "description", substr(strip_tags($desc ), 0, 255) );


should be replaced by
/* Prepend Product Short Description Meta Tag "description" when applicable */
$meta_desc = substr( htmlspecialchars( strip_tags( $desc ), ENT_QUOTES, 'UTF-8', false ), 0, 255 );
if( vmIsJoomla('1.5') ) {
$document =& JFactory::getDocument();
$document->setDescription( $meta_desc );
} else {
$mainframe->prependMetaTag( 'description', $meta_desc );
}

and
shop.product_details (lines 231-237)
// Prepend Product Short Description Meta Tag "description"
if( vmIsJoomla('1.5')) {
$document = JFactory::getDocument();
$document->setDescription(strip_tags( $db_product->f("product_s_desc")));
} else {
$mainframe->prependMetaTag( "description", strip_tags( $db_product->f("product_s_desc")) );
}

should be replaced by
// Prepend Product Short Description Meta Tag "description"
$meta_desc = substr( htmlspecialchars( strip_tags( $db_product->f('product_s_desc') ), ENT_QUOTES, 'UTF-8', false ), 0, 255 );
if( vmIsJoomla('1.5') ) {
$document =& JFactory::getDocument();
$document->setDescription( $meta_desc );
} else {
$mainframe->prependMetaTag( 'description', $meta_desc );
}

Regards
Phil