mfish Posted November 23, 2023 Share Posted November 23, 2023 (edited) Hi! How can I get category ID in schema.org template? {$id_category} doesen't work... I need category id for implementings products on facebook. Without category id, facebook won't retrieve products... Please help { "@context": "https://schema.org/", "@type": "Product", "name": "{$product.name}", "description": "{$page.meta.description|regex_replace:"/[\r\n]/" : " "}", "category": "{$id_category}", {if !empty($product.cover)}"image" :"{$product.cover.bySize.home_default.url}",{/if} "sku": "{if $product.reference}{$product.reference}{else}{$product.id}{/if}", "mpn": "{if $product.mpn}{$product.mpn}{elseif $product.reference}{$product.reference}{else}{$product.id}{/if}" {if $product.ean13},"gtin13": "{$product.ean13}" {else if $product.upc},"gtin13": "{$product.upc}" {/if} {if $product_manufacturer->name OR $shop.name}, "brand": { "@type": "Thing", "name": "{if $product_manufacturer->name}{$product_manufacturer->name|escape:'html':'UTF-8'}{else}{$shop.name}{/if}" } Edited November 23, 2023 by mfish (see edit history) Link to comment Share on other sites More sharing options...
Knowband Plugins Posted November 28, 2023 Share Posted November 28, 2023 On 11/23/2023 at 5:01 PM, mfish said: Hi! How can I get category ID in schema.org template? {$id_category} doesen't work... I need category id for implementings products on facebook. Without category id, facebook won't retrieve products... Please help { "@context": "https://schema.org/", "@type": "Product", "name": "{$product.name}", "description": "{$page.meta.description|regex_replace:"/[\r\n]/" : " "}", "category": "{$id_category}", {if !empty($product.cover)}"image" :"{$product.cover.bySize.home_default.url}",{/if} "sku": "{if $product.reference}{$product.reference}{else}{$product.id}{/if}", "mpn": "{if $product.mpn}{$product.mpn}{elseif $product.reference}{$product.reference}{else}{$product.id}{/if}" {if $product.ean13},"gtin13": "{$product.ean13}" {else if $product.upc},"gtin13": "{$product.upc}" {/if} {if $product_manufacturer->name OR $shop.name}, "brand": { "@type": "Thing", "name": "{if $product_manufacturer->name}{$product_manufacturer->name|escape:'html':'UTF-8'}{else}{$shop.name}{/if}" } Hi, Can you please explain the path where you have added the below code and which files are included in the same so that we can help you out in the situation? if you need category ID and if this is a template file you need to identify from where this product variable is assigned and similarly assign category id from there. Also, you can try below code "category": "{$product.id_category_default}", I believe that the above code will give you the category ID. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now