Tuesday, February 26, 2013

Re: Calling functions in other controllers

Also you can will be needed to use on the following format
$cart = $this->Checkout->Cart->get();
  $total = $this->Checkout->Cart->total();


On Wed, Feb 27, 2013 at 10:33 AM, Yasir Arafat Hasib <arafatix@gmail.com> wrote:
Hello,
Before calling make sure you load the model of your cart model
like
$this->loadModel('Cart');

Thanks
Arafat



On Wed, Feb 27, 2013 at 6:55 AM, lirc201 <brian.e.lavelle@gmail.com> wrote:
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.

--
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.
 
 



--
Thanks & Regards.
-----------------------------------------------------------------------------------------------------------------------------
Yasir Arafat (Hasib)
Deputy Project Manager, Software Solutions
Grameen Solutions
Contact Information:
Cell : +8801816 536 901, +880197 333 2 888
Web: http://arafats.info



--
Thanks & Regards.
-----------------------------------------------------------------------------------------------------------------------------
Yasir Arafat (Hasib)
Deputy Project Manager, Software Solutions
Grameen Solutions
Contact Information:
Cell : +8801816 536 901, +880197 333 2 888
Web: http://arafats.info

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