Author Topic: URL available in HTML block?  (Read 4662 times)

Offline jimcooncat

  • Newbie
  • *
  • Posts: 23
  • Karma: +3/-0
    • View Profile
URL available in HTML block?
« on: March 08, 2019, 10:14:54 PM »
I'd like to make a Facebook Share link on individual product pages, so visitors can share the product pages with their friends. Seems I could make a custom HTML block to show the link. Are there field codes available in the HTML editor that I can embed the current URL? Or another trick to accomplish something like the attachment here shows.


Offline llegrand

  • Hero Member
  • *****
  • Posts: 1798
  • Karma: +520/-7
    • View Profile
Re: URL available in HTML block?
« Reply #1 on: March 08, 2019, 11:10:04 PM »
Perhaps our free AddThis extension  would be easier for you
Here's the MarketPlace link

http://marketplace.abantecart.com/addthis?keyword=addthis&category_id=0
This is our manual of how it workds
https://abantecartextensions.com/docs/addthis

Offline jimcooncat

  • Newbie
  • *
  • Posts: 23
  • Karma: +3/-0
    • View Profile
Re: URL available in HTML block?
« Reply #2 on: March 09, 2019, 05:17:40 AM »
Thank you. It looks like an easy implementation, but I'm hoping for something even simpler and without oversharing to fourth parties.

Offline jimcooncat

  • Newbie
  • *
  • Posts: 23
  • Karma: +3/-0
    • View Profile
Re: URL available in HTML block?
« Reply #3 on: March 09, 2019, 05:45:12 AM »
Stumbled across this code for a Wordpress implementation. Would something similar work with AbanteCart? Are php variables accessible in this manner?

<a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>" title="<?php the_title(); ?>" target="_blank">Share on Facebook</a>

Offline jimcooncat

  • Newbie
  • *
  • Posts: 23
  • Karma: +3/-0
    • View Profile
Re: URL available in HTML block?
« Reply #4 on: March 09, 2019, 09:14:58 AM »
Found a solution, I think. Any drawbacks to this?

<a href="#" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),'facebook-share-dialog','width=626,height=436');return false;">Share on Facebook</a>

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5774
  • Karma: +274/-2
    • View Profile
Re: URL available in HTML block?
« Reply #5 on: March 11, 2019, 04:45:43 AM »
Stumbled across this code for a Wordpress implementation. Would something similar work with AbanteCart? Are php variables accessible in this manner?

<a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>" title="<?php the_title(); ?>" target="_blank">Share on Facebook</a>

PHP vars are not accessible in HTML.

 

Powered by SMFPacks Social Login Mod