Jump to content

Google search results show my products sold out


Recommended Posts

Seems to me itemProp="availability" is only displayed when quantity is greater than 0.

 

I've just changed

{if $product->quantity > 0}<link itemprop="availability" itemtype="http://schema.org/InStock"/>{/if}

 

to

 

{if ($product->quantity > 0) || ($allow_oosp)}<link itemprop="availability" itemtype="http://schema.org/InStock"/>{/if}

 

In product.tpl in my theme, to solve that immediate problem.

 

A bigger problem is that if you have price combinations, no schema prices are detected by google at all, from what I can see it's because the html is updated locally by javascript.  The HTML that google pulls to scan for schema tags, doesn't exist.

Link to comment
Share on other sites

Sounds similar to how mine is setup.  To allow ordering, as far as I'm aware, you would still need to check the "Available to Order" checkbox on the product definition.  which should still get picked up by the code above.

 

This is the code block I added to my product.tpl, which pretty much forces the meta data, and certainly isn't the best way to do it.  But it's been useful for testing that the test live data option in google picks it up.

 

NB.  I've had to do this because I have price affecting product combinations, which updates code via javascript on local browser, so none of the original product.tpl meta data in the form gets picked up by google.  This may not be best option for other implementations.

 

 

Added before the <form id="buy_block"{if $PS_CATALOG_MODE line in product.tpl

 

            <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
                <link content="In Stock" itemprop="availability" itemtype="http://schema.org/InStock"/>
                <meta itemprop="price" content="{convertPrice price=$productPrice}"/>
                <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
                <div itemprop="priceSpecification" itemscope itemtype="http://schema.org/PriceSpecification"
                    <meta itemprop="minPrice" content="{convertPrice price=$productPrice}"/>
                    <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
                    <meta itemprop="valueAddedTaxIncluded" content="true"/>
                </div>
            </div>

Link to comment
Share on other sites

×
×
  • Create New...