View Issue Details

IDProjectCategoryView StatusLast Update
0003267OXID eShop (all versions)1.04. Content, static (register, contact etc.) pagespublic2012-01-24 09:24
Reportertjungcl 
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.5.2 revision 38481 
Target VersionFixed in Version4.6.0_beta3 
Summary0003267: onpage anchors (#) not working
DescriptionWhen you use onpage anchors in CMS pages, they point to the shop-root directory instead of the current directory.

See the attached screenshot, where I did the following:

- edit the agb cms so that "3." is linked with href="#test"
- add a div with name="test" so there is something to jump to when successfull
- in the agb page now mouse-over the new link: in the statusbar you already see, that the target of the link know is ".../enterprise-edition/#test" although it should be ".../enterprise-edition/agb/#test".
- click the link and you are loading the start-page

I tested with and without Javascript in Chrome, FF77 and IE8.

I have no clue, what goes wrong here. Its quite absurd...
TagsNo tags attached.
ThemeBoth
BrowserAll
PHP Versionany
Database Versionany

Activities

tjungcl

2011-09-22 15:39

reporter  

anchor.png (38,215 bytes)
anchor.png (38,215 bytes)

tjungcl

2011-09-22 15:53

reporter   ~0005259

little mistake in the description:
instead of the 'div name="test"' it should be an 'a name="test"'

the problem stays the same, though

tjungcl

2011-10-28 08:41

reporter   ~0005347

could somebody please look into this?

I also tried the more common structure:
a href="#test"
...
div id="test"

Its always the same: the link will open www.shoproot.com/#test instead of www.shoproot.com/contentpage/#test

This IS reproducable in the demoshop, so its not a faulty server configuration.

leofonic

2011-10-31 18:16

reporter   ~0005353

This is because of base href: http://www.ninthavenue.com.au/blog/using-base-href-with-anchors

tjungcl

2011-11-07 14:35

reporter   ~0005371

Last edited: 2011-11-07 14:59

View 3 revisions

thanks for the hint!
I read the comments there and added my own suggestion on the bottom:

$("a[href^='\#'][href!='\#']").each(
    function (i,e){
        var href = $(e).attr("href");
        if ($(href).length || $("a[name='" + href.substring(1) + "']").length)
            $(e).attr("href", $(location).attr("href").split("#",1)[0] + href);
    }
);


But I still hope, this will not be neccessary much longer. The base href usage seems to be not the best way to have...

rimvydas_paskevicius

2012-01-24 09:24

reporter   ~0005633

Removed <base href="[{ $oViewConf->getBaseDir() }]"> as it is not needed now, so need to do some javascript workarounds.