Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I put My Account at the end of the breadcrumb trail?


Guest

Recommended Posts

Hello!  I am using 2.3.4.1 CE

I would like to have the My Account link always appear at the end of the breadcrumb.

I see some code at the bottom of includes/application_top.php where I have added the My Account link:

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link('index.php'));
$breadcrumb->add(HEADER_TITLE_MY_ACCOUNT, tep_href_link('account.php'));

So my breadcrumb now looks like this:

breadcrumb.thumb.PNG.368df4757c5e4f4510a460bda9eee075.PNG

How do I get My Account to always appear on the other end circled in blue, where it doesn't interfere with the breadcrumb being generated when browsing?

Thanks!

- Andrea

 

Link to comment
Share on other sites

Sorry but that's not a good idea, I know you probably don't whant to hear that, but the breadcrumb is used for a specific use and should not be adulterated by adding code like that.

Breadcrumb is a header module so if you need my account at the end simply make a copy of breadcrumb and add it as a second module with the my account  code only in it. Then

simply put both on the same line on index by adjusting the width of both something like 8/4 or something then you will get what you need without interfering with breadcrumb.

I hope that makes sense.

 

Link to comment
Share on other sites

the breadcrumb is an ordered list, it outputs like

<ol class="breadcrumb">

<li>...</li>

<li>...</li>

</ol>

Your myaccount link is a <li> in the list, and looks like <li><a href="myaccount"></li>. The problem is to float that link right, you will have to introduce code or CSS to target just that one <li> in the list.

So the question is does it have to be in the breadcrumb trail, or can it be above or below it, because that will be easy to achieve.

 

 

 

Link to comment
Share on other sites

There's no problem per se with "My Account" being on the far end of the line; it won't be confused with the breadcrumb on normal width screens. You want to watch out for phones and other narrow screens where the breadcrumb list might "run into" the "My Account" link, and confuse users. If you're using a responsive theme, you may want to steer clear of putting "My Account" on the same line, and accept having it on a new line. Or, make sure  that there is an adequate gap between the two, forcing a new line if necessary (and right-justified on "My Account"). This might be done by confining the breadcrumb to a column of maximum width, with an empty column for a gap, and "My Account" in its own column.

Link to comment
Share on other sites

7 hours ago, puggybelle said:

How do I get My Account to always appear on the other end circled in blue, where it doesn't interfere with the breadcrumb being generated when browsing?

CE is moduler so why not make use of that?

image.thumb.png.b91629a0a5c643d5a77c9c3dbe83c491.png

 

Link to comment
Share on other sites

3 hours ago, JcMagpie said:

CE is moduler so why not make use of that?

I was able to duplicate the module but I'm having trouble getting My Account to appear in the new breadcrumb module on the right, like in your screenshot above.

The code for the template file is like this:

<div class="col-sm-<?php echo $content_width; ?> cm-header-breadcrumb breadcrumbs">
 <?php echo $breadcrumb->trail(' &raquo; '); ?>
 </div>

I'm sure this is stuff you can do in your sleep, but I'm having great difficulty replacing that second line of code with any kind of reference to account.php

Everything I have tried either results in the white screen of death or the My Account link appearing outside the module.  Or...my code attempts spilling out onscreen where the new box should be.  Very stuck now!

Your help would be greatly appreciated!

- Andrea

Link to comment
Share on other sites

Well, I'm happy to report that I did duplicate the module correctly the first time...yay!...just got stuck on how to edit the template file.

I applied your code in the new template file and it works great!  Just one issue I need to sort out.

I'm trying to figure out how to apply a statement that controls what link appears in the module...either My Account or Log Off

I think having a Log Off link is necessary and, theoretically, that should replace the My Account link after a customer has logged in.

When they log off, My Account should reappear. 

I've messed around with some 'else' statements but all of my code just bleeds onto the screen.  I need something like:

