Page 1 of 1

different between MaxUses and MaxUsesPerCustomer

Posted: Fri Feb 08, 2013 8:44 am
by sai
I am looking at OfferCodeImpl and OfferImpl

OfferCodeImpl has variable 'maxUses'. But I do not see it used anywhere.
OfferImpl has variable 'maxUsesPerCustomer', this is used to check for max number of uses

Code: Select all

    @Column(name = "MAX_USES")
    @AdminPresentation(friendlyName="Code Max Uses", order=2, group="Description", prominent=true)
    protected int maxUses;

Code: Select all

    @Column(name = "MAX_USES_PER_CUSTOMER")
    @AdminPresentation(friendlyName="Max Uses Per Customer", order=7, group="Description", groupOrder=1)
    protected Long maxUsesPerCustomer;


Please advise I am little confused understanding these.

Re: different between MaxUses and MaxUsesPerCustomer

Posted: Fri Feb 08, 2013 10:24 am
by phillipuniverse
maxUses is how many times the promotion can apply to a single order. For instance, if you have an offer configured to target a specific Sku and the customer adds 2 of those to the cart, but then you configured maxUses to be 1, only 1 of the orderItems will be discounted.

maxUsesPerCustomer just means how many times the Customer is able to use the promotion. So if you want to only give customers free shipping on one of their orders (and no other future orders) you could set this to 1.

Re: different between MaxUses and MaxUsesPerCustomer

Posted: Fri Feb 08, 2013 12:52 pm
by sai
Thank you for the quick response.

I am looking for an option where I can ensure that a promo code is used only once. Let us say I am creating a promo code of 70% on a order for my friend. Once that promo code is used no there customer should be able to use it again.

What will be my variable that can help achieve this.

Re: different between MaxUses and MaxUsesPerCustomer

Posted: Fri Feb 08, 2013 2:27 pm
by phillipuniverse
If you want a customer to be able to use it only once, set the max uses per customer to 1.

If you want to restrict the promotion to a specific customer, simply add a customer selection rule.

Re: different between MaxUses and MaxUsesPerCustomer

Posted: Fri Feb 08, 2013 3:59 pm
by sai
I mean irrespective of which customer the promotion code can be used only once.

I cannot have a customer specific rule because I do not have a customer record created in my system..but I will be creating the promo code and giving it to customer upfront. So I cannot add a customer specific rule when creating the promo.

My problem is, the promo code is used by multiple customers and I want to restrict it to only one time use.

Re: different between MaxUses and MaxUsesPerCustomer

Posted: Fri Feb 08, 2013 4:26 pm
by phillipuniverse
Ok... so why can't you use Max Uses per customer and set it to 1? Each Customer would then be able to use the promotion only 1 time.

I guess the problem with this is with anonymous customers (assuming that you allow anonymous customers to check out, which are represented by a unique Customer in the database). To solve that you could just set a Customer rule for 'registered = true'. I guess that still doesn't technically stop someone from going in and creating multiple accounts for themselves and re-using the promotion code, but that would have to be an up-front validation you have on creating Customers.

Re: different between MaxUses and MaxUsesPerCustomer

Posted: Fri Feb 08, 2013 6:22 pm
by sai
I allow anonymous customers to check out..so I cannot really go by customer or accounts. The purpose of it to use the promo only once. I have to make them create an account then add rule to stop other uses to use the promo code.

At this point I would not want to make customers go through exercise of creating account and all that coordination and process. I may have to build this custom by expiring the promo upon checkout.

It would be nice if this flexibility can be added to promo to be used only once.

Thank you for the support. Appreciate it.

Re: different between MaxUses and MaxUsesPerCustomer

Posted: Fri Feb 08, 2013 9:29 pm
by phillipuniverse
Ah; I was misunderstanding. So you need something that is globally used a single time. Once someone uses it (doesn't matter who), that's it, nobody else can use it. Yeah looks like we don't support this out of the box. Off the top of my head, I would probably recommend doing this:

  • Subclass OfferImpl with your own LimitedUseOfferImpl
  • Add a property called "maxGlobalUses" or something (and fill in @AdminPresentation)
  • Subclass OfferServiceImpl and override the buildOfferListForOrder method
  • In your overridden method, call super.buildOfferListForOrder and then filter that list of offer by ones that have already been used

This is incomplete but might get you started. Excluded is how to actually track how many times an offer has been used.

Re: different between MaxUses and MaxUsesPerCustomer

Posted: Sat Feb 09, 2013 2:36 pm
by sai
Thank you for the advise.

One quick thought...I felt like, it is lot of looping and mainly filtering through the offers/counting the offers, that are already used... as time progresses, the list of offers increases and every time going through the list to exclude seemed ..additional looping.

I was wondering all this can be avoided by holding an additional field to hold a flag (or coded letters) saying that the offer is no longer applicable, based on its maxGlobalUses or maxUses etc when conditions meet. Checking against this flag can potentially remove lot of redundant offers that we need not check against, also keeping track of counter can eliminate additional look ups/filtering, as soon as the offer is used during the process of check out.

I/O's is one perspective that I am looking at, especially now a days, hosting in cloud world, it costs once the limit is past.

Thank you for the support. I appreciate it.