osHelpers - Help for your osCommerce store
 
Google Base Feed Germany
iFrame Defender v1.2
oscommerce Seo
  Seo Pack 2
  SE Friendly URLs
  Session ID Removal
  Title and Meta Tags
  Google Sitemap
Magnum Shopping Cart
  Magnum MVS 8.4 Basic
osCommerce Services
  osc / cre patch
  Data Entry
  Data Extraction
  bugs and fixing
  Site Transfer
  creloaded Transfer
  Design Special
  Hosting
osCommerce Templates
osCommerce Contributions
  Credit Modules
  Features
  Images
  InfoBoxes
  Languages
  Order Total Modules
  Other
  Payment Modules
  Reports
  Shipping Modules
  Templates/Themes
  Zones
osCommerce Articles
osCommerce Tutorials
  Installing osCommerce
  Configuring your store
  Adding categories
  Adding products
  Adding product attributes
  Configuring currency
  Adding payment modules
  Adding shipping modules
  Configuring sales tax
  Editing your home page
  Editing columns
  Editing header and footer
  Creating specials
  Managing customers
  Sending out a newsletter
  Sending out email
  Managing your banners
  Backup database
CRELoaded Tutorials
  Add Administrators
  Add Article Author
  Additional Images
  Create a New Page
  Define Mainpage
  Disable cc Encryption
  Disable Company Field
  Disable Country
  Disable Date of Birth
  Display broken images
  Easypopulate Export
  Email confirmation
  Insert Faq
  Max Package Weight
  Require Terms of Use
  Affiliate Newsletter
  Enable Cache
CB Power Affiliate
Tell A Friend
 

Tell someone you know about this product.

   OSHELPERS | OSCOMMERCE CONTRIBUTIONS | FEATURES | 1551   


oscommerce GetNumericValueofaCurrencyPrice
[1551]
 
 
box_bg_l.gif.
"Working with multiple currencies is great, until you need to do things with the actual numbers like add/subtract/multiply. Then you're in trouble, because the prices are generally stored in variables as "$14.99" and "14.99EUR" -- with the symbol INCLUDED, which prevents math operations. If you're only using one currency, you can simply use the database value for price, but you can't do this if you plan on using more than one currency.

Because of this, I added a new function to the currencies class: get_numeric_value(). With this, you can pass any formatted currency string to the function and it will return just the number--no matter what currency is being used! So if a customer is browsing with dollars as her currency, the string "$14.99" will pop back as "14.99", ready to be used for math. (Useful if you need math to calculate "you save xx percent" and such.) And another customer browsing the same item for "11.99EUR" will have the script pop back "11.99". Cool.

Two files need to be altered to enable this new $currencies method:

catalog/includes/classes/currencies.php
catalog/admin/includes/classes/currencies.php

The good part is you can make this modification, and never even use it, and it won't affect you at all; it's just an optional new function you can call.

Difficulty: unbelievably easy"

 


For more information, visit the official osCommerce contribution webpage.
box_bg_r.gif.
 

osHelpers

osHelpers