Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Navigation Bar - Change Model to Product Name???


6DV8

Recommended Posts

The navigation bar is showing the model and not the product name when looking at products in a category. Can I change this???

Example of what I would like:

Top>>Catalog>>Cleaning Products>>Dishwashing Detergent

 

Example of what it is like at the moment:

Top>>Catalog>>Cleaning Products>>DD00025

Link to comment
Share on other sites

Hi Ken,

 

You'll have to change catalog/includes/header.php here:

 

  if ($HTTP_GET_VARS['products_id']) {

   $model = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "'");

   $model_values = tep_db_fetch_array($model);

   echo ' » <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL') . '" class="headerNavigation">' . $model_values['products_model'] . '</a>';

 }

 

to

 

  if ($HTTP_GET_VARS['products_id']) {

   $model = tep_db_query("select products_name from " . TABLE_PRODUCTS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "'");

   $model_values = tep_db_fetch_array($model);

   echo ' » <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL') . '" class="headerNavigation">' . $model_values['products_name'] . '</a>';

 }

I haven't tested it, so backup your files and try it.

I'm not sure what:

    $model_values = tep_db_fetch_array($model);

does. The rest should work - I think :wink:

Best Regards

olby

Link to comment
Share on other sites

Olby,

I found this in application_top.php - am I getting close???:

 

if ($HTTP_GET_VARS['products_id']) {

$model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "'");

$model = tep_db_fetch_array($model_query);

$breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));

 

I don't think so Huh![/code]

Link to comment
Share on other sites

Hi Ken.

 

Sorry about that - I'm on a snapshort from august.

Your'e allmost there, you only have to change the filename, so it looks like this:

// products_model changed to products_name 11.11.02 olby

 if ($HTTP_GET_VARS['products_id']) {

   $model_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "'");

   $model = tep_db_fetch_array($model_query);

   $breadcrumb->add($model['products_name'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));

 }

Best Regards

olby

Link to comment
Share on other sites

Gee thanks so much

It really works a treat. Was worth the hunt just to see it in action.

:lol:

 

:roll: Do you think you could help me with inserting a "back button". If you click on a category then click on a product to have a closer look - you only have two choices to navigate from there. Reviews or In Cart. I'd like to slip in a little "back" or "continue" button to take the customer exactly back to where they left the last page. Even if it was scrolled half way or down to the bottom. It makes sense that once you've taken a look and it might not be for you that you "continue" where you left off.

Thanks so much already

Ken

Link to comment
Share on other sites

Hi Ken.

 

Really - do you want me to make all the work for you :sneaky:

 

But since you've changed my title :blush: I'll do it:

 

Put this javascript into the <HEAD> section of catalog/products_info.php:

<script LANGUAGE="JavaScript">

<!-- hide this script tag's contents from old browsers

function goHist(a)

{history.go(a);}  // Go back one.

//<!-- done hiding from old browsers -->

</script>

 

find this code:

<td class="main"><a href="<?php echo tep_href_link(FILENAME_PRODUCT_REVIEWS, substr(tep_get_all_get_params(), 0, -1)); ?>"><?php echo tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS); ?></a></td>

<td align="right" class="main"><input type="hidden" name="products_id" value="<?php echo $product_info_values['products_id']; ?>"><?php echo tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

 

and insert this line in the middle (between the 2 lines):

<td align="right" class="main"><input type="button" name="back_one_page" value="Back" onClick="goHist(-1)"></td>

 

It won't give you the right Back-button, but study the input function, and you might come up with something that works and looks right.

This one works.

Best Regards

olby

Link to comment
Share on other sites

I will study the input function yes; The code looks like this now-

<td class="main"><a href="<?php echo tep_href_link(FILENAME_PRODUCT_REVIEWS, substr(tep_get_all_get_params(), 0, -1)); ?>"><?php echo tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS); ?></a></td>

<td align="right" class="main"><input type="button" name="back_one_page" value="Back" onClick="goHist(-1)"></td> <td align="right" class="main"><input type="hidden" name="products_id" value="<?php echo $product_info_values['products_id']; ?>"><?php echo tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);

 

Should I change the:type="button" name="back_one_page"

To:

<?php echo tep_image_button('button_back.gif', IMAGE_BUTTON_BACK); ?></a>

 

I have a Back button image already - will this replace the button I now have with my image.

 

And by the way :oops: I don't want you to do all the work for me - I try to do as much as I can with only 3 weeks of code writing experience under my belt -Your help has been invaluable - Thank you.

:oops: :oops: :oops: :oops: Did I change your title? Sorry - not sure how I did that or What you mean?

 

I think your title is "OLBY" - Is this right?

Very Kinf Regards

Ken

Link to comment
Share on other sites

Hi Ken.

Just kidding :lol: :

As for my title, you called my olby the Great - therefore the java-solution.

 

I've tried to replace the type="button" with tep_image.... but that results in a add to shopping_cart call - not back one page.

So as for now I can't find out how to replace the dull grey button with the language button_back.gif image.

 

I'm sure it can be done, but I can't get it to work - for now.

Best Regards

olby

Link to comment
Share on other sites

Hey Olby,

Thank you so much for everything you've done to help me. Maybe someone will read this thread and know more about this "dull grey back" button issue - there must be a way around this you think?

 

How's this new title. :lol: :lol: :lol: :lol:

 

Thanks mate!

 

Regards Ken

(I had to change my title - could not log in with 6DV8)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...