Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date ][Interchange by thread ]

Re: [mv] Discount Code



Quoting Victor Nolton (ven@pragakhan.com):
> I have a OLD snippet of discount code that works really well (even 
> when I upgraded). But I have 2 questions.
> 
> A. the client wants to be able to mark in the database that a item is 
> not to bbe discounted. Is that possible?

Sure.

> B. the items (as I just found out) start with 48 or 49 as a product 
> code (48-001 is an example).

Just put a field in, "no_discount" and set it to 1 for those items.
Then build an adjusted total based on that field.

> 
> Is there a method anyone would recommend or a older post I overlooked?
> 
> this code is slightly modified.
> 

Something like:

 [discount code=ENTIRE_ORDER interpolate=1]
                  $original = $s;
                  $d =(.25);
		  # 0 at end makes addition come out right
                  $adjtot = 
			[item-list]
				[if-field no_discount]
				[else] [item-price noformat] + [/else]
				[/if-field]
			[/item-list]
				0;
		
                  if ($adjtot <= 2499.99) {
		      $discounted = $adjtot * (1.0 - $d);
                  } elsif ($adjtot <= 4999.99) {
		      $discounted = $adjtot * (.95 - $d);
                  } elsif ($adjtot <= 9999.99) {
		      $discounted = $adjtot * (.90 - $d);
                  } elsif ($adjtot <= 19999.99) {
		      $discounted = $adjtot * (.88 - $d);
                  } elsif ($adjtot >= 20000.00) {
		      $discounted = $adjtot * (.85 - $d);
                  }
                  $difference = $original - $discounted;
                  return $discounted;
 [/discount]

I can't tell what you are doing there, but the key is to get the
adjusted total.

-- 
Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>

Being against torture ought to be sort of a bipartisan thing.
-- Karl Lehenbauer

_______________________________________________
Minivend-users mailing list
Minivend-users@minivend.com
http://lists.akopia.com/mailman/listinfo/minivend-users


Search for: Match: Format: Sort by: