Product Title

Hi,

How to change product product title ?

property="og:title" content="Category :: Subcategory :: Product title" />

to

property="og:title" content="Product title" />

app/addons/social_buttons/func.php

find the fn_facebook_prepare_meta_data function and replace:

'title' => fn_sb_format_page_title(),

with

'title' => $product['product'],

Thanks :)

Thanks :)

You are welcome!

app/addons/social_buttons/func.php

find the fn_facebook_prepare_meta_data function and replace:

'title' => fn_sb_format_page_title(),

with

'title' => $product['product'],

This is really helpful, thanks! Could you also please explain how to do the same thing with Twitter?

Thanks,

Jason

This is really helpful, thanks! Could you also please explain how to do the same thing with Twitter?

Thanks,

Jason

Jason, as far as I can see from the code, the mentioned changes should work for all integrated providers

The code changes will get wiped out with an upgrade. You can use a meta.tpl hook that will survive an upgrade. Create templates/addons/my_changes/hooks/index/meta.pre.tpl

{if $provider_meta_data.all.title}
    {$provider_meta_data.all.title = $page_title|default:$product.product scope=parent}
{/if}

The code changes will get wiped out with an upgrade. You can use a meta.tpl hook that will survive an upgrade. Create templates/addons/my_changes/hooks/index/meta.pre.tpl

{if $provider_meta_data.all.title}
    {$provider_meta_data.all.title = $page_title|default:$product.product scope=parent}
{/if}

Jason, as far as I can see from the code, the mentioned changes should work for all integrated providers

Thanks for your help guys. I tried both solutions, but unfortunately neither of them changed the text being posted to Twitter. I do see a separate function (in the app/addons/social_buttons/func.php file) called "fn_twitter_prepare_settings" that might hold the key, but I'm not knowledgeable enough to figure that out. Any suggestions?

arteeni, try to replace:

 $default_twitter_fields = array(
        'data-lang' => $params['lang_code'],
        'data-size' => $twitter_settings['twitter_size'],
        'data-via' => $twitter_settings['twitter_via'],
        'data-count' => $twitter_settings['twitter_display_count'],
        'data-url' => fn_sb_get_url()
    );

with

 $default_twitter_fields = array(
        'data-lang' => $params['lang_code'],
        'data-size' => $twitter_settings['twitter_size'],
        'data-via' => $twitter_settings['twitter_via'],
        'data-count' => $twitter_settings['twitter_display_count'],
        'data-url' => fn_sb_get_url()
    );
if (!empty($_REQUEST['product_id'])) {
    $default_twitter_fields['data-title'] = fn_get_product_name($_REQUEST['product_id']); 
}

(!) Not tested

my_changes/hooks/products/product_detail_bottom.pre.tpl

{if $addons.social_buttons.twitter_enable == "Y" && $provider_settings.twitter.data}
    {$provider_settings.twitter.data = "`$provider_settings.twitter.data` data-text=\"`$product.product`\""}
{/if}

my_changes/hooks/products/product_detail_bottom.pre.tpl

{if $addons.social_buttons.twitter_enable == "Y" && $provider_settings.twitter.data}
    {$provider_settings.twitter.data = "`$provider_settings.twitter.data` data-text=\"`$product.product`\""}
{/if}

arteeni, try to replace:

 $default_twitter_fields = array(
        'data-lang' => $params['lang_code'],
        'data-size' => $twitter_settings['twitter_size'],
        'data-via' => $twitter_settings['twitter_via'],
        'data-count' => $twitter_settings['twitter_display_count'],
        'data-url' => fn_sb_get_url()
    );

with

 $default_twitter_fields = array(
        'data-lang' => $params['lang_code'],
        'data-size' => $twitter_settings['twitter_size'],
        'data-via' => $twitter_settings['twitter_via'],
        'data-count' => $twitter_settings['twitter_display_count'],
        'data-url' => fn_sb_get_url()
    );
if (!empty($_REQUEST['product_id'])) {
    $default_twitter_fields['data-title'] = fn_get_product_name($_REQUEST['product_id']); 
}

(!) Not tested

Hi guys - thanks again for your help and suggestions. I tried both suggestions and unfortunately wasn't able to get either to work.

