VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: bigbangireland on August 30, 2011, 13:37:42 PM

Title: Availability, Condition, Price Valid Until and ISO Currency
Post by: bigbangireland on August 30, 2011, 13:37:42 PM
To expand on my post here http://forum.virtuemart.net/index.php?topic=90203.0 (http://forum.virtuemart.net/index.php?topic=90203.0) I've listed a number of features below that would give VM an edge in the new SEO game.




Availability
http://www.schema.org/ItemAvailability (http://www.schema.org/ItemAvailability)
The current method of displaying availability in VM would be better displayed as an estimated delivery time. Then the availability could be displayed and SEO'd using shema.org
Options - Discontinued, InStock, InStoreOnly, OnlineOnly, OutOfStock and PreOrder



<?php
$availability 
'InStock';
echo 
'<link itemprop="availability" href="http://schema.org/' $availability '">' PHP_EOL;
echo 
'<span class="product-availability ' $availability '">' JText::_('COM_VIRTUEMART_AVAILABILITY_' $availability) . '</span>' PHP_EOL;





Condition
http://www.schema.org/OfferItemCondition (http://www.schema.org/OfferItemCondition)
Allowing the setting of an item condition would add a whole new feature to VM and would be relatively easy to implement.
Options - DamagedCondition, NewCondition, RefurbishedCondition and UsedCondition



<?php
$condition 
'NewCondition';
echo 
'<link itemprop="itemCondition" href="http://schema.org/' $condition '">' PHP_EOL;
echo 
'<span class="product-condition ' $condition '">' JText::_('COM_VIRTUEMART_CONDITION_' $condition) . '</span>' PHP_EOL;





Price Valid Until
http://www.schema.org/Offer
Using HTML5's new <time> tag a price valid until date could be displayed. This would require an admin setting to set the end time of a discount.



<?php
echo '<time itemprop="priceValidUntil" datetime="' JHtml::_('date'$priceValidToJText::_(DATE_W3C)) . '">';
echo 
JHtml::_('date'$priceValidToJText::_('DATE_FORMAT_LC2'));
echo 
'</time>' PHP_EOL;





ISO Currency
http://www.schema.org/Offer
The ICO 3 letter currency code is currently available in the currency table but not in the currency object in the templates.



<?php
$iso 
'EUR';
echo 
'<meta itemprop="priceCurrency" content="' $iso '">' PHP_EOL;

Title: Re: Availability, Condition, Price Valid Until and ISO Currency
Post by: bigbangireland on August 30, 2011, 14:57:03 PM
For those wondering PHP_EOL is a cross-platform line-break defined as a PHP constant.  :D
Title: Re: Availability, Condition, Price Valid Until and ISO Currency
Post by: jjk on August 30, 2011, 20:48:13 PM
...if this would be built into VM2, what would be the options in case none of available schemas fits my business? (There actually is none)   ;)
Title: Re: Availability, Condition, Price Valid Until and ISO Currency
Post by: bigbangireland on August 30, 2011, 21:36:37 PM
You just need to narrow down the schema to the most suitable for your business:

<div itemscope itemtype="http://schema.org/Organization"> or <div itemscope itemtype="http://schema.org/LocalBusiness"> might work for you.

You could use it in the com_contact template.