Oops Google ….

So we have been working hard to create the proper and effective way to deliver schematic markup to Google and others. Up until recently yesterday, there was an issue delivering the product price for Zen Cart. I have 2 thoughts on this.

1. Maybe we should ONLY be delivering the base price and not the specials price?

2. Maybe we should be delivering the actual price, which is the special price for a product on sale?

Some arguments for the issue include:

  • These are not real time in the search results anyhow. So a searcher could be given a special price in search results and get to your site to find it no longer on special.
  • The platforms, Schema.org, Rich Snippets, Good relations, Open Graph etc have only 1 price specification, regular and sale seem more logical.
  • All of the markup platforms have additional assignments for price expiration etc in the offer markup.

So with Zen Cart I have worked it out both ways (below)…. The actual price, which includes specials has a rounding hack in it because Google is too stupid to read 18.0000 as $18.00 and instead reads AND displays 180,000.00. No idea why, but duhhhhhhhhhhhh.

google_bugSo thus, we have a hack because honestly because of taxes, quantity discounts and other pricing values in an ecommerce system such as Zen Cart we need 4 decimal places.

So if you want to display the actual price you would use this

<?php echo $specials_new_products_price = (round(zen_get_products_actual_price($product_info_metatags->fields[‘products_id’]),2)); ?>

Now if you want to use the base price, which based on the arguments above is trouble free, then you use this

<?php echo $products_price = zen_get_products_base_price($product_info->fields[‘products_id’]); ?>

Likely you will all be asking about the expiration of a special…… Here are the instructions:

1. Download Sale Ending/Special Ending from Zen Cart (because there is not reason to reinvent the wheel)

2. Edit common_files/includes/languages/english/extra_definitions/sale_special_ending.php and edit the language definitions to be blank, like below:

define(‘TEXT_SALE_EXPIRES’, ”);

3. Edit common_files/includes/functions/extra_functions/sale_special_ending.php and change the following line

Line 6 function sale_special_ending($id, $longdate = true, $one_day_back = false) {


function sale_special_ending($id, $longdate = false, $one_day_back = false) {

4. Now in your details list in templates/product_info_display.php add your price like this

<li>Products Current Price: <span itemprop=”offerDetails” itemscope itemtype=”http://data-vocabulary.org/Offer”><meta itemprop=”currency” content=”USD”/><?php
$ssblock = sale_special_ending((int)$_GET[‘products_id’]);
if ($ssblock != ”) {
echo ‘<time itemprop=”priceValidUntil” datetime=”‘ . $ssblock . ‘”></time>’;
?><span itemprop=”price”><?php echo $specials_new_products_price = (round(zen_get_products_actual_price($product_info_metatags->fields[‘products_id’]),2)); ?></span></span></li>

5. You can also add another line item for the shopper if you like

$ssblock = sale_special_ending((int)$_GET[‘products_id’]);
if ($ssblock != ”) {
echo ‘<li><b>Sale Ends:</b> <time itemprop=”priceValidUntil” datetime=”‘ . $ssblock . ‘”></time>’ . $ssblock . ‘</li>’;

Want to catch up on all the markup we have worked out so far for your store? Get the Rich Snippets Tutorial for Zen Cart. That’s all, stay advised and work hard!

One response to “Oops Google ….”