Tuesday, February 26, 2013

Re: Calling functions in other controllers

I'm in 2 different controllers.  In the checkout controller, I'm trying to call a function in the cart controller.

On Tuesday, February 26, 2013 7:34:39 PM UTC-5, jsundquist wrote:

If you are in the function trying to call another function just do $this->get() not $this->cart->get()

On Feb 26, 2013 6:32 PM, "lirc201" <brian.e...@gmail.com> wrote:
I'm still working in cake 1.3.15 (going to upgrade soon) but running into an issue.  I'm setting up a shopping cart so I have functions in my cart_controller like

Cart get()
Cart total()

When I attempt to call these functions in my checkout_controller ...

var $uses = (....'Cart',,,);

function index() {
  $cart = $this->Cart->get();
  $total = $this->Cart->total();

When checking out I get an SQL error about incorrect mysql syntax ... check the manual ...  the next line reads "Query: get".  If I pull the "get" code into the checkout_controller it runs as expected.

What I'm I missing?

Thanks,
Brian

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: