Forums / Built-in Shipping and Payment Modules / Payment Choices based on Shipping

Payment Choices based on Shipping

Locked

Views: 1,935

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
25 Aug 2006, 9:32 AM
#1
bootyrat avatar

bootyrat

New Zenner

Join Date:
Jun 2006
Location:
Oz
Posts:
31
Plugin Contributions:
0

Payment Choices based on Shipping

Hi all
I have searched through the forum for a solution but can't find anything. Help please.

I have a situation where If a customer selects 'store pickup' option in shipping
then goes to payment, I want to be able to have one payment method eg. 'Pay on Pickup'.

I have setup the shipping and payment options but can't see how I can limit the payment options to this one option.
or
Not have the 'Pay on Pickup' show for customers that select any other shipping method.(probably closer to what i'm trying to say)

Any Ideas or a nudge in the right direction would be most appreciated.

Thanks

25 Aug 2006, 9:40 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: Payment Choices based on Shipping

Assuming you "have" a payment method called "Pay on Pickup", you could restrict it to only be available/active when the "store pickup" shipping method is selected by setting this within the class constructor of the pay-on-pickup module:

 $this->enabled = (($_SESSION['shipping']['title'] = 'storepickup') ? true : false);

Haven't checked for sure, but I suspect the 'storepickup' reference might need to be 'storepickup_storepickup'

.
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.

25 Aug 2006, 1:15 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Payment Choices based on Shipping

Note: for clarity and to avoid issues between the Catalog and Admin, often times it is helpful to build a function to manage this test ...

Then, add a matching function for the Admin where it returns true ... this allows the same function call to run on both the Catalog side and allow the Admin ... Modules ... Payments ... to run on the Admin ...

You might peek at how the Shipping Modules manage this type of function ... peek at:
/includes/modules/shipping/item.php

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
        $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
      }

Find the function zen_get_shipping_enabled in the Catalog and the function zen_get_shipping_enabled in the Admin and notice how they differ ...

You are building something similar to manage the $this->enabled for the Payment modules ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Aug 2006, 1:32 PM
#4
bootyrat avatar

bootyrat

New Zenner

Join Date:
Jun 2006
Location:
Oz
Posts:
31
Plugin Contributions:
0

Re: Payment Choices based on Shipping

What can I say... but THANK YOU.

It worked Brilliantly DrByte and thanks Ajeh for your advice.