SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    undefined error even when function exist

    I m working on a joomla site. (i m new to joomla) i have a button cancel, which cancel a person subscription( i m using CIM) now i have the function made of xml file as said by the payment gateway SDK tut. But when i clock the button it says undefined method my method name, here is the code
    Code PHP:
    if (isset($_POST['btnCancel'])){
               //echo "Cancel Subscription";exit; 
              [B] $result = $this->cancelCustomerSubscription();[/B]
    }
    Now the echo is working but when i comment it and run this it throws a error
    Code PHP:
    //Cancel Subscription Request
    function CancelSubscriptionRequest(){
    $this->xml = "<?xml version='1.0' encoding='utf-8'?>
    <CancelSubscriptionRequestt xmlns='AnetApi/xml/v1/schema/AnetApiSchema.xsd'>
    <merchantAuthentication>
    <name>" . $this->login . "</name>
    <transactionKey>" . $this->transkey . "</transactionKey>
    </merchantAuthentication>
        " . $this->refId() . "
        " . $this->customerProfileId() . "
    </CancelSubscriptionRequest>";
    }
    what am i doing wrong? or missing something
    All those who wander aren't lost.

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,080
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    The name of the function is CancelSubscriptionRequest, the function you're calling is cancelCustomerSubscription. Not the same
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ScallioXTX View Post
    The name of the function is CancelSubscriptionRequest, the function you're calling is cancelCustomerSubscription. Not the same
    lol my bad but still i got error it says
    Fatal error: Call to undefined method Controller_profile::CancelSubscriptionRequest()
    All those who wander aren't lost.

  4. #4
    SitePoint Guru bronze trophy TheRaptor's Avatar
    Join Date
    Jul 2011
    Location
    New York
    Posts
    710
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)
    What are those [B] tags doing around this line: $result = $this->cancelCustomerSubscription(); ?

    Were you trying to make the result bold?

  5. #5
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    Think he was trying to hilight the line throwing the error, TR BBCode tags dont work inside PHP tags, for the record, nofel.

    Is function CancelSubscriptionRequest(){ inside the class definition for Controller_profile ?

  6. #6
    SitePoint Guru bronze trophy TheRaptor's Avatar
    Join Date
    Jul 2011
    Location
    New York
    Posts
    710
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    Quote Originally Posted by StarLion View Post
    Think he was trying to hilight the line throwing the error, TR
    Ah, makes sense now.

  7. #7
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    Think he was trying to hilight the line throwing the error, TR BBCode tags dont work inside PHP tags, for the record, nofel.

    Is function CancelSubscriptionRequest(){ inside the class definition for Controller_profile ?
    u mean the folder controller? yes its under that folder
    where do i find a Controller class?
    All those who wander aren't lost.

  8. #8
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    it should say "class Controller_profile {" at the top...

  9. #9
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I found controller which read as class Controller_register extends JController { // register controller, is this the one ur talking about? what about it and no its not under that class
    All those who wander aren't lost.

  10. #10
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    Nope, that'd be the class definition for the Controller_register class. Your error message spells out that the object you're calling this reference from is of type Controller_profile...

    Fatal error: Call to undefined method Controller_profile::CancelSubscriptionRequest()

    Red = class name, blue = method name

  11. #11
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    it should say "class Controller_profile {" at the top...
    yes i found that, the function is not under it. i did pasted under it but i get the same error
    All those who wander aren't lost.

  12. #12
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    We'll probably need to see the whole of the class definition in order to procede... I'm not very well versed in OOP, so i'm gonna look around for help at this point :P

  13. #13
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    what shld i do?
    All those who wander aren't lost.

  14. #14
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Is the calling code, below:

    PHP Code:
    if (isset($_POST['btnCancel'])){
               
    //echo "Cancel Subscription";exit; 
              
    $result $this->:CancelSubscriptionRequest();

    ... part of a method inside a class? If so post that class.

    It it is monstrously huge, just post the signatures of the methods (ie strip out the guts of each function except for the one which contains the calling code above).

  15. #15
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    what am i missing?

    Off Topic:

    Very nice editor and new look of fourms!

    ok i am praticing OOP here is what i made, i m missing something. i wonder what. can anyone help me. why isn't it printing?
    PHP Code:
    class test{
        function 
    world(){
            echo 
    "Hello World";    
        }
    }
    $testing = new test;
    $testing->world() 
    its not printing... why
    All those who wander aren't lost.

  16. #16
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,032
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $testing->world() 
    Your missing the ; at the end of that line
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator


Tags for this Thread

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
  •