See what can be done to improve the Commerce integration, e.g. adding product-related meta tags, etc.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | metatag-n2103321-15.patch | 6.89 KB | damienmckenna |
See what can be done to improve the Commerce integration, e.g. adding product-related meta tags, etc.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | metatag-n2103321-15.patch | 6.89 KB | damienmckenna |
Comments
Comment #1
damienmckennarvallejo: Would you be interested in merging your Metatag:Commerce into the main Metatag module as a submodule to house all of the Commerce integration?
Comment #2
rvallejo commentedSounds good to me. I'd like to get the generic integration down (twitter and open graph product tags), and then work on further Drupal Commerce integration. I'm happy to hear others feedback and suggestions.
For anyone else, the Metatag Commerce module Damiem mentioned is a sandbox I recently created at https://drupal.org/sandbox/rvallejo/2102725.
Comment #3
guile2912 commentedThe metatag Commerce module does not work "out of the box" in drupal commerce, because commerce does not display "commerce_product", it displays nodes that reference "commerce_product" thought its field_product.
So here is a very small patch for metatag thats adds hook alter on "metatag_entity_view" so that we can deflect the entity metadata works on from the node, to its first "commerce_product" and have Metatag Commerce module work out of the box, with this kind of code :
Comment #4
rvallejo commented@guile2912: Looks like a good start—I had to make a slight adjustment to the field name, as for me it's 'field_products' instead of 'field_product'. Conceivably, someone could name the field whatever they want and it would be good to make this work regardless, so long as there is a product reference field. It also looks to me like it may not work with multi-language sites, but honestly I haven't played with any locale-enabled D7 sites at all yet, let alone locale-enabled commerce sites, to know the ins and outs. I would imagine some sort of language check could be added in.
Also, as is probably expected, adding the hook_metatag_entity_view_alter function overrides any product display node meta tags with the product meta tags (display node tags aren't used at all). This may be fine, but it might be a good idea to make products inherit their display node's tags as well. I'd have to look more into the metatag structure to figure this one out, but this seems like a good start at least.
I'll see if I can make this work generically regarding field names and commit the new function to my sandbox (hopefully within the next week, depending on when I can fit it in my schedule). I think once product entity tags are working this should be functional enough to add as a submodule included in the Metatag project as Damien suggested, along with the drupal_alter patch applied to the main Metatag module.
Any thoughts, Damien?
Comment #5
damienmckennaI've personally got three goals for the Commerce integration:
I really appreciate your work to help on the Commerce integration, I'll loop back to this again once I get the next beta out.
Comment #6
damienmckennaComment #7
damienmckennaComment #8
guile2912 commentedMaybe we could push this one line patch that justs adds a new hook, and allows Drupal commerce to work with Metatags.
The detail of the code that will then use this hook, in other modules, is an other story ^^
Just this one line and we have clean a solution taht can open lots of doors.
Thank you.
Comment #9
damienmckennaI've added a new issue to split this up into smaller pieces:
This task will focus on identifying any missing meta tags that would be useful to have for ecommerce.
Comment #10
damienmckennaI think this one is good enough, lets leave it for #2219945: Provide turn-key solution for Commerce Kickstart.
Comment #11
omarlopesinoI move this comment to https://www.drupal.org/node/2219945
Comment #12
omarlopesinoComment #13
damienmckenna@mistermoper: Lets keep the new tags to this issue, leave the other one for creating default values.
Lets stick with this new thing, but I think it'd be worthwhile moving the product meta tags into a new "Open Graph - Products" group, given there are so many of them. Thanks.
Comment #14
omarlopesinoYeah, by that way the metatags are more organized.
I attach the patch moving it into a group,
Comment #15
damienmckennaI updated some of the descriptions and moved all of the meta tags to the bottom of metatag_opengraph_metatag_info().
Comment #18
damienmckennaCommitted. Thanks mistermoper!