Zen Cart Logo
Forums / General Questions / Pricing by cumulative hours in cart

Pricing by cumulative hours in cart

Locked

Views: 940

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
3 Aug 2008, 5:14 AM
#1
xenophile avatar

xenophile

New Zenner

Join Date:
Jul 2008
Posts:
3
Plugin Contributions:
0

Pricing by cumulative hours in cart

I'm setting up a store for a school. Pricing is done by the hour, but it is:

  1. Nonlinear - no formula; must be done via lookup table
  2. Cumulative - so the third 1.5 hour product has a different price than first or second

For example:
1.0 hour of classes = $100
2.0 hrs of classes = $186
3.0 hrs of classes = $263

So if I set three 1 hour classes with price = $100, that's only correct if it's the only class in the cart. When adding the second one hour class, the price should be $86.

Furthermore, if the first class is removed, the price of the second item needs to revert from $86 to $100.

I'm assuming this can't be done without writing some custom code, which I'm fine to do -- but I'd like pointers on how to proceed, if anyone has any tips :-)

Should I

  1. use the Notify/Observer framework to adjust prices as items are moved in/out of the cart... or
  2. modify whatever code does the cart totallling, or
  3. use a custom Payment or Order Total module?
    Thanks in advance,

Mike

3 Aug 2008, 5:13 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Pricing by cumulative hours in cart

Are these additional hours for the same class(product) or for separate classes(products) added to the cart?

3 Aug 2008, 7:53 PM
#3
xenophile avatar

xenophile

New Zenner

Join Date:
Jul 2008
Posts:
3
Plugin Contributions:
0

Re: Pricing by cumulative hours in cart

These are for different classes/products, which need to remain distinct in the cart.

I actually did a horrible hack in OSCommerce a while back, which was:

  • Each class priced @ $0
  • When a class item was added, another item called "Classes Total Rate" (or some such) was added automatically; that item was used to carry the price.
  • So in my earlier example, with 3 one hour classes, each would be priced @ zero, and a fourth item, "Classes Total Rate", uneditable by user, would be priced @ $263, the sum of (discounted) hourly rates.

I'm hoping to have a cleaner solution w/ ZC. Partly because ZC itself looks much, much cleaner; also because I don't remember how I did it, what files I modified, etc. in OSC way back when... my docs & such were lost in the interim.

Ideally:

  • In the product listing, class prices would show the next incremental cost, as a function of what's already in the cart.
  • Once in the cart, each item would show that cost too, so the customer sees the discounted price on the second item, rather than just a stark total, as in my earlier solution

Are "Product Types" a way to do this??? Does a new ProdType allow associated pricing code to override the standard pricing?

The classes must co-exist with conventional, fixed price items, btw....

Thanks for the followup!

4 Aug 2008, 1:00 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Pricing by cumulative hours in cart

In the product listing, class prices would show the next incremental cost, as a function of what's already in the cart.
This one is gonna require too much coding to track and dynamically alter prices between products - Would have to be an item that one can just not live without to spend the time/money to create this
Once in the cart, each item would show that cost too, so the customer sees the discounted price on the second item, rather than just a stark total, as in my earlier solution
This also is a stretch as just as with OSC(which Zen Cart is based upon), each product is unique in of itself and doing discounts across products will require custom coding....

shopping_cart.php is the most probable file to begin looking at how the products and resulting prices are summed up

Not impossible but then again not easy nor a subject that can be covered in a couple of posts on a forum

5 Aug 2008, 1:15 AM
#5
xenophile avatar

xenophile

New Zenner

Join Date:
Jul 2008
Posts:
3
Plugin Contributions:
0

Re: Pricing by cumulative hours in cart

Well, thanks for the input. Although it was even less encouraging than I had anticipated :cry:

Actually, I had really been hoping for some sample code :smartalec: <jk>

Most of what I do remember about my OSC endeavor is hacking away at it every free moment for a solid week to make something bare bones work, so I certainly wasn't expecting it to be easy.

I'm mildly surprised that I haven't seen anyone else that seems to be selling services (vs products) using ZC. Is there another product out there that I should know about, more tailored to the service industry???

Thanks again,

xenophile

kobra:

This one is gonna require too much coding to track and dynamically alter prices between products - Would have to be an item that one can just not live without to spend the time/money to create this

This also is a stretch as just as with OSC(which Zen Cart is based upon), each product is unique in of itself and doing discounts across products will require custom coding....

shopping_cart.php is the most probable file to begin looking at how the products and resulting prices are summed up

Not impossible but then again not easy nor a subject that can be covered in a couple of posts on a forum