Canonical From One Product Page To Another

Hello,



Im struggling with SEO of products that by nature are very similar, like Adobe Creative Cloud - there are 4 products with virtually the same description and the only difference is language or promo/nopromo.



Is there a way to add to 3 of those 4 products rel=canonical to the header and point to the 4th one?



Im planning to buy this plugin:

CS-Cart SEO Optimization, Google Rich Snippets, Canonical URL addon



However I need a temporary solution.

Default cs-cart doesn't have this feature yet.

isn't there a way to make a hook in meta.post.tpl with an IF to work only on specifict product ids?

[quote name='Fedor' timestamp='1430206496' post='212795']

isn't there a way to make a hook in meta.post.tpl with an IF to work only on specifict product ids?

[/quote]



Please use the following code:



{$product_ids = [1, 2, 3]}
{if $product.product_id|in_array:$product_ids}
YOUR CODE HERE
{/if}

So I've put in hooks/index/meta.post.tpl




[quote]

{$product_ids = [18571, 18573, 18570, 18572]}

{if $product.product_id|in_array:$product_ids}


{/if}[/quote]

And it does not appear in the products with those IDs. It should also work for friendly URLs yes? Or only for /index.php?dispatch=products.view&product_id=18572?

Maybe the IF statement is wrong? Removing the IF and placing just the line does work (globally for all pages)

I did


```php

{if $product.product_id eq “18571”}


{/if} ```

And it works. Is that OK programming-wise?

[quote name='Fedor' timestamp='1430318252' post='212956']

I did


```php

{if $product.product_id eq “18571”}


{/if} ```

And it works. Is that OK programming-wise?
[/quote]

Both ways should works with the SEO and default URLs. Possibly our code did not work due to the cache

Is it possible to do the same for only specific categories for product filters?

Like to add an if



{if CATEGORY_ID eq “000” && FEATURES_HASH eq “5579”}


{/if}

[quote name='Fedor' timestamp='1431354558' post='213970']

Is it possible to do the same for only specific categories for product filters?

Like to add an if



{if CATEGORY_ID eq “000” && FEATURES_HASH eq “5579”}


{/if}
[/quote]

You can use:

```php
{if $smarty.request.category_id == "000" && $smarty.request.features_hash == "V5579"}

{/if}
```

Thank you very much eCom, it works nice. And if I wanted to do that on ANY features_hash number?



[color=#000000]$smarty[/color][color=#666600].[/color][color=#000000]request[/color][color=#666600].[/color][color=#000000]features_hash [/color][color=#666600]=![/color][color=#000000] [/color][color=#008800]null [/color]



Or something like that?

it not equals

[quote name='Fedor' timestamp='1431425022' post='214076']

Thank you very much eCom, it works nice. And if I wanted to do that on ANY features_hash number?



[color=#000000]$smarty[/color][color=#666600].[/color][color=#000000]request[/color][color=#666600].[/color][color=#000000]features_hash [/color][color=#666600]=![/color][color=#000000] [/color][color=#008800]null [/color]



Or something like that?

[/quote]



Please use this code


```php

{if $smarty.request.category_id == “000” && $smarty.request.features_hash}


{/if}
```

Thank you Aleksey, it works.

!= null worked too, suprisingly, but I changed it for you code.

[quote name='Fedor' timestamp='1431428236' post='214082']

Thank you Aleksey, it works.

!= null worked too, suprisingly, but I changed it for you code.

[/quote]



I am glad to hear that. You are welcome!