i'm working codeiginter cart. im send cart data through Ajax request but in response output giving me many error i don't know why giving me syntax error help appreciated
- Parse error: syntax error, unexpected T_IF Line Number: 873
- Message: syntax error, unexpected 'form_hidden' (T_STRING)
$output = '';
if(count($cart) == 0)
{
$output .= ' <tr>
<td colspan="8">
<div class="noitemcontent alert-dismissible alert-info">'
. $this->lang->line('sales_no_items_in_cart').
'</div>
</td>
</tr>';
} else //
{
foreach(array_reverse($cart, true) as $line=>$item)
{
form_open($controller_name."/edit_item/$line", array('class'=>'form-horizontal line-item', 'id'=>'cart_'.$line)) .
'<tr>
<td> '
. anchor($controller_name."/delete_item/$line", '<span class="glyphicon glyphicon-trash"></span>') .
'</td>
<td style="align: center;"> '.
$item['name'] .'
</td>';
if ($items_module_allowed)
{
$output .= '<td> '.
form_input(array
('name'=>'price', 'class'=>'form-control input-sm cartline', 'value'=>to_currency_no_money($item['price']),
'tabindex'=>++$tabindex,
'data-form' => $line
)) .'
</td>'; }
else
{
$output .= ' <td> '.
to_currency($item['price']).
form_hidden('price', $item['price'])
. '</td> ';
}
$output .= ' <td>'.
if($item['is_serialized']==1) //error Type: ParseError Message: syntax error, unexpected 'if' (T_IF)
{
to_quantity_decimals($item['quantity'])
form_hidden('quantity', $item['quantity']) //Message: syntax error, unexpected 'form_hidden' (T_STRING)
}
else
{
form_input(array('name'=>'quantity',
'id','quantity',
'type'=>'number',
'class'=>'form-control input-sm cartline',
'value'=>to_quantity_decimals($item['quantity']),
'tabindex'=>++$tabindex,
'data-form' => $line));
}.'
</td><td>';
form_input(array('name'=>'discount',
'value'=>$item['discount'],
//'type'=>'number',
// 'min'=>0,
// 'max'=>100,
'title'=>'Discount (5 or 5%)',
'tabindex'=>++$tabindex,
'class'=>'form-control input-sm cartline',
'data-form' => $line))
$output .= '</td></tr><tr>'.
if($item['allow_alt_description']==1)
{
.'<td style="color: #2F4F4F;"> '.
$this->lang->line('sales_description_abbrv') .'</td>'.
}.'
<td colspan="2" style="text-align: left;">'.
if($item['allow_alt_description']==1) //error
{
echo form_input(array('name'=>'description', 'class'=>'form-control input-sm', 'value'=>$item['description']))
}
else
{
if ($item['description']!='')
{
echo $item['description'];
echo form_hidden('description', $item['description'])
}
else
{
$this->lang->line('sales_no_description')
form_hidden('description','')
}
}
.'
</td>
<td> </td>
<td style="color: #2F4F4F;">'.
if($item['is_serialized']==1)
{
$this->lang->line('sales_serial')
}.
'</td>
<td colspan="4" style="text-align: left;">'.
if($item['is_serialized']==1)
{
form_input(array('name'=>'serialnumber', 'class'=>'form-control input-sm', 'value'=>$item['serialnumber']))
}
else
{
form_hidden('serialnumber', '')
}
.'
</td>
</tr>';
form_close()
}
}
echo $output;