Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Crashing payment modules?

Crashing payment modules?

Locked

Views: 1,943

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
16 Jan 2007, 7:22 AM
#1
rotkale avatar

rotkale

New Zenner

Join Date:
Dec 2006
Posts:
26
Plugin Contributions:
0

Crashing payment modules?

Hey all~

Im having problem, again... I found good thread by search and used code that Ajeh had submitted there to help someone. Anyway i put this code little modified to my modules but after that the payment modules turn to yellow at admin, what this means? They still work tho...

in modules im replacing this line:

$this->enabled = ((MODULE_PAYMENT_XXX_STATUS == 'True') ? true : false);

with this:

if (strstr($_SESSION['shipping']['id'],'storepickup')) {
    $this->enabled = ((MODULE_PAYMENT_XXX_STATUS == 'False') ? true : false);
   }

Im using version 1.3.6.

Thanks in advance~

17 Jan 2007, 4:58 AM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Crashing payment modules?

The modules are run in both the catalog and admin ...

Trying to surround the $this->enabled with an IF dependant on the session variable set in the Catalog will throw errors ...

I make a function that has a copy in the Catalog and the Admin ...

The Catalog version of the function has the code that returns either true or false based on the setting/evaluation I need ...

The Admin version of the function just returns true so that the Modules ... Payment ... can run without error ...

You might look at how the shipping modules are done for the function zen_get_shipping_enabled

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!

17 Jan 2007, 10:28 AM
#3
rotkale avatar

rotkale

New Zenner

Join Date:
Dec 2006
Posts:
26
Plugin Contributions:
0

Re: Crashing payment modules?

Thank you for answer Linda~

I kinda know what you mean, but im not very familiar with PHP functions. How should this kind of function be constructed and which files should be altered?

What im after is obviously to not show other payment options than cash when customer chooses store pickup as shipping option.

The reason why we are putting this option to our online shop is cos we dont have a real store, just office and storage, and we want customer to have option to get the product without paying shipping fees when she/he is from the same area as us.

Second question is about shipping modules, i cloned some modules succesfully but when i put that module is only enabled for certain shipping zone, the shipping module icon turns to yellow, what am i doing wrong with that?
I havent defined any zone taxes, cos there is no need. I tried with "Florida" zone aswell which was ready on zones when i installed Zen Cart but still the shipping module icon turns to yellow when using zones. Is it ok to have yellow icons on admin on some modules if they still are working on the actual site?

20 Jan 2007, 6:11 AM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Crashing payment modules?

Let's say you want to stop cc.php from showing based on a true/false return from a function called:
function my_payments_show

You would change the line:

    $this->enabled = ((MODULE_PAYMENT_CC_STATUS == 'True') ? true : false);

To read:

if (my_payments_show($this->code) {
    $this->enabled = ((MODULE_PAYMENT_CC_STATUS == 'True') ? true : false);
}

The make a function in a new file such as:
/includes/functions/extra_functions/my_payments.php
/admin/includes/functions/extra_functions/my_payments.php

For the admin version it just returns a true

For the catalog version you need to build either case statements or if statements or something that is being tested to determin when to return true and when to return false ...

If the function returns true ... the module shows ... if the function returns false then the module doesn't show ...

Use the example of the shipping module control for the function zen_get_shipping_enabled to get an idea of how this can be done ...

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!

20 Jan 2007, 6:13 AM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Crashing payment modules?

Note: the yellow icon is an indicator you have limited a modules use ... not that you have necessarily done something wrong ...

Note: sometimes the yellow icon does mean you did not finish configuring a setting such as money order where if you do not set your pay to info you will see the yellow icon ...

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!

22 Jan 2007, 7:55 AM
#6
rotkale avatar

rotkale

New Zenner

Join Date:
Dec 2006
Posts:
26
Plugin Contributions:
0

Re: Crashing payment modules?

Thank you again ^^ I'll start trying to setup the function~