Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Dropping the earlybird / late fee based on a custom field?

Dropping the earlybird / late fee based on a custom field? 14 years 9 months ago #6961

  • techmatters
  • techmatters's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 7
  • Karma: 1
  • Thank you received: 0
Hi guys,

I can already tell that this one's going to be a doozy, but I'm working on a pretty heavily-customised DTregister form, and I need to stop charging the earlybird rate and late fee if a certain custom field is checked.

I know, I know, such a thing probably shouldn't even be contemplated, let alone attempted - but I need to. I can't just drop the automatic fees and change the event price manually after a specified date, because I've already customised the system pretty thoroughly so that the earlybird and late frees are only applied to a certain user level. I'm in a bit of a bind.

I won't bore you with the details, but is this at all possible? I've got pretty good PHP and SQL skills, and I've already found my way around testing the access level before applying the discount / fee, so I just need a little guidance on how to test the value of the custom field, now. Any help that anyone can offer would be very gratefully appreciated!

Thanks in advance,

Nathan Dorey
Technology Matters

Please Log in or Create an account to join the conversation.

Dropping the earlybird / late fee based on a custom field? 14 years 9 months ago #6965

  • techmatters
  • techmatters's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 7
  • Karma: 1
  • Thank you received: 0
Hi all,

Well, I didn't find a way to do exactly what I wanted, but I thought up another way to do it.

I won't put code up unless someone really wants it, but the logic behind what I did was this:

- I made multiple versions of the custom field I was using.


In my case it was "single day registration", and I had a standard one which subtracted the correct amount if it was selected, as well as "day_registration_early" and "day_registration_late", which each subtracted enough to come up with the correct total after the earlybird discount / late fee were applied.

- In the code that processes and displays custom fields (in /dtregister.php, if I remember correctly), I used a number of nested IF statements to decide which one of these custom fields to show.

It wound up looking something like this (excuse the lack of actual code, but it's been a long day already...)

if (earlybird rate is being charged) && (this field is called "day_registration") {
// don't show it
} else {
if (earlybird rate is not being charged) && (this field is called "day_registration_early") {
// don't show it
} else {

all the usual processing code goes here, unchanged

}
}

Hope this helps somebody. I possibly could have done it better, with a CASE or something, but complicated IF structures aren't really my specialty, so I went with what was expedient.

- Nathan

Please Log in or Create an account to join the conversation.

Dropping the earlybird / late fee based on a custom field? 14 years 8 months ago #7481

  • ecweb
  • ecweb's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 0
Hi Nathan,

THat sounds great - just what I'm looking for.
Can you post the code in the forum for those of us who aren't confident in doing this from scratch ourselves?

Thanks,
Enoch / EC WEB

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.135 seconds