Hello
That web site has been build some years ago and the web site has always been working since the web hosting get some issue.
The hosting problem was solved but I have a trouble and I never change any controller.
Inspite of this, I have now an issue
Action BasketsController: could not be found
This happen, when I want to add an item into the basket. When I select a number of itemp and then I press the icon
The error
Action BasketsController::www.sogemat.ch() could not be found
is printed. I observer that is url is
The last string www.sogemat.ch, should not be there. If you remove the last string ‘www.sogemat.ch’, you can access the basket
In my BasketsController.php, I have this
function basketAdd(){
# $data = array('error'=>true);
$data = current($this->request->data);
//debug($data);
if(empty($data['id'])){
$this->Session->setFlash("No ID",'notif',array('type'=>'danger'));
# $data['message']= "No ID";
}elseif(empty($data['numberof']) OR $data['numberof']==0){
$this->Session->setFlash(__("Le nombre d'article ne doit pas être vide ou plus grand que zéro"),'notif',array('type'=>'danger'));
}else{
$this->loadModel('Article');
$this->Article->id = $data['id'];
$art = $this->Article->find('first',array('conditions'=>array('id'=>$data['id'])));
if(empty($art)){
# $data['message'] = "That article does not exist";
$this->Session->setFlash("That article does not exist",'notif',array('type'=>'danger'));
}else{
$this->Session->write('Basket.'.$data['id'],$data['numberof']);
#$this->Session->write('Baskettot.'.$data['id'],$data['numberof']);
//debug($this->Session->read('basket'));
# $data['message'] = "The product (".$id.") has been add to your basket";
# $data['error']= false;
// $this->Session->setFlash("The product (".$id.") has been add to your basket",'notif');
}
}
# $this->set('_serialize', $data);
# echo json_encode($json);
$this->redirect($this->referer());
}
The HTML form is as the following
<div class="col-xs-6 col-sm-6 col-md-6">
<?php if($this->Session->read('Arti.basketstatus')){ ?>
<?php echo $this->Form->create(null, array(
'url' => array(
'controller' => 'baskets',
'action' => 'basketAdd'
),
'style'=>'padding:0px;',
'id'=>'AddBasket'.$v['id'],
'inputDefaults' => array(
'label' => false,
'div' => false
)
));
?>
<?php echo $this->Form->input('id',array('id'=>$v['id'],'label'=>null,'type'=>'hidden','value'=>$v['id'] )); ?>
<?php echo $this->Form->input('numberof',array('id'=>'numberOf'.$v['id'],'label'=>false,'type'=>'number','class'=>'numberof','style'=>'','value'=>1)); ?>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<?php
$options = array(
'label' => '',
'div' => false,
'class'=>'addToBasket'
);
echo $this->Form->end($options);
?>
<?php } ?>
</div>
</div>
Why? Why the string www.sogemat.ch is added after /baskets/ ?
It should not
Many thanks for your help