Last active
February 20, 2023 12:31
-
-
Save cesarockstar1985/0c08dd23d60015f2c4e853d081ebe3ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @var \App\View\AppView $this | |
*/ | |
if (isset($cmsPage) && !empty($cmsPage->jsonld)) { | |
$ldJson = json_decode($cmsPage->jsonld, true); | |
} elseif (!empty($bondType)) { | |
$ldJson = [ | |
"@context" => "https://schema.org/", | |
"@type" => "Product", | |
"name" => $bondType->slug, | |
"description" => $bondType->display_name_state . ($bondType->description ? ': ' . $bondType->description : ''), | |
"brand" => [ | |
"@type" => "Thing", | |
"name" => "Surety Bond" | |
], | |
"review"=> [ | |
"@type"=> "Review", | |
"reviewRating"=> [ | |
"@type"=> "Rating", | |
"ratingValue"=> "4", | |
"bestRating"=> "5" | |
], | |
"author"=> [ | |
"@type"=> "Person", | |
"name"=> "Fred Benson" | |
] | |
], | |
"aggregateRating" => [ | |
"@type"=> "AggregateRating", | |
"ratingValue"=> "4.4", | |
"reviewCount"=> "89" | |
], | |
"offers"=> [ | |
"@type" => "Offer", | |
"url" => "https=>//example.com/anvil", | |
"priceCurrency" => "USD", | |
"price" => "119.99", | |
"priceValidUntil" => "2020-11-20", | |
"itemCondition" => "https://schema.org/UsedCondition", | |
"availability" => "https://schema.org/InStock" | |
] | |
]; | |
if ($bondType->instant) { | |
$ldJson["offers"] = [ | |
"@type" => "AggregateOffer", | |
"lowPrice" => \CakeDC\Accounting\Utility\MoneyUtil::float($bondType->low_price), | |
"highPrice" => \CakeDC\Accounting\Utility\MoneyUtil::float($bondType->high_price), | |
"priceCurrency" => "USD" | |
]; | |
} | |
} | |
?> | |
<?php if (!empty($ldJson)) : ?> | |
<?= $this->Html->scriptBlock(json_encode($ldJson), ['type' => 'application/ld+json']) ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment