Created
February 23, 2023 17:23
-
-
Save cesarockstar1985/46ae88aad66bb08f4b40448c7da03294 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" | |
] | |
]; | |
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