Add “priceValidUntil” to Sellerdeck Schema

Call 01323 872296


Add “priceValidUntil” to Sellerdeck Schema

Google is increasingly flagging the absence of “priceValidUntil” from schema/microdata. It is easy to solve.

in Sellerdeck v18 open the schema layout and look at the bottom of the layout:

	if ($MaxPrice > $MinPrice)
	{
		echo "\"@type\": \"AggregateOffer\",", chr(13) , chr(10), "\t\t", "\"highPrice\":", number_format($MaxPrice,2, '.', ''), ",", chr(13) , chr(10), "\t\t", "\"lowPrice\":", number_format($MinPrice,2, '.', ''), ",";
	}</actinic:block>
		"priceCurrency": "<actinic:variable name="DefaultIntCurrencySymbol" selectable="false" />",
		"availability": <actinic:block if="%21%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20OR%20%3cactinic%3avariable%20name%3d%22IsInStock%22%20%2f%3e" >"http<actinic:block if="%3cactinic%3avariable%20name%3d%22SSLUsed%22%20%2f%3e">s</actinic:block>://schema.org/InStock"</actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20AND%20%21%3cactinic%3avariable%20name%3d%22IsInStock%22%20%2f%3e" >"http<actinic:block if="%3cactinic%3avariable%20name%3d%22SSLUsed%22%20%2f%3e">s</actinic:block>://schema.org/PreOrder"</actinic:block>
	}
}
</script>

Then add the following on a new line after the “availability” line

		"url": "<actinic:block php="true">echo '<actinic:variable encoding="perl" name="SSLCatalogURL" selectable="false" />' . basename('<actinic:variable name="ProductPageName" encoding="perl" selectable="false" />');</actinic:block>",
		"priceValidUntil": "<actinic:block php="true">
			$date = new DateTime();
			$date->add(new DateInterval('P6M'));
			echo $date->format('d M Y');
		</actinic:block>"

so it looks like this

if ($MaxPrice > $MinPrice)
	{
		echo "\"@type\": \"AggregateOffer\",", chr(13) , chr(10), "\t\t", "\"highPrice\":", number_format($MaxPrice,2, '.', ''), ",", chr(13) , chr(10), "\t\t", "\"lowPrice\":", number_format($MinPrice,2, '.', ''), ",";
	}</actinic:block>
		"priceCurrency": "<actinic:variable name="DefaultIntCurrencySymbol" selectable="false" />",
		"availability": <actinic:block if="%21%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20OR%20%3cactinic%3avariable%20name%3d%22IsInStock%22%20%2f%3e" >"http<actinic:block if="%3cactinic%3avariable%20name%3d%22SSLUsed%22%20%2f%3e">s</actinic:block>://schema.org/InStock"</actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsStockMonitored%22%20%2f%3e%20AND%20%21%3cactinic%3avariable%20name%3d%22IsInStock%22%20%2f%3e" >"http<actinic:block if="%3cactinic%3avariable%20name%3d%22SSLUsed%22%20%2f%3e">s</actinic:block>://schema.org/PreOrder"</actinic:block>
		"url": "<actinic:block php="true">echo '<actinic:variable encoding="perl" name="SSLCatalogURL" selectable="false" />' . basename('<actinic:variable name="ProductPageName" encoding="perl" selectable="false" />');</actinic:block>",
		"priceValidUntil": "<actinic:block php="true">
			$date = new DateTime();
			$date->add(new DateInterval('P6M'));
			echo $date->format('d M Y');
		</actinic:block>"
	}
}
</script>

What we are doing is using php to constantly write a date that is six months ahead which is probably a reasonable guess for how long a price will be available for.

You can change it to three months for example by changing (‘P6M’) into (‘P3M’)

Keep in touch and share

Graphicz on Social Media



01323 872296. 07836 551000.
Email:

Website by Graphicz