Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How remove the numbers next to Bestsellers?


JoeWoodworker

Recommended Posts

Posted

I looked through the code in boxes/bestsellers.php but I can't seem to find the line the would remove the number in front of each item displayed.

 

Any ideas?

 

Thank you to all who have helped me so much today!

Evil will always triumph over good...

Because good is dumb.

- D.H.

Posted

Go into catalog/includes/boxes/best_sellers.php

 

And comment out part of line 37: (at least it is in my file)

 

Change this:

 

'text' => tep_row_number_format($rows) . '. <a href="' .

 

To this.

 

'text' => /*tep_row_number_format($rows) . */ ' <a href="' .

 

You will notice that /* */ is my comment tags. Be sure to leave the single quote before   and you will need delete a period between the two. You can just delete the code between the comment tags if you want, but I don't like to delete.

Steve

-------------------------

Posted

Joe;

 

Look at line 37 in catalog/includes/boxes/best_sellers.php

'text'  => tep_row_number_format($rows) . '. 

Changing that first section to (for example):

'text'  => '> 

Would give you a > in front of the name of the item

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Posted

Ya beat me to it, Steve...

Must be time for bed :shock:

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

  • 2 months later...
Posted

I know it's an old thread, but it nearly contains the answer to my question:

 

How do I change the numbers from 01, 02 etc to 1 and 2

 

ie. remove the 0 before the number.

 

 

I presume it is there for sorting reasons (when you get to 10) but I only plan to show 5 Bestsellers in my listing.

 

thanks

 

Jen

I haven't lost my mind - I have it backed up on disk somewhere.

Posted

I would try and find this function that fomats the variable and see if you can modify it. But, it may be a built in PHP function that does the 01,02 thing. In that case you would have to write a strip function to strip the zero.

 

tep_row_number_format($rows)

 

Just an Idea.

Steve

-------------------------

Posted

In /includes/functions/general.php is the function Steve referred to:

  function tep_row_number_format($number) {

   if ( ($number < 10) && (substr($number, 0, 1) != '0') ) $number = '0' . $number;



   return $number;

 }

 

Remove the function from the bestsellers box and just use the number.

Posted

I just thought of a problem with my above logic, if you modify the tep_row_number_format function, it is going to effect other files too.

 

But here is the solution you asked for. Go to /includes/function/general.php and find this section of code.

  function tep_row_number_format($number) {

   if ( ($number < 10) && (substr($number, 0, 1) != '0') ) $number = '0' . $number;



   return $number;

 }

And just delete the 0, (the zero and the comma after it). And make sure there is only one space between the first comma and the one. And that's it.

 

I.E.

(substr($number, 1) != '0')

Steve

-------------------------

Posted
In /includes/functions/general.php is the function Steve referred to:

  function tep_row_number_format($number) {

   if ( ($number < 10) && (substr($number, 0, 1) != '0') ) $number = '0' . $number;



   return $number;

 }

 

Remove the function from the bestsellers box and just use the number.

 

OK, Linda!!!!

Quit typing so fast. :D :D

My solution is better!!!! :wink:

Steve

-------------------------

Posted

Unless of course you ever want that function for the 0 padding ... 8)

Posted
I just thought of a problem with my above logic, if you modify the tep_row_number_format function, it is going to effect other files too.

 

But here is the solution you asked for. Go to /includes/function/general.php and find this section of code.

  function tep_row_number_format($number) {

   if ( ($number < 10) && (substr($number, 0, 1) != '0') ) $number = '0' . $number;



   return $number;

 }

And just delete the 0, (the zero and the comma after it). And make sure there is only one space between the first comma and the one. And that's it.

 

I.E.

(substr($number, 1) != '0')

 

The only other file this edit going to effect is the Address Book and I has a 5 entry limit anyway so it isn't going to matter.

Steve

-------------------------

Posted

Thought I had posted that modification before ... glad it worked for you.

 

Steve's method was a good quick fix also ... I just cannot think off hand where else that function is used, but I hate to lose the purpose of a function for one fix only to need it back for another.

Posted
Thought I had posted that modification before ... glad it worked for you.

 

Steve's method was a good quick fix also ... I just cannot think off hand where else that function is used, but I hate to lose the purpose of a function for one fix only to need it back for another.

 

Linda,

 

The only other place the function shown, in my search, is Address Book. Unless the team has added it somewhere else.

Steve

-------------------------

Posted

That was all I have found too.

 

But ... do we want to lose this function's purpose?

 

Or, modify the Bestsellers box?

 

That was my main concern. Being that the only reason there are the padded 0s in the box is because Bestsellers box uses the function so toss the function out of the box and the 0s are gone but the function can live another day ... :D

Archived

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

×
×
  • Create New...