Forums / Developer / Set up a shop with only integer prices

Set up a shop with only integer prices

Author Message

Adi Rotea

Friday 01 August 2003 8:20:41 am

I need to set up a shop with only integer prices.

My first thought was to use the currency formatting. The first problem was that my price_inc_vat needs to be rounded to become an integer and the currency format only skipped my decimals. Then the shopping basket calculations uses the float prices so my problem is not the way i display the price according with the currency format but the price datatype itself...

So i've created a new datatype called "ezintprice".
OK...
The probleam seemed solved...

WRONG!!!!

When I've added the discount rules my basket looked ok but the order confirmation contained the float calculated price...
So i've looked throught sources an I've seen that are many scripts that i have to alter... (and i don't want that because seems wrong)....

PLEASE ... someoane HELP ME because now it is so much chaos around me and i don't even know where to start anymore....

So my question is:

What should I do to have a shop with only integer prices .....where should i start to make all the things correctly...should i create a new datatype?.. should I extend the shop functionality? If so how?.

Any help would be very appreciated.

Thanx

Esben Maaløe

Saturday 02 August 2003 4:20:05 am

So what do you want to do ?

If a basket amounts to 25 MONEY and you want to give a 10% (2.50 MONEY) discount what should the price end up like ? 22 MONEY or 23 MONEY ?

Is it possible to setup a FloorThePrice discount rule ? So that your basket may look like this:

Item1 10.00 MONEY
Item2 7.00 MONEY
Item1 8.00 MONEY
==============
Total 25.00 MONEY
Discount -2.50 MONEY
FloorThePrice -0.50 MONEY
====================
Price 22.00 MONEY

???

Adi Rotea

Tuesday 12 August 2003 6:25:50 am

First of all I'm sorry for the delay....

To be more exact I want a shop where all the prices and calculations (price with or without VAT, discounts etc) to be integer numbers...

In my case i have a 19% VAT and my input prices are excluding VAT (meaning that I input the integer price without VAT) and I expect the system to generate the price inclunding VAT as an integer number (or the other way to input the integer price with VAT ant to let the system to generate the price without VAT which i think is a better approach as the price includig VAT is used for the total calculations and the price without VAT is, in my case, only informational)...

Also when I apply a dicount rule i want the discounted price to be an integer number as well...

And the integer number (price) to be the round( double calculated price )

How can i do that using only templates or with minimum of code involved ?

eZ debug

Timing: Jan 18 2025 14:57:43
Script start
Timing: Jan 18 2025 14:57:43
Module start 'content'
Timing: Jan 18 2025 14:57:43
Module end 'content'
Timing: Jan 18 2025 14:57:44
Script end

Main resources:

Total runtime0.8183 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0074 587.8203180.8281
Module start 'content' 0.00740.6936 768.6484478.4922
Module end 'content' 0.70100.1173 1,247.1406333.5000
Script end 0.8183  1,580.6406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.4989210.0002
Check MTime0.00150.1803210.0001
Mysql Total
Database connection0.00120.149510.0012
Mysqli_queries0.747491.33551940.0039
Looping result0.00180.21481920.0000
Template Total0.789296.420.3946
Template load0.00260.311820.0013
Template processing0.786796.131520.3933
Template load and register function0.00020.019910.0002
states
state_id_array0.00080.098410.0008
state_identifier_array0.00090.105120.0004
Override
Cache load0.00200.2453370.0001
Sytem overhead
Fetch class attribute can translate value0.00110.133630.0004
Fetch class attribute name0.00080.094330.0003
XML
Image XML parsing0.00060.069730.0002
class_abstraction
Instantiating content class attribute0.00000.000930.0000
General
dbfile0.00550.6676210.0003
String conversion0.00000.000930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs