We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Method not being called

Development and Programming

bohara's avatar
bohara
42 posts
16 years ago
bohara's avatar bohara

I know I just posted, but I think my issue is something different now. I have created the simplest module I can think of with one function

<?php

if ( ! defined('EXT'))
{
    exit('Invalid file request');
}


class Commerce {
        
    var $return_data    = ''; 
    
    function Commerce()
    {
        echo 'This is the constructor';
    }
    
    
    function cart()
    {
        echo 'Cart function';
    }
    
}
// END CLASS
?>

I am calling it with the following tag:

{exp:commerce:cart}{/exp:commerce:cart]

I get the first echo statement, but not the second. The debug info is below.

(0.008304) Parsing Tags in Template (0.008331) Tag: {exp:commerce:cart} (0.008390) Closing Tag Found (0.008443) Processing Tags (0.008488) Module Tag: Commerce/cart (0.008503) Including Files for Tag and Modules (0.009902) Beginning Final Tag Data Processing (0.009928) Calling Class/Method: Commerce/cart (0.010012) -> Class Called: Commerce (0.010050) -> Method Called: commerce (0.010065) -> Data Returned (0.010119) - End Tag Processing - (0.010166) - End Template Processing -

What am I missing here? Thanks agan.

       
Pascal Kriete's avatar
Pascal Kriete
2,589 posts
16 years ago
Pascal Kriete's avatar Pascal Kriete

It’s your class name. The template parser has a special case for ‘commerce’ and only calls the constructor of that module.

Try changing the name and it should work as advertised.

       
bohara's avatar
bohara
42 posts
16 years ago
bohara's avatar bohara

Thank you.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.