AbanteCart Community

eCommerce construction => How-to questions => Topic started by: jimcooncat on March 08, 2019, 10:14:54 PM

Title: URL available in HTML block?
Post by: jimcooncat 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.

Title: Re: URL available in HTML block?
Post by: llegrand 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 (http://marketplace.abantecart.com/addthis?keyword=addthis&category_id=0)
This is our manual of how it workds
https://abantecartextensions.com/docs/addthis (https://abantecartextensions.com/docs/addthis)
Title: Re: URL available in HTML block?
Post by: jimcooncat 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.
Title: Re: URL available in HTML block?
Post by: jimcooncat 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>
Title: Re: URL available in HTML block?
Post by: jimcooncat 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>
Title: Re: URL available in HTML block?
Post by: Basara 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.