Post by rmeo » Fri Apr 16, 2010 10:32 pm

I am having trouble getting text anchors to work within a page.

When I click the beginning anchors it takes me back to the home page and adds a "/#" to the end of the URL.

Any ideas on why it is doing this and how I can fix it?


Thanks in advance

Ryan

Newbie

Posts

Joined
Wed Dec 16, 2009 12:47 am

Post by Qphoria » Fri Apr 16, 2010 11:05 pm

The controller system is likely trying to read the anchor as a file path. By default if a path isn't found, instead of showing an ugly 404 error, it hides the error and just redirects to the homepage. i'll see what is involved with preventing that

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by rmeo » Fri Apr 16, 2010 11:14 pm

Appreciate the help very much!

Look forward to some fixes that can be made.

Newbie

Posts

Joined
Wed Dec 16, 2009 12:47 am

Post by rph » Sat Apr 17, 2010 1:04 am

It's not the most desirable solution but you can get around it by hardcoding your links to something like:

Code: Select all

http://mystore.com/index.php?route=information/information&information_id=8#faq01
If you use SEO URLs it's a little easier:

Code: Select all

http://mystore.com/faq#faq01

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Xsecrets » Sat Apr 17, 2010 6:58 am

Qphoria wrote:The controller system is likely trying to read the anchor as a file path. By default if a path isn't found, instead of showing an ugly 404 error, it hides the error and just redirects to the homepage. i'll see what is involved with preventing that
actually this is really not a good idea, and quite a big problem with seo, and the crazy part is it only acts like that if you have seo urls turned on.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by vkaltchev » Tue Jun 29, 2010 1:06 pm

rmeo wrote:Appreciate the help very much!

Look forward to some fixes that can be made.
I have the same problem; the anchor is kicking me back to the homepage. Any resolution???
In an older post Qphoria mentioned that anchor is so 1999 - what can I replace it with when I have a long list of FAQ?

Thanks in advance.
Cheers,
Valentina

New member

Posts

Joined
Fri Apr 16, 2010 11:02 am

Post by Xsecrets » Tue Jun 29, 2010 7:58 pm

rph posted the solution a couple of post above.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by colevr » Thu Jul 08, 2010 9:45 pm

Yeah, this is a solution, but if you are talking about the "Terms and Conditions" page the things come a little more harder...In fact, if we use the friendly url system, it's possible to have anchors working, but in phase of order, if a client (before accept) click on "term and condition", here happens that the poor guy is redirected through the page linked and loose the possibility to go on with the buy. AS the terms and condition page is hosted in a popup window that don't use friendly-url....

At this point I don't know what to do...Any idea?

Newbie

Posts

Joined
Thu Jul 08, 2010 9:40 pm

Post by schmadam » Fri Jul 09, 2010 4:01 am

Isn't this a problem with the base href? i.e. the base href on the page is set to the site root so all relative links, including anchors, will start with that.

Here is a jQuery workaround if that's feasible - it worked for me:
http://www.cariboucms.com/blog/jquery-b ... nchors-fix

Newbie

Posts

Joined
Tue Jun 22, 2010 7:22 pm

Post by ThatBlokeRob » Mon Aug 09, 2010 8:08 am

schmadam wrote:Isn't this a problem with the base href? i.e. the base href on the page is set to the site root so all relative links, including anchors, will start with that.

Here is a jQuery workaround if that's feasible - it worked for me:
http://www.cariboucms.com/blog/jquery-b ... nchors-fix
Works perfectly! Thanks schmadam

Newbie

Posts

Joined
Mon Oct 12, 2009 6:07 pm

Post by mobi » Tue Oct 26, 2010 12:03 am

ThatBlokeRob wrote:
schmadam wrote:Isn't this a problem with the base href? i.e. the base href on the page is set to the site root so all relative links, including anchors, will start with that.

Here is a jQuery workaround if that's feasible - it worked for me:
http://www.cariboucms.com/blog/jquery-b ... nchors-fix
Works perfectly! Thanks schmadam

Hi there,

Any ideas where I can actually insert the script to make this work?
The source in the wysiwyg doesnt go as far up as header. (sorry bit of a newb)

Mobi

Newbie

Posts

Joined
Sun Sep 26, 2010 12:29 am

Post by will_c » Sun Jul 31, 2011 2:33 am

Hello all - just in case anyone else is still struggling with this - I think I've figured it out!

All you need to do is create the anchor as normal for the part of the page you wish to reference and then choose link to URL when you are creating the hyperlink to the anchor, and not link to Anchor.

When you type the URL in just add #anchorname at the end and it seems to work.

Hope this helps someone else.

I'm using vs 1.5.1.

Newbie

Posts

Joined
Sun Jul 31, 2011 2:29 am

Post by funt » Mon Aug 15, 2011 2:01 pm

Dear Will_c,

well done!

that does the trick for me in the info pages as well. No hassle with javascripting....

Thanx.
John

User avatar
New member

Posts

Joined
Thu Feb 03, 2011 10:23 pm

Post by funt » Fri Sep 02, 2011 4:44 am

What also works is the following. If you have a page called Frequently Asked Questions and you have this page called in seo FAQ you can point to just FAQ.

In other words. Create an anchor called Anwer1. Create a link (not internal link) for example on Question1, use protocol <other> (not http://) and you just can use url: FAQ#Answer1.

You don't have to type all the url.

User avatar
New member

Posts

Joined
Thu Feb 03, 2011 10:23 pm

Post by ukdazza » Wed Mar 21, 2012 8:13 pm

funt wrote:What also works is the following. If you have a page called Frequently Asked Questions and you have this page called in seo FAQ you can point to just FAQ.

In other words. Create an anchor called Anwer1. Create a link (not internal link) for example on Question1, use protocol <other> (not http://) and you just can use url: FAQ#Answer1.

You don't have to type all the url.
Spot on.

Newbie

Posts

Joined
Mon Mar 19, 2012 10:01 pm
Who is online

Users browsing this forum: No registered users and 93 guests