Forums / Templates, Stylesheets, Page Layout / I want to add the AddThis bar to every page.

I want to add the AddThis bar to every page.

Started by turbofabsupply on 10 May 2009, 9:54 PM · Views: 9,449

Results 1 to 20 of 22
10 May 2009, 9:54 PM
#1
turbofabsupply avatar

turbofabsupply

New Zenner

Join Date:
May 2009
Posts:
12
Plugin Contributions:
0

I want to add the AddThis bar to every page.

I'd like to add the AddThis social networking bar to all my pages without copy->pasting it a million times. The side bar on the right that pops up when you add something using EZ pages and select sidebar I think would be a good location for the bar (if youre unfamiliar with AddThis its on my main page) How can I add HTML in that box?

TurboFabSupply.com - Turbo Accessories - T-Bolt Clamps, Silicone Hose, Intercoolers, and more!

10 May 2009, 10:07 PM
#2
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: I want to add the AddThis bar to every page.

You can add it to your tpl_footer.php and it will show on all your pages.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

10 May 2009, 10:20 PM
#3
turbofabsupply avatar

turbofabsupply

New Zenner

Join Date:
May 2009
Posts:
12
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

I did that for now but I dont think it quite emphasizes the feature as much as I'd like it too.

TurboFabSupply.com - Turbo Accessories - T-Bolt Clamps, Silicone Hose, Intercoolers, and more!

10 May 2009, 10:49 PM
#4
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: I want to add the AddThis bar to every page.

you can download this side box and insert the code.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

25 Jun 2009, 4:02 PM
#5
mnaeemsattar avatar

mnaeemsattar

New Zenner

Join Date:
Apr 2008
Posts:
19
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

There should be a way that we just add the code once for 'AddThis' and 'AddThis' button should be shown on each product page. Can anyone help? Suppose AddThis button code is as follows:

<!-- AddThis Button BEGIN -->

<a href="http://www.addthis.com/bookmark.php?v=250&pub=mnaeemsattar" onmouseover="return addthis_open(this, '', '\[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js?pub=mnaeemsattar"></script>

<!-- AddThis Button END -->

But where should I add this code that this button may display on each product/category page???

Muhammad Naeem Sattar
http://buy92.com
http://itgenes.com

10 Jul 2009, 1:55 AM
#6
roryg1 avatar

roryg1

New Zenner

Join Date:
Nov 2007
Posts:
34
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

I put it right in the tpl_product_info_display.php as shown. This shows the ShareThis code but it works with AddThis also. This places it below the Manufactuer's name but you can try it elsewhere in the template. I found this to be the most fluid. Now it shows on every product page.

<!--bof Product details list --> <?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?> <ul id="productDetailsList" class="floatingBox back"> <?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?> <?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li>' . TEXT_PRODUCT_WEIGHT . $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>' : '') . "\n"; ?> <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; ?> <?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?>

<br></br>

<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=a26bc676-6dfe-4e23-bfe1-5e25f6aa2dc7&type=website"></script> </ul> <br class="clearBoth" /> <?php } ?> <!--eof Product details list -->
19 Sep 2009, 1:20 PM
#7
ladiessymbol avatar

ladiessymbol

New Zenner

Join Date:
Nov 2008
Posts:
30
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

includes/templates/template_default/templates/tpl_product_info_display.php

24 Oct 2009, 7:53 AM
#8
cafman avatar

cafman

New Zenner

Join Date:
Jul 2009
Location:
Melbourne, Australia
Posts:
80
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

Wouldn't this javascript cause a problem with a 'Warning, insecure content' message popping up when viewing pages in Internet Explorer?

http://www.my-bookcafe.com
Note to self: whenever you so much as dot an i or cross a t in ZenCart, check how it looks in all browsers. Until then it is not safe to think all is well!!!!

24 Oct 2009, 12:28 PM
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: I want to add the AddThis bar to every page.

If you're going to put it inside the <ul> it needs to be a list item.```php

<?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?> <li> <script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=a26bc676-6dfe-4e23-bfe1-5e25f6aa2dc7&type=website"></script></li> </ul> <br class="clearBoth" /> <?php } ?> <!--eof Product details list --> ``` If you don't want it to be a list item, keep it outside the <ul>.```php <?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?> </ul>

<br></br>

<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=a26bc676-6dfe-4e23-bfe1-5e25f6aa2dc7&type=website"></script> <br class="clearBoth" /> <?php } ?> <!--eof Product details list --> ```