So, I decided to go a different route and use the AddThis service instead. I figured it would give me better control over what social media icons to show, I could make changes to it on the fly without editing anything on the site, and it would allow me to have consistency across the whole site (i.e. using on my blog posts in addition to the product and content pages).

One last question for you - I was able to add the buttons by pasting the AddThis code into a new HTML block. But, for the product page, I want the buttons to be better integrated into the page. Can you please tell me where I should paste the code if I want it to appear in the same place as where the Social Buttons addon puts it? Also, what is the location of the template file I need to edit?

Thanks again!

Sorry, I missed a couple of things. Tested this time.

my_changes/hooks/products/product_detail_bottom.pre.tpl

{if $addons.social_buttons.twitter_enable == "Y" && $provider_settings.twitter.data}
    {$provider_settings.twitter.data = "`$provider_settings.twitter.data` data-text=\"`$product.product`\"" scope=parent}
{/if}

If you want to use addthis and have it in the same place cs-cart puts the buttons put your HTML in my_changes/hooks/products/product_detail_bottom.post.tpl

The correct code of my solution is:

 $default_twitter_fields = array(
        'data-lang' => $params['lang_code'],
        'data-size' => $twitter_settings['twitter_size'],
        'data-via' => $twitter_settings['twitter_via'],
        'data-count' => $twitter_settings['twitter_display_count'],
        'data-url' => fn_sb_get_url()
    );
    if (!empty($_REQUEST['product_id'])) {
        $default_twitter_fields['data-text'] = fn_get_product_name($_REQUEST['product_id']); 
    }

Just tested it :)

The correct code of my solution is:

 $default_twitter_fields = array(
        'data-lang' => $params['lang_code'],
        'data-size' => $twitter_settings['twitter_size'],
        'data-via' => $twitter_settings['twitter_via'],
        'data-count' => $twitter_settings['twitter_display_count'],
        'data-url' => fn_sb_get_url()
    );
    if (!empty($_REQUEST['product_id'])) {
        $default_twitter_fields['data-text'] = fn_get_product_name($_REQUEST['product_id']); 
    }

Just tested it :)

Sorry, I missed a couple of things. Tested this time.

my_changes/hooks/products/product_detail_bottom.pre.tpl

{if $addons.social_buttons.twitter_enable == "Y" && $provider_settings.twitter.data}
    {$provider_settings.twitter.data = "`$provider_settings.twitter.data` data-text=\"`$product.product`\"" scope=parent}
{/if}

If you want to use addthis and have it in the same place cs-cart puts the buttons put your HTML in my_changes/hooks/products/product_detail_bottom.post.tpl

Thanks again guys. I haven't tried the new code you posted to modify the Social Buttons addon, but I did try straygecko's directions to add the AddThis code via the my_changes addon and hooks. Unfortunately, that didn't work - I am getting the following error:

"Smarty: Unable to load template tygh 'addons/my_changes/hooks/products/product_detail_bottom.pre.tpl' in 'blocks/product_templates/default_template.tpl' -->"

Any ideas?

Hmm, never mind - it seems to be working now. Not sure what happened, but after adding it back and clearing the cache, it's now working as expected.

Thanks again for all of your help guys!

... clearing the cache ...

Required when adding new .tpl hooks even if you have Rebuild cache automatically turned on. I have a bug report in for that.

Good to know - thanks again for all your help

Hi all... Trying to find the solution od CORRECT titles to product pages, I found this topic only. So please assist if possible...

Now the titles of products, if not specified directly, combined incorrectly as this CATEGORY :: SUBCAT :: PRODNAME, the correct order is reverse, PRODNAME :: SUBCAT :: CAT

Please post some changes I have to make, I gusee in index.tpl or where else, to force CS-Cart to generate correct titles...

Thanks.

kaavin, please check the answer here

The code changes will get wiped out with an upgrade. You can use a meta.tpl hook that will survive an upgrade. Create templates/addons/my_changes/hooks/index/meta.pre.tpl

{if $provider_meta_data.all.title}
    {$provider_meta_data.all.title = $page_title|default:$product.product scope=parent}
{/if}

Hi,

Thank you, I used your method and worked very well. Do you know how to force the shared image product to have height 292px?