Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6794669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:15:00+00:00 2026-05-26T18:15:00+00:00

I am working with an existing bespoke ecommerce platform which until recently had no

  • 0

I am working with an existing bespoke ecommerce platform which until recently had no requirement to manipulate the price which is stored with a product in the database (other than multiply by quantity etc). I’ve now been tasked with building the functionality which will allow these prices to be viewed with or without VAT, with customisable currency based on a site wide setting or per user with regard to both exchange rate and currency symbol. The theory behind the settings/per user/locale etc is not the problem, it’s the best way to change all of the pricing across the whole site.

A bit of background

  • Output is buffered so I have access to the entire output before it’s sent to the browser in $output
  • There’s no existing abstraction on the pricing.
  • There are places in the templates which have the price without the symbol in the format 0.00 (for JavaScript based calculations) as well as ones with the symbol in the format £0.00
  • Things like adding/removing from the basket are completed with Ajax and the new price returned in JSON format
  • Some pricing variables are buried in large multidimensional arrays which are constructed in the core/application classes. Some of which are used for further calculations both within the core/application classes in the templates.

Options I’ve considered

  • Suffer the performance hit and preg_replace_callback('/&pound;(?:<.*>|\s*)?(\d*\.\d\d)/i'...); on $output. This however doesn’t resolve the problem for prices not with the £ in front as mentioned above. It also is no use when prices are returned using Ajax.
  • Go through every template file, every module class, every core class, every helper and every bit of JavaScript and leave the output as it is at present and duplicate whatever array key/object var is generated but suffix it with _formatted or similar and output that where necessary in the template. I’d also have to have a _calculated suffix too. So I’d have 10.00, 8.00, and £8.00 values for 10, 10*0.8 (vat) and £10*0.8 respectively.
  • Go through all of the above mentioned files/sections/classes bar the templates and keep the single output but precalculated ready for templates so that I don’t need to go through every template file.

The first option can’t really work unfortunately for the reasons described above so Options 2, 3 and any you might suggest are on the cards I suppose. Unfortunately there’s only 2 weeks scheduled in for the entire process (loads of other unmentioned but technically unrelated) functionality to go in) and the above options, given the size of the application will probably take me about a week.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:15:01+00:00Added an answer on May 26, 2026 at 6:15 pm

    How are those prices retrieved? You have no pricing abstraction, but you may have a DB abstraction. Maybe you can manipulate the prices on the query or right after it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an existing XML document which has a structure (in part) like
I have been working with an existing website out company has running until I
I'm working on an upgrade for an existing database that was designed without any
I am working with an existing ASP.NET/C# website that has a new requirement: when
I am working with an existing architecture which populates fields on a form with
I'm working with an existing SQL 2005 database that was not implemented with FK
I am working an existing project which is base do Excel class to copy
I'm working on an existing Xcode 3.2.2 Universal iPhone OS project which is already
i'm working with an existing client-side legacy database that we're converting to MySQL for
I'm working with an existing SQL Server database, with a table column defined as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.