The product info page should not be a secure page, so why would IE throw a warning?

25 Oct 2009, 2:45 AM
#10
cafman avatar

cafman

New Zenner

Join Date:
Jul 2009
Location:
Melbourne, Australia
Posts:
80
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

gjh42:

The product info page should not be a secure page, so why would IE throw a warning?

Good point.

http://www.my-bookcafe.com
Note to self: whenever you so much as dot an i or cross a t in ZenCart, check how it looks in all browsers. Until then it is not safe to think all is well!!!!

29 Oct 2009, 9:01 PM
#11
jabbawest avatar

jabbawest

Zen Follower

Join Date:
Oct 2009
Location:
Texas
Posts:
197
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

With some trial and error of course, I found a position for the addthis bar.
I do need to have someone check out the placement of the code to make sure it won't become a security issue though.

includes/templates/MY_TEMPLATE/common/tpl_header.php

<!--bof-navigation display-->
<div id="navMainWrapper">

<div id="navMain">
    <ul class="forward">
<!-- AddThis Button BEGIN -->
<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&pub=xa-4ae9d99b20dd2b05"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4ae9d99b20dd2b05"></script>
<!-- AddThis Button END -->
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>
<?php if ($_SESSION['customer_id']) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li>
<?php

See it here:
http://sterlingleafjewelry.com/
When customers login, it will move to the left within the <ul class="forward">

It's been a few years since I've played with php, mostly php-nuke stuff. It sure is nice to be back.

Thanks,

Stephen

Fine Jewelry For Any Budget
Sterling Leaf Jewelry
Rolling in the Zen

14 Sep 2010, 4:57 PM
#12
nohart avatar

nohart

Zen Follower

Join Date:
Apr 2010
Posts:
133
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

Do you put the code anywhere on the page or does it need to be inside some tags such as <div id="share"> ? I am not sure where inside of tpl_header.php I should past the code.

Thank you

14 Sep 2010, 5:10 PM
#13
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: I want to add the AddThis bar to every page.

It can go most anywhere in the file, as long as it doesn't interrupt another element. Placement depends on where you want it to appear in the page flow.
If you put it inside a nav menu like the <ul> above, you need to wrap <li> tags around it. Putting a div or span (or li) around it with an id will allow you to style it independently in your stylesheet.

14 Sep 2010, 5:18 PM
#14
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: I want to add the AddThis bar to every page.

nohart:

Do you put the code anywhere on the page or does it need to be inside some tags such as <div id="share"> ? I am not sure where inside of tpl_header.php I should past the code.

Thank you
It depends on where you want it to display. If you want it in the footer, put it in includes/templates/template_default/templates/ tpl_footer.php

or try this here

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

14 Sep 2010, 7:24 PM
#15
nohart avatar

nohart

Zen Follower

Join Date:
Apr 2010
Posts:
133
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

Awesome thank you both for the help! Unfortunately no matter where I place the code it just shifts the page all around, so I don't know where it needs to be placed. I have tried probably over 10 times and I got close to where I wanted it but without shifting stuff all around...

14 Sep 2010, 10:44 PM
#17
nohart avatar

nohart

Zen Follower

Join Date:
Apr 2010
Posts:
133
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

Got it! Thank you countrycharm! I tried your link that puts the code on every page and got it to work. I couldn't get it to work on my home page in the header because it kept displacing elements and skewing the page. So making progress :-)

15 Sep 2010, 4:18 AM
#18
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: I want to add the AddThis bar to every page.

nohart:

Got it! Thank you countrycharm! I tried your link that puts the code on every page and got it to work. I couldn't get it to work on my home page in the header because it kept displacing elements and skewing the page. So making progress :-)
Thanks for the update.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

18 Oct 2010, 5:26 PM
#19
sjbglx avatar

sjbglx

New Zenner

Join Date:
Sep 2010
Posts:
70
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

Hi, Thank you for your inputs!
But I did everything as your instruction, there is still nothing shows up on my product page. what's wrong?

Thanks again!

18 Oct 2010, 5:47 PM
#20
sjbglx avatar

sjbglx

New Zenner

Join Date:
Sep 2010
Posts:
70
Plugin Contributions:
0

Re: I want to add the AddThis bar to every page.

I tried to modify the tpl_footer.php and that works, but can not get it works on every product page.