AbanteCart Community

AbanteCart Development => Customization help => Topic started by: iron on May 10, 2016, 10:46:51 AM

Title: How to insert anchor link?
Post by: iron on May 10, 2016, 10:46:51 AM
Hello guys! I didn't find nothing about my problem here on this forum.

I'm trying to put anchor link on a Product page. Doing it as usual (Pic.1, Pic. 2). Saving the file.
In HTML/Text mode all tags are on their places. In Visual mode everything seems OK, but in Link menu the anchor not saved (Pic. 3). And on storefront page, if move mouse on link in list, link seems workable (Pic. 4), but click on any link opens the main page.
Absolutely have no idea how to fix it.
Title: Re: How to insert anchor link?
Post by: Basara on May 11, 2016, 05:21:43 AM
Hi.

To fix anchors your need to put full url in your href or add this code to the product pages
Code: [Select]
<script type="text/javascript">
jQuery(document).ready(function() {
    jQuery("a[ href ^= '#' ]").each(function() {
        var href = window.location + jQuery(this).attr('href').replace('/#.*/i','');
        jQuery(this).attr('href',href);
    });
});
</script>

It is very easy to add code via HTML block http://docs.abantecart.com/pages/design/blocks/html_block.html
Create HTML block with this code and add it to the Product page layout
Title: Re: How to insert anchor link?
Post by: iron on May 11, 2016, 12:36:27 PM
Thank you Basara! Block work great!