Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2004
    Posts
    141
    Plugin Contributions
    1

    Default Is this lne of code in payment.php correct

    Hi

    A quick question:

    I was having trouble with one of the payment modules I am writing and noticed a problem with $_SESSION['payment'] failing an is_object() test on line 77 of checkout_confirmation/header.php.

    Could someone please confirm that code on line 72 of classes/payment.php is correct looking like this:

    Code:
    if (!$credit_covers) $_SESSION['payment'] = $include_modules[0]['class'];
    and given the assignment on line 65 above it,

    Code:
    $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];
    is there any chance it should come from the object held in $GLOBALS? - $include_modules[0]['class'] is a string at the moment i.e. the Real Question - is there any chance the code could like ...

    Code:
    if (!$credit_covers) $_SESSION['payment'] = $GLOBALS[$include_modules[0]['class']];
    I have tried making the change and my module now works, however I have found very few bugs in ZC over the years and I would be really grateful for a steer as to whether I not I am on the right track.

    Thanks, Ian
    Last edited by IanEtche; 3 Dec 2006 at 12:40 AM. Reason: Missed final Comment

  2. #2
    Join Date
    Aug 2004
    Posts
    141
    Plugin Contributions
    1

    Default Re: Is this lne of code in payment.php correct

    hehe missed being able to edit by a minute.

    Wanted also to say that

    I know this will require a change in checkout_confirmation _default which is what makes me doubt that I am correct, but I am definitely confused :) Thanks again, Ian

  3. #3
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: Is this lne of code in payment.php correct

    $_SESSION['payment'] is not meant to be an object only a referece to the class name of the payment method. Could u maybe show the code where the is_object test is being done.

    The other Ian

  4. #4
    Join Date
    Aug 2004
    Posts
    141
    Plugin Contributions
    1

    Default Re: Is this lne of code in payment.php correct

    Hi Ian

    Thanks for the reply - I think you are probably THE Ian :)

    I found the isobject() test in includes/modules/pages/checkout_confirmation/header_php.php on Line 77.

    Code:
    $payment_modules = new payment($_SESSION['payment']);
    $payment_modules->update_status();
    if (($_SESSION['payment'] == '' && !$credit_covers) || (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$_SESSION['payment'])) && (!$credit_covers) ) {
      $messageStack->add_session('checkout_payment', ERROR_NO_PAYMENT_MODULE_SELECTED, 'error');
    }
    I notice that the problem goes away if you only have one payment interface enabled - it skips the multiple module code.

    Best regards, Ian

  5. #5
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: Is this lne of code in payment.php correct

    k, the actual test is for

    is_object($$_SESSION['payment'])

    as i said $_SESSION['payment'] is a string that references the class name of the payment method, hence the use of $$

    So i still think the code as it stands is correct. Some more info about what u are trying to do with your payment module might help, and under what circumstances it breaks :)

  6. #6
    Join Date
    Aug 2004
    Posts
    141
    Plugin Contributions
    1

    Default Re: Is this lne of code in payment.php correct

    Hi Ian

    Thanks for that - must have been gettng tired or maybe just daft :) I had missed the $$.

    The problem is strange, I have written a various payment modules and have released some where they might be useful to people, but I am having trouble with having more than two modules enabled at the moment.

    I think that after your observation, I will just try reinstalling a clean system and running them from there.

    I actually needed a UK type version of the CC module for a client and I am just writing one that deals with more cads including Switch, Maestro etc. It seems to work ok albeit it needs tidying up if I were to release it, but I had this strange problem. So I will try a solid test platform rather than my client's upgraded site. Do you think there would be any interest in an enhanced CC module - if so I will get it to a releasable format later in the month.

    Hey many thanks for the help - I am hoping to get paid just after Christmas and will be sending you guys a late present.

    Regards to all, Ian

 

 

Similar Threads

  1. v151 /includes/modules/payment/paypal.php: What's this code supposed to do?
    By lat9 in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 28 Apr 2013, 02:58 PM
  2. v150 Is this a correct code change for PHP 5.3?
    By dbltoe in forum Contribution-Writing Guidelines
    Replies: 7
    Last Post: 13 Sep 2012, 10:04 PM
  3. how can I rename this ads_display2.php code?
    By wycliffn in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 11 May 2012, 04:22 PM
  4. please explain this php code
    By ianhg in forum General Questions
    Replies: 12
    Last Post: 31 Dec 2007, 11:13 AM
  5. Where is this PHP code for shop cart?
    By artcoder in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Apr 2007, 08:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR