If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / External member discount code implementation

External member discount code implementation

Started by spmckee on 11 Mar 2013, 8:45 PM · Views: 1,020

Results 1 to 8 of 8
11 Mar 2013, 8:45 PM
#1
spmckee avatar

spmckee

New Zenner

Join Date:
Apr 2012
Posts:
6
Plugin Contributions:
0

Post #1 by spmckee

Greetings,

I am working on a site that will issue a %10 discount to members of an external site. The site provides code examples on how to interface with the system here: http://ba.brewersassociation.org/ws/ahamember.asmx

If the member number entered is valid the system returns the following XML:

<memberstatus MemberID="00000001"> <FullName>John Doe</FullName> <IsMember>true</IsMember> <MemberInfo Type="AHA" Status="A" Expiration="2012-10-31T00:00:00" /> </memberstatus>

If valid, a discount would be applied to the customers order.

Any ideas on where to start with this one? I've spent a lot of time around code but am not that familiar with ZC.

I really appreciate your help!

Cheers,
Sean-Paul

16 Mar 2013, 4:01 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #2 by drbyte

You could clone the ot_coupon order-total module, and alter its validation lookup from doing a check on internal db tables to do the external lookup. If validation passes then it can pass on the discounts into the order during checkout.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

18 Mar 2013, 5:29 PM
#3
spmckee avatar

spmckee

New Zenner

Join Date:
Apr 2012
Posts:
6
Plugin Contributions:
0

Post #3 by spmckee

DrByte, when you say "Clone" do you mean to copy the actual PHP page or is that a function within ZC?

Thanks for your help.

18 Mar 2013, 5:59 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #4 by drbyte

By "clone" of an order-total module, I mean to make a duplicate copy of the corresponding PHP files and then customize the PHP code and language strings in them to suit your needs.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

29 Mar 2013, 12:51 AM
#5
spmckee avatar

spmckee

New Zenner

Join Date:
Apr 2012
Posts:
6
Plugin Contributions:
0

Post #5 by spmckee

DrByte:

By "clone" of an order-total module, I mean to make a duplicate copy of the corresponding PHP files and then customize the PHP code and language strings in them to suit your needs.

OK, I've made copies of both the "ot_coupon.php" module and language files and named them uniquely. I have also renamed the "ot_coupon" class and changed the naming on the language constants as well. However, I've looked and looked but can't find where to include/call the newly made files. In which PHP file do I call them up?

Thanks!
SP

29 Mar 2013, 12:56 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #6 by drbyte

You can turn on a module in Admin->Modules->Order Total

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

13 May 2013, 4:46 PM
#7
spmckee avatar

spmckee

New Zenner

Join Date:
Apr 2012
Posts:
6
Plugin Contributions:
0

Post #7 by spmckee

Thanks again for your help DrByte.

I've successfully duplicated and installed the new coupon. However I'm having a very hard time find the right function to target for the member check. Do you have any idea which one I should begin looking at?

All I'm shooting for initially is to create a hard-coded coupon code array that I can search through with a submitted coupon code. Once I get that nailed I'll move on to allowing the number to be verified from the remote DB.

Thanks again!
SP

14 May 2013, 4:47 PM
#8
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,766
Plugin Contributions:
56

Post #8 by swguy

If you get Newsletter Discount from the Plugins at the top of this page, you can see how it does a check of the MailChimp database and offers a discount code if the user is registered there.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.