[eluser]buddyram[/eluser]
Code: ....
....
//PRINTS THE TABLE HEADER PART
<?php if ($vendor) {?>
<?php if (!isset($page_navi)) $page_navi='';?>
<?php if(uri_assoc('get_print',4)) if(isset($total_pendings)) echo '<br/><span>'.$this->lang->line('total_pending_payment').' : '.display_currency($total_pendings).'</span>';?>
<table class="table_style" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php if (isset($sort_links) AND $sort_links == TRUE) {?>
<?php if (!isset($hide_links)) {?> <th><?php echo $this->lang->line('slno');?></th><?php }?>
<th><?php echo anchor("vendor/index/order_by/vendor_id".$page_navi, $this->lang->line('v_id'));?></th>
<th><?php echo anchor("vendor/index/order_by/vendor_name".$page_navi, $this->lang->line('v_name'));?></th>
<th><?php echo anchor("vendor/index/order_by/phone_no".$page_navi, $this->lang->line('phone_number'));?></th>
<th><?php echo anchor("vendor/index/order_by/fax_no".$page_navi, $this->lang->line('fax_number'));?></th>
<th><?php echo anchor("vendor/index/order_by/email".$page_navi, $this->lang->line('email_address'));?></th>
<th><?php echo anchor("vendor/index/order_by/web_address".$page_navi, $this->lang->line('web_address'));?></th>
<!-- Marked out for vendor-->
<!--<th class="col_balance"><php echo anchor('invoices/index/order_by/balance'.$page_navi, $this->lang->line('balance'));?></th>-->
<?php } else {?>
<?php if (!isset($hide_links)) {?> <th><?php echo $this->lang->line('slno');?></th><?php }?>
<th><?php echo $this->lang->line('s_date');?></th>
<th><?php echo $this->lang->line('v_name');?></th>
<th class="col_amount"><?php echo $this->lang->line('v_id');?></th>
<!-- Marked out for vendor-->
<!--<th class="col_balance"><php echo $this->lang->line('balance');?></th>-->
<?php }?>
<?php if (!isset($hide_links)) {?>
<th>Payment</th>
<th><?php echo $this->lang->line('pdf');?></th>
<th><?php echo $this->lang->line('html');?></th>
<?php /*?> <th align="center"><?php echo $this->lang->line('view');?></th><?php */?>
<th><?php echo $this->lang->line('email');?></th>
<th><?php echo $this->lang->line('edit');?></th>
<th><?php echo $this->lang->line('delete');?></th>
<th><?php echo $this->lang->line('print');?></th>
<?php }?>
</tr>
//PRINTS THE TABLE DETAILS HERE IN THE FOREACH LOOP
<?php $i=1;if(uri_assoc('page'))if(uri_assoc('page')>1)$i=((uri_assoc('page')-1)*200)+1; foreach ($vendor as $vendor1) {?>
<tr>
<?php if (!isset($hide_links)) {?> <td class="center"><?php echo $i++;?></td><?php }?>
<!--<td><php echo $invoice->supplied_date;?></td> //format_date($invoice->supplied_date);-->
<td><?php echo $vendor1->vendor_id;?></td> <!--//format_date($invoice->supplied_date);-->
<td><?php echo $vendor1->vendor_name;?></td> <!--//format_date($invoice->supplied_date);-->
<td><?php echo $vendor1->phone_no;?></td> <!--//format_date($invoice->supplied_date);-->
<td><?php echo $vendor1->fax_no;?></td> <!--//format_date($invoice->supplied_date);-->
<td><?php echo $vendor1->email;?></td> <!--//format_date($invoice->supplied_date);-->
<td><?php echo $vendor1->web_address;?></td> <!--//format_date($invoice->supplied_date);-->
<!--<td><php echo anchor('clients/details/client_id/' . $invoice->client_id, $invoice->to_client_name);?></td>-->
<!--<td class="col_amount"><php echo display_currency($invoice->amount_invoice);?></td>-->
<!-- Marked out for vendor-->
<!--<td class="col_balance"><php echo display_currency($invoice->amount_balance);?></td>-->
<?php if (!isset($hide_links)) {?>
<td align="center"><?php echo anchor('payments/form/invoice_id/' . $vendor1->vendor_id,' ',array('class'=>"add"));?></td>
<td><?php echo anchor('invoices/generate_pdf/invoice_id/' . $vendor1->vendor_id,' ',array('class'=>"pdf",'target'=>"_blonk"));?></td>
<td><?php echo anchor('invoices/generate_html/invoice_id/' . $vendor1->vendor_id, ' ',array('class'=>"html",'target'=>"_blonk"));?></td>
<?php /*?><td><?php echo anchor('invoices/generate_pdf/invoice_id/' . $invoice->invoice_id,'pdf','target=_blonk');?> / <?php echo anchor('invoices/generate_html/invoice_id/' . $invoice->invoice_id, 'html','target=_blonk');?></td><?php */?>
<td><?php echo anchor('invoices/send_email/form/invoice_id/' . $vendor1->vendor_id,' ',array('class'=>"email",'target'=>"_blonk"));?></td>
<td><?php echo anchor('vendor/form/vendor_id/' . $vendor1->vendor_id,' ', array('class'=>'edit'));?></td>
<!--<td><php echo anchor('vendor/edit/vendor_id/' . $vendor1->vendor_id,' ',array('class'=>"edit"));?></td>-->
<td><?php echo anchor('vendor/delete/vendor_id/' . $vendor1->vendor_id,' ', array('class'=>"delete",'onclick'=>"[removed]if(!confirm('" . $this->lang->line('confirm_delete') . "')) return false"));?></td>
<td><?php echo anchor('invoices/generate_print/invoice_id/' . $vendor1->vendor_id,' ',array('class'=>"print",'onclick'=>"[removed]return get_print($vendor1->vendor_id)"));?></td>
<?php }?>
</tr>
<?php }?>
</table>
[eluser]meigwilym[/eluser]
Right at the top of your view, add the following code:
Code: <?php
echo '<pre s_tyle="background:#fff;padding:12px;font-family:monospace;margin:12px;border:1px solid red;">code>';
var_dump($vendor1);
echo '</code></pre>';
?>
This will print out what the $vendor1 object contains. Feel free to post it here if you still aren't any better off.
Mei
PS remember to remove the underscore in the style attribute of the <pre> element.
[eluser]InsiteFX[/eluser]
This is not telling me anything, were are you getting this $vendor1 information from?
If it is in a model show the model were you are getting the vendor infromation!
[eluser]buddyram[/eluser]
My Doubt is why it not pulling the details to vendor_edit page but working fine in the vendor_display file!
Code: //Controller file: vendor.php
function index.php()
{
$this->_post_handler();
$page_navi='';
$this->redir->set_last_index();
$vendor = $this->mdl_vendor->get(array('limit'=>200,'paginate'=>TRUE, 'page'=>uri_assoc('page'),
'where'=>array('vendor_id'=>uri_assoc('vendor_id')), 'order_by'=>$order_by));
//This statement is included in many if...else but only instance of this stmt is mentioned here
$data = array(
'vendor' => $vendor,
'page_links' => TRUE,
'sort_links' => TRUE,
'page_navi' => $page_navi
);
$this->load->view('index', $data); //Loading the view
}
//Models file: mdl_vendor.php
function get($params=NULL)
{
$this->_prep_params($params);
$this->_prep_joins();
$query = $this->db->get($this->table_name);
$this->_prep_pagination($params);
if (isset($params['where'][$this->primary_key])) {
$result = $query->row();
if ($result) {
$result->vendor = $this->get_items(array('vendor_id'=>$result->vendor_id));
}
return $result;
}
else {
return $query->result();
}
}
//get_items file
function get_items($params = NULL) {
$this->db->select('*, qty * unit_price AS line_price', FALSE);
if (isset($params['vendor_id'])) {
$this->db->where('vendor_id', $params['vendor_id']);
}
if (!isset($params['order_by'])) {
$this->db->order_by('vendor_id');
}
$query = $this->db->get('din_vendor');
if (isset($params['vendor_id'])) {
return $query->row();
}
else {
return $query->result();
}
}
[eluser]InsiteFX[/eluser]
Step through them one by one then remark them out!
Code: //Models file: mdl_vendor.php
function get($params=NULL)
{
$this->_prep_params($params);
$this->_prep_joins();
$query = $this->db->get($this->table_name);
$this->_prep_pagination($params);
if (isset($params['where'][$this->primary_key])) {
$result = $query->row();
if ($result) {
$result->vendor = $this->get_items(array('vendor_id'=>$result->vendor_id));
}
// add to check for values
print_r($result);
exit();
return $result;
}
else {
// add to check for values
print_r($query->result());
exit();
return $query->result();
}
}
//get_items file
function get_items($params = NULL) {
$this->db->select('*, qty * unit_price AS line_price', FALSE);
if (isset($params['vendor_id'])) {
$this->db->where('vendor_id', $params['vendor_id']);
}
if (!isset($params['order_by'])) {
$this->db->order_by('vendor_id');
}
$query = $this->db->get('din_vendor');
if (isset($params['vendor_id'])) {
// add to check for values
print_r($query->row());
exit();
return $query->row();
}
else {
// add to check for values
print_r($query->row());
exit();
return $query->result();
}
}
[eluser]buddyram[/eluser]
thanx for your incessant support, actually i had to initialize the variables in the mdl_vendor constructor function, but i hadn't. Now am a able to pass the value for editing.
Thanx Again!!
Kindly recommend me any good book on codeignitor please
|