Jump to content

Schema Offer -> Category in product.tpl


Recommended Posts

Around line 265 of product.tpl I wanted to express a category hierarchy as specified for https://schema.org/category

 

I had this:

<meta itemprop="category" content="{$path|strip_tags}" />

But, it is including the name of the product. Would I have to create code in theme modules to get a new smarty assign variable without the product name in the category path?

Link to comment
Share on other sites

Hi Denver,

Yes, probably easiest to do this in php, not in smarty, as smarty hasn't really substring functionality directly available (although you could try to make it work like in this example (there they use the last part of the string, but you may be able to make it work for the fist part of the string as well).

 

 

The $path probably uses '>' as separators, so then look for the last occurrence of this and cut the string (substr) there and assign it to a new smarty variable.

 

 

 

My 2 cents,

pascal.

Link to comment
Share on other sites

Hi Denver,

Yes, probably easiest to do this in php, not in smarty, as smarty hasn't really substring functionality directly available (although you could try to make it work like in this example (there they use the last part of the string, but you may be able to make it work for the fist part of the string as well).

 

 

The $path probably uses '>' as separators, so then look for the last occurrence of this and cut the string (substr) there and assign it to a new smarty variable.

 

 

 

My 2 cents,

pascal.

I'm looking at category-tree-branch.tpl It references $node.children I wonder if $node.parent would work in reverse? For now, a text string. But, I am following https://github.com/schemaorg/schemaorg/issues/440 Not much can be done until the core allows more input fields for semantic category information.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...