if ( tep_session_is_registered('customer_id') ) {

then Log Off appears in the module, otherwise

My Account appears instead

You get the idea.  At the moment, all I can come up with is both links in the module, like this:

breadcrumb2.thumb.PNG.e54d1aa46d1f77c365fc799a42f09a8b.PNG

Which looks dumb if you're not logged in.  Funny enough, the Log Off link works whether you're logged in or not, but...it's not good having them both there.

Can you help me with that?  Thank You!

- Andrea

Link to comment
Share on other sites

This is what I tried...

<div class="col-sm-<?php echo $content_width; ?> cm-header-breadcrumb2">
        <ol class="breadcrumb" id=abc>
            if ( tep_session_is_registered('customer_id') ) { 
            <li><a href="logoff.php">Log Off</a></li>
            } else { 
            <li><a href="account.php">My Account</a></li></ol>}
</div>

And this is what I get...

bread4.thumb.PNG.9c7418f46049b795c5a886a5b6fe3e59.PNG

Now you know what I mean about code bleeding on the screen. 

???

- Andrea

Link to comment
Share on other sites

@puggybelle

You're mixing HTML and PHP. Try *something* like this:

<div class="col-sm-<?php echo $content_width; ?> cm-header-breadcrumb2">
  <ol class="breadcrumb" id=abc>
    <?php
      if ( tep_session_is_registered('customer_id') ) { 
        echo '<li><a href="logoff.php">Log Off</a></li>' ;
      } else { 
        echo '<li><a href="account.php">My Account</a></li>' ;
      }
    ?>
  </ol>
</div>
Link to comment
Share on other sites

Another way:

<div class="col-sm-<?php echo $content_width; ?> cm-header-breadcrumb2">
        <ol class="breadcrumb" id=abc>
            <?php if ( tep_session_is_registered('customer_id') ) { ?>
            <li><a href="logoff.php">Log Off</a></li>
            <?php } else { ?>
            <li><a href="account.php">My Account</a></li>
            <?php } ?>
        </ol>
</div>

I don't like jumping into and out of PHP any more than shown here. Any more than that, I prefer to stay all in PHP in @ArtcoInc 's style.

By the way, I'm a little puzzled by your logic. Isn't "My Account" meant for someone who is currently logged in? If so, wouldn't you want to show both Logoff and My Account for them? If it's a guest, you could show Logon instead.

Link to comment
Share on other sites

@MrPhil and Malcolm (your username won't come up when trying to insert it...?)

Both of your solutions work.  Thank You so much!

1 hour ago, MrPhil said:

By the way, I'm a little puzzled by your logic. Isn't "My Account" meant for someone who is currently logged in? If so, wouldn't you want to show both Logoff and My Account for them? If it's a guest, you could show Logon instead.

I understand your point.  I guess I'm trying to figure out a way to address all users, without turning off those who don't want to create an account.

I have Purchase Without Account installed, so the idea of having Log On or Log In seems to imply you need an account.  Don't want that.

At the same time, if the link changes from My Account to Log Off...that kills the logged in users' avenue to view their account.

The goal here is to get rid of the navigation bar and/or the Buttons module which have links for My Account.  Free up some space in my header.

I suppose the ideal solution would be to have My Account...buyer clicks and logs in...and now the module shows My Account | Log Off links.

Then they log off and we're back to displaying My Account only.

Do you know how to accomplish that?  I can play with HTML code, but this PHP code is...difficult.  For me!

- Andrea

 

Link to comment
Share on other sites

I don't think it's a good idea to have "My Account" serving two different functions. That's confusing to users. Most sites show two buttons or links to guests: Log In and Register (Create Account). Once you're logged in, members are shown Log Off and perhaps a My Account (account maintenance, such as changing a password, or checking order status). To show only "My Account" to a guest would be confusing if they're looking for a place to log in, or to register. I think the setup I suggested is standard enough that almost everyone should understand that an account is optional. You can improve matters by having a title="explanation" attribute on the links or buttons, to explain what they're for when a guest hovers the mouse over them. You can tell them that logging in (already registered) or registering an account is optional. If you already have a "My Cart" button or link, you can put "Check Out" next to it (grayed-out/inactivated if the cart is empty), which should be a hint that an account is not necessary.

Some sort of PWA is quite popular (and discussed elsewhere on this forum a number of times), so it's understandable that you want to be clear that an account is unnecessary. However, I would stay with industry-standard practices on layout, function, and nomenclature, to keep confusion to a minimum.

Link to comment
Share on other sites

Any type designer who fails to make I (EYE), l (el), 1 (one), and | (vbar) clearly distinct should be flogged to death. I've wasted quite enough of my life misreading text and puzzling out bizarre text, thank you. Site owners need to do their part to choose readable fonts, and avoid sans-serif fonts in general. https://www.catskilltech.com/forum/typography-and-typesetting/crimes-against-readers-bad-typography/ for my thoughts on the subject.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...