[ic] Member Pricing ANSWERS for newbies

Tim Watts interchange-users@lists.akopia.com
Sun Jun 10 23:42:00 2001


To all who need specifics for member or alternate pricing on the fly:

I've been stuggling with this for several days, but could not find any
complete answers for us non-programmer types. After going through the user
archives, reading the pdf docs, and the Tagref.pm, I finally came up with
what I found to be a VERY simple way to implement this for multiple pricing
dependant upon user variable but using a single database.

If you want a simple way to have your cart use some other field besides
price for calculations, I've finally found it and here it is:

1.) In the catalog.cfg set up something simailar to this:

# Establish the default at startup
PriceField     price
Locale        club_price    PriceField    club

NOTE 1: this will use the field 'club' to calculate prices when the locale
within your cart is set to 'club_price' (substitute your values for 'club'
and 'club_price') Make sure this alternate field exists within your products
db and has values. If there is no value in the alternate field for a
particular sku, interchange is smart enough to use the price field for that
item only.

To insure that the file was used I went into admin and hit 'Apply Changes',
then just to be sure I also restarted the interchange server.

2.) I copied the 'cart' file from the
/catalogs/store_name/templates/components directory, making three files:
'cart', 'cart_club', and 'cart_reg'

Then modified the files as follows:

-->> 'cart'

points to other two files based on variables. My variables are either club
membership OR purchase of club membership. This file is always the first
file called when refreshing the cart so if the users variables change the
correct cart is displayed. Below is the entire source code:

<!-- BEGIN COMPONENT cart -->
[if value club_member]
    [include file="templates/components/cart_club"]
    [else]
        [if ordered __CLUB__]
            [include file="templates/components/cart_club"]
            [else]
                [include file="templates/components/cart_reg"]
            [/else]
        [/if]
    [/else]
[/if]
<!-- END COMPONENT cart -->

NOTE 2a: 'club_member' is a field in the userdb that is blank for
non-members, 1 for members

NOTE 2b: '__CLUB__' is a catalog variable defining the sku for the club
membership in the products file. If the sku ever changes, all I need to do
is change this variable in the catalog admin, and not all the pages, etc.

-->> 'cart_club'

is the cart that uses the club prices for calculations. This is done by
placing the following at the beginning of the page: [setlocale club_price]
and this at the end of the page: [setlocale]

NOTE 2c: [setlocale] at end returns to the users default locale

-->> 'cart_reg'

is the cart that uses the regular prices for calculations. Nothing special
here other than it displays the club prices (grayed out) and suggests the
purchase of club membership along with membership savings. I put [setlocale]
at beginning of page just to insure use of regular prices.

3.) any other files that display the users cart, including checkout could be
handled the same way or if you don't need seperate carts simply have the
following tags added prior to any calculations:

[if value club_member]
    [setlocale club_price]
    [else]
        [if ordered __CLUB__]
            [setlocale club_price]
            [else]
                [setlocale]
            [/else]
        [/if]
    [/else]
[/if]

then be sure to insert [setlocale] after any calculations.



This works great for me.

Hope this helps. Please let me know if it does.


Tim Watts
president
Romans1013.net
Internet Hosting
Loaded with features:
Interchange compatable
UNLIMITED email!
No Monthly Fees - Just One Low Payment, One Time per Year!
Visit our web site for details:
www.Romans1013.net