Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Currencies.php and Change...


gdfwilliams

Recommended Posts

Using basic php math functions and a custom field in my product_description table, I can tell my customers that they're only paying $0.83 an issue for FHM (see example - still under development).

 

Rather than $0.83, I would prefer to display prices <$1 as "##UScentsign" (¢ in HTML).

 

I know that includes/classes/currencies.php is the file in question, but am not sure where to start.

 

Any thoughts?

 

Thanks,

 

GDW

Link to comment
Share on other sites

Hi Greg

this is partially tested:

      if ($calculate_currency_value) {

       $rate = ($currency_value) ? $currency_value : $this->currencies[$currency_type]['value'];

       if ($number<1){

         $format_string = '¢' . number_format($number*100, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']);

       } else {

         $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];

       }// if the selected currency is in the european euro-conversion and the default currency is euro, ....................

 

not 100% sure but HTH

ivan

Link to comment
Share on other sites

O.K. realized,..... that was not what you where looking for, since you where mentioning "includes/classes/currencies.php" I jumped on that file w/ out checking your example.

 

BTW may I receive a sample copy of the magazine you're displaying there? :D

 

I think you could do something directly in product_info.php adding an if statement after the <?php echo $products_price; ?>

It is interesting, I'll think about it.

 

ivan

Link to comment
Share on other sites

Ivan,

 

Thanks for your help. I tweaked your code a little and it's working great. Here's what I ended up using:

      if ($calculate_currency_value) {

       $rate = ($currency_value) ? $currency_value : $this->currencies[$currency_type]['value'];

     if ($number < '1') {

 $format_string =  number_format($number*100, '', '', '') . '¢'; 

 } else {

 $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; 

}

// if the selected currency is in the european euro-conversion and the default currency is euro,

// the currency will displayed in the national currency and euro currency

Thanks again. I appreciate your help.

 

http://www.magshack.com/product_info.php?p...roducts_id=2062

 

Greg

Link to comment
Share on other sites

Thats a cool mag site.

 

Q: How did you get the margin on the right and the background color for the left column. I've edited my stylesheet.css and my left columns background color is fine until the last box. then it stops.

I'd like it to go all the way to the bottom of the page like yours.

 

Thx

Special Effects / 3d + Flash

Link to comment
Share on other sites

Ramesh,

 

At the bottom of each catalog page there was a <br> tag (right before </body>) that threw the background off for me, too. Try removing them and see if that helps.

 

The background image for the left column is just that - a background image - defined for the whole page. Then, simply set the width of the left column so that things line up appropriately.

 

Good luck,

 

Greg

Link to comment
Share on other sites

Ivan,

 

Yes, I added two fields to the database - newstand price and # of issues. Then on the product_info.php page:

$percent1 = ( $product_info_values['products_newsstand'] - $product_info_values['products_price'] ) / $product_info_values['products_newsstand'];

$percent2 = round(($percent1 * 100),0);

$per_issue = $currencies->display_price(round(( $product_info_values['products_price']/$product_info_values['products_issues']),2), tep_get_tax_rate($product_info_values['products_tax_class_id']));

 

Thanks again,

 

Greg

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...