Akopia Akopia Services

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

Re: [mv] Pricing based on customer status (with a few twists)



******    message to minivend-users from "Eran Binyamin Zeitoun" <eran_zeitoun@karmail.com>     ******

Hi!
Let me donate from what i did... its not compleatly... and its not somthing
like a real
programmer (someone in the level of brigit funk or mike...) would do.... but
its working
so who cares.... (If some one will have some comments or improvments... you
are welcome!)

I hope it will help you somehow James... or anybody else.... since i couldnt
find somthing
at the mailing list when i started doing it...

My case:
We have diffrent kind of dealers... each dealer and his kind of price...
Also each products group have diffrent price calculation....,
Sometimes there is a need to a special add-on factor...
so to get to the final price for a product the calculation
goes like this: Price * ImportFactor * UserFactor * ProductFactor  *
PaymentFactor

Price - The Basic Price (found in products.asc)
ImportFactor - Since we import the products, each product have a diffrent
import factor
                       (cpu's 1%, Monitors 3%....), in the ProductsGroup
Table.
UserFactor - The special add-on factor for the customers
                    (Blondes 4%, Brunetes 5%...)
ProductFactor - When a special product should have a price raise or
discount, we set it
                          with this field in products.asc
PaymentFactor - Since we support many payment methods... there is add-on on
some of them
(for credit card we chard 3% for the process... and so on)

1. I have added to minivend two tables, the first one is UserFactor table,
where there
 i have group names and them factor... Same for ProductFactor...

2. I created a global sub, for handeling the calc...
GlobalSub <<EndOfSub
sub calcprice {
my($costprice, $factor1, $factor2,$factor3,$factor4) = @_;
my($price);
$price =
(((($costprice*($factor1+1))*($factor2+1))*($factor3+1))*($factor4+1));
currency($price);
return $price;
}
EndOfSub

3. for this explain, i will show how i handeled the results in
results.html.. so whenever a product
is displayed with the search result loop... there is a little mess going
behind the html:
[if value payment eq "0"][sql type=list query="select cash from ugroups
where grp = '[value grp]'"]
                                     [value name="userfact" set="[sql-param
cash]" hide=1]
                                     [/sql]
                                     [sql type=list query="select cash,
impfact from pgroups where grp = '[item-field grp]'"]
                                     [value name="productfact"
set="[sql-param cash]" hide=1]
                                     [value name="importfact"
set="[sql-param impfact]" hide=1]
                                     [/sql]
                                     [currency][perl arg=sub
interpolate=1]calcprice([item-field price], [item-field basefact], [value
userfact], [value productfact],

[value importfact])[/perl][/currency]
                                     [/if]
(There are 3 possibilites for payment...., payment= 0 its cash, payment = 1
its thirty days, payment=2 its sixty days)....
[value grp] is taken from userdb database, and its the name of the group
that user is belong to
[item-field grp] is taken from products database, and its the name of the
group that product is belong to


I know its quite a bizzare way to do so...., but its working......
I have only one problem.... i do all the calculation in the basket.html by
myself...
not using subtotal... i will be glad if someone will have an idea how can i
set
the price field of an item to item-price... so how can use the normal
minivend
tags (tax, subtotal, total) insted of my own....

I hope it was clear (I still do not understand how i did it... but it
works...)
8-)

Eran.

----- Original Message -----
From: "junglepost" <junglejj@swbell.net>
To: <Minivend-users@minivend.com>
Sent: Tuesday, May 23, 2000 8:49 AM
Subject: [mv] Pricing based on customer status (with a few twists)


> ******    message to minivend-users from junglepost <junglejj@swbell.net>
******
>
> Hello List,
>
> I am a medium skill level Minivend developer.  I have done several
> sites, and they all have this or that specific challenge.  One of my
> latest ones is racking my poor tired brain.  If someone out there
> could help me I will buy you a beer.  Or mail you one, or something...
> ;)
>
> My client wants to make his database available to both the public, and
> to dealers.  Dealers would usually pay 1/2 retail *but not always*.
> There is a discount structure on some items that I will use common
> adjust for (if I can under the circumstances).  The discounts would
> apply to both retail and dealer pricing schemes. This combination of
> needs is making my set up process a little more difficult than usual.
>
> I have looked at several options on how to implement this.
>
> 1.  Locale seems to be one option, but it is not obvious to me at the time
> how to use it.
>
> 2. I could set a variable via a password page and try to do some sort
> of [if variable...][perl config]
> {config}{PriceField}='dealerprice';[/perl] [/if] type of thing
> (dangerous??)
>
> 3.  I could set up some sort of convoluted [discount] tags (this would
> end up being messy and complex)
>
> Have any of you experience in this area?  I searched the maillist
> database and found a couple similar things, but nothing really
> illuminating.
>
> Thanks for your help!
> James Johnson
> flam@bigfoot.com (even though majordomo don't like bigfoot ;)
>
>
> -
> To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
> email with 'UNSUBSCRIBE minivend-users' in the body to
Majordomo@minivend.com.
> Archive of past messages: http://www.minivend.com/minivend/minivend-list


-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: