How to set the Schema product type to course or workshop instead of "product"

  • Posts: 173
  • Thank you received: 8
  • Hikashop Essential
5 months 18 hours ago #365601

-- HikaShop version -- : 5.1.3
-- Joomla version -- : 4.4.4
-- PHP version -- : 8.0
-- Browser(s) name and version -- : All
-- Error-message(debug-mod must be tuned on) -- : No Error Message

Hi All,
Just wondering how I can set the product type in the Schema to Course or Workshop instead of it coming up as product.
Many thanks
Ian

Please Log in or Create an account to join the conversation.

  • Posts: 84050
  • Thank you received: 13624
  • MODERATOR
4 months 4 weeks ago #365602

Hi,

The schema type, along with all the rest of the schema is directly added in the view files of the product page.
So, you can create view overrides to change that, and more.

For example, if you edit product / show via the menu Display>Views, you can see this line:

<div itemscope itemtype="https://schema.org/Product" id="hikashop_product_<?php echo preg_replace('#[^a-z0-9]#i','_',@$this->element->product_code); ?>_page" class="hikashop_product_page <?php echo implode(' ',$classes); ?> hikashop_product_<?php echo $this->productlayout; ?>">
There, you can see the "itemtype" attribute.
Similarly, in product / show_microdata, you can find this code:
    $obj->context = "https://schema.org/";
    $obj->$type = $product_type;
which sets the product type for the JSON-LD

Please Log in or Create an account to join the conversation.

Time to create page: 0.052 seconds
Powered by Kunena Forum