Forums / Setup & design / Shop and discount

Shop and discount

Author Message

laurent le cadet

Thursday 09 November 2006 9:22:10 am

Hi,

I have a site with an online shop and my client want to apply a special 10% discount for his customers.

There is the ez discount system for registrered users which is good for discount groups to apply a discount rule (10%) but the problem is I want the customers to have the benefit of this rule one time.

Is it possible to remove the user from the group while he checkout ?

This is my first basic idea and I don't know how to perform it...

Any other hint is welcome.

Regards.

Laurent

laurent le cadet

Thursday 09 November 2006 9:52:57 am

I'm thinking about adding this line to checkout.php :

eZUserDiscountRule::removeUser( $customerID );

...but don't know where...

Good idea (except kernel's dirty hack ?)

Clay Pereira

Thursday 09 November 2006 2:04:54 pm

You could modify the coupon extension that Björn Dieding submitted for this.

laurent le cadet

Friday 10 November 2006 1:34:48 am

Thanks for repplying but this is not a recent install (3.5.2) so I could'nt use this extension.

I think in my case it should be better to use the discount groups and removde users but don't know how.

:(

Laurent

laurent le cadet

Friday 10 November 2006 7:22:02 am

ok,

Quick and dirty, but it can be a basic for next steps foward :

checkout.php

include_once( "kernel/classes/ezuserdiscountrule.php" );

.............


$customer = $order->attribute( 'user_id' );
eZUserDiscountRule::removeUser( $customer );
include_once( 'kernel/classes/ezcontentcachemanager.php' );
eZContentCacheManager::clearAllContentCache();

back from paypal the user is removed from the discount group and the content cache is cleared to avoid confusion for the customer (strike prices, etc...) if he wants to goone buying while is still login.

Kernel's hack is not the best solution :( but it seems to works well like that :)))

Hope this help.

Regards.

Laurent

Ps : if someone has a hint to include that a cleaner way, that's will be welcome.

eZ debug

Timing: Jan 19 2025 03:19:02
Script start
Timing: Jan 19 2025 03:19:02
Module start 'content'
Timing: Jan 19 2025 03:19:03
Module end 'content'
Timing: Jan 19 2025 03:19:03
Script end

Main resources:

Total runtime1.4203 sec
Peak memory usage4,096.0000 KB
Database Queries200

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0092 588.8516180.8438
Module start 'content' 0.00921.1571 769.6953531.4141
Module end 'content' 1.16630.2540 1,301.1094337.3984
Script end 1.4202  1,638.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.2889210.0002
Check MTime0.00150.1037210.0001
Mysql Total
Database connection0.00080.054610.0008
Mysqli_queries1.324293.23502000.0066
Looping result0.00230.16441980.0000
Template Total1.380597.220.6902
Template load0.00230.160420.0011
Template processing1.378297.035820.6891
Template load and register function0.00010.008710.0001
states
state_id_array0.00170.123110.0017
state_identifier_array0.00150.104320.0007
Override
Cache load0.00190.1330380.0000
Sytem overhead
Fetch class attribute can translate value0.00170.121830.0006
Fetch class attribute name0.00270.188160.0004
XML
Image XML parsing0.01030.726430.0034
class_abstraction
Instantiating content class attribute0.00000.001590.0000
General
dbfile0.01240.8748270.0005
String conversion0.00000.000630.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/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
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs