Tuesday, February 26, 2013

Calling functions in other controllers

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+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: