Hi,
I want to make a simple shopping card with ajax
in my "display" view (here I display list of items) I placed this link
<?php
$action = "basketadd/company_id:".$user['UserCompany']['id'];
$action.= "/page:".$paginator->current();
echo $ajax->link("add to card",
array("controller" => "companies",
"action" => $action),
array("update" => "main")
);
?>
Second line of this code have to remember current position in
pagination (here comes trouble!!!)
after click "add to card" I call "basketadd" function in "companies"
controller
<?
function basketadd()
{
$this->layout = false;
$company_id = $this->passedArgs['company_id'];
<skip>
here placed code with sessions to store user shopping card data
</skip>
if (!empty($this->passedArgs['page'])){
$this->redirect(array(
"controller" => "companies",
"action" => "display",
"page:".$this->passedArgs['page'])
);
}else{
//print "here";
$this->redirect(array("controller" => "companies", "action" =>
"display"));
}
}
?>
As you see -- I add "company_id" to Session and try to redirect back
to my view.
But this code does not redirect me to the page I need (current page of
listing) and redirects me to first page of my listing
Can anybody help me to solve it?
Thanks
SK
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---