You are here:  » Decimalise filter


Decimalise filter

Submitted by sirmanu on Wed, 2020-04-08 11:34 in

Hi David.

Is any filter available that use the same function that formats the price?

I have a custom field "shipping" and each merchant format this field differently.
I think the easiest solution is to use the tapestry_decimalise which removes and format the numeric values correctly.

Some examples:

- DE::Standard delivery:0.00 EUR
- ES::DHL:25.00 EUR
- DHL:15.00

Submitted by support on Wed, 2020-04-08 11:44

Hi,

Sure - here's the code for a Decimalise filter to add to includes/filter.php...

  /*************************************************/
  /* decimalise */
  /*************************************************/
  $filter_names["decimalise"] = "Decimalise";
  function filter_decimaliseConfigure($filter_data)
  {
    print "<p>There are no additional configuration parameters for this filter.</p>";
  }
  function filter_decimaliseValidate($filter_data)
  {
  }
  function filter_decimaliseExec($filter_data,$text)
  {
    return tapestry_decimalise($text);
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by sirmanu on Tue, 2020-04-14 15:39

Thank you David, it is working as expected.