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.