Jump to content
Sign in to follow this  
soniad

trying to implement microdata

Recommended Posts

Hello everyone,

I am trying to fetch a product price and declare it as an item property for microdata.

The following function returns a price and displays it on the page:

<?php echo $this->getPriceHtml($_product, true) ?>

I don't want to display the price but to insert it in the following code

<meta itemprop="price" content=(price) />

where (price) is the returned value


I tried this:

<?php $_test = $this->getPriceHtml($_product, true) ?> 
<?php echo $_test ?>

the variable $_test displays correctly in my diagnostics.

But I cannot get it to work when inserted in the meta call:

<meta itemprop="price" content=$_test />

Could somebody please show me where I'm going wrong?

Thanks

Share this post


Link to post
Share on other sites

<meta itemprop="price" content="<?php echo $this->getPriceHtml($_product, true); ?>" />

Share this post


Link to post
Share on other sites

In addition to QuickOldCar's answer, your markup is different then what Schema.org defines as a price object.  Check out the http://schema.org/price Price description.  Click on the Microdata tab for example markups.  

 

You may want:

<span itemprop="priceCurrency" content="USD">$</span><span
      itemprop="price" content="1000.00">1,000.00</span>
<link itemprop="availability" href="http://schema.org/InStock" />In stock 
Edited by rwhite35

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.