LiteCommerce module: custom currency symbol

beatnbite edited this page Sep 9, 2011 · 3 revisions
Clone this wiki locally

Right now LiteCommerce uses currency codes as currency symbols when displaying prices in the store front. Later there will be a back-end function to manage currency symbols, but for now you can specify you custom currency symbols as follows:

The easiest way is to alter the currency symbol in the database:

UPDATE xlite_currencies SET symbol = '$' WHERE code = 'AUD';

This will work and will likely be compatible with future LiteCommerce updates.

Another solution is developing a custom module that replaces the symbol:

  1. Create a blank LiteCommerce module beneath the directory where your shop is installed.

  2. Create the "classes/XLite/Module/<your developer ID>/<your module ID>/Model/Currency.php" file. Edit it as follows:

     <?php
    
     namespace XLite\Module\<your developer ID>\<your module ID>\Model;
    
     /**
      * Currency
      *
      * @since 1.0.7
      */
     class Currency extends \XLite\Model\Currency implements \XLite\Base\IDecorator
     {
     
         /**
          * Return the currency symbol
          *
          * @return string
          */
         public function getSymbol()
         {
             return ($this->getCode() == 'AUD') ? '$' : parent::getSymbol();
         }
     }
    
  3. Re-build the LiteCommerce classes cache (the shop back-end -> "Maintenance" tab -> "Re-Build cache" page) to get the new module listed among other modules on the "Manage add-ons" page (the shop back-end -> "Add-ons" tab -> "Manage add-ons" page). Enable the module on this page (this will re-build the cache once again).