vaersaagod / seomate

SEO, mate! It's important. That's why SEOMate provides the tools you need to craft all the meta tags, sitemaps and JSON-LD microdata you need - in one highly configurable, open and friendly package - with a super-light footprint.
MIT License
36 stars 8 forks source link

Commerce field profile not mapping #34

Closed nickcobley closed 4 years ago

nickcobley commented 4 years ago

I'm trying to do a very simple map of a commerce products section to a profile, but for whatever reason, viewing a product, every time it will pick up the default profile.

I'm on Craft 3.4.8, Commerce 3.0.10 and seomate 1.1.2

Here's a simplified version of what I'm attempting to use:

    'defaultProfile' => 'standard',

    'fieldProfiles' => [
        'standard' => [
            'title' => ['seoTitle', 'title'],
            'description' => ['seoDescription'],
            'image' => ['seoImage'],
        ],

        'products' => [
            'title' => ['seoTitle','title'],
            'description' => ['seoDescription', 'productDescription:text.body', 'importBody'],
            'image' => ['productImages'],    
        ],
    ],
    'profileMap' => [
        'products' => 'products',
    ], 

Any ideas? I've tried assigning the profile from the template too but that makes no difference. Wondering if Commerce 3 is breaking things?

aelvan commented 4 years ago

Hi,

I haven't tested this on Commerce 3 yet, will do.

But for custom element types like commerce products, you have to set the profile at the template level, the profile map is only for entries and categories. Can you paste the template code that doesn't work?

nickcobley commented 4 years ago

It's okay, I'll leave it at that for now. I didn't realise profile maps didn't apply for commerce products, makes sense now. I thought I tried mapping it directly from the template but I don't have that code to hand, as it never worked I didn't keep it.

We are running Commerce 3 in production now, as there is at least one one other issue I have getting SEOmate to work reliably for us I just switched it back to the other plugin for now. I'll leave it that way until you have had chance to test it in Commerce 3.

Thanks for following up.

aelvan commented 4 years ago

Ok, cool. Any information on what that other issue was? :)

nickcobley commented 4 years ago

I'm sure they were more RTFM errors to be honest. I don't log things like that on a free addon unless I'm 100% certain I'm not being an idiot! So need to revisit it with a fresh head first.

aelvan commented 4 years ago

Ok, cool, I'll test on Commerce 3 shortly. Leaving this open for now.

aelvan commented 4 years ago

Tested with Commerce 3 and works as expected. Profile needs to be set at the template level, ie:

{% set seomate = {
    profile: 'product',
} %}