« first day  last day (14 days later) » 

5:15 AM
@RameshS Hey
Can you give me a sign if you're online, I'll keep stack open for a while
 
5:35 AM
@DevNiels Hi
 
Goodmorning!
 
Yeah gud morng bro
<?php foreach($dealerData as $invoice){ ?>
<label> <b>Dealer Name:</b>&nbsp;<?php echo $invoice['name']; ?></label><br>
<label><b>Dealer TIN Number:</b>&nbsp;<?php echo $invoice['tin_number'];?></label><br>
<?php } ?>
$query13 = $this->db->query("select concat(firstname, ' ', lastname) as name, tin_number from ".DB_PREFIX."customer where customer_id='".$customer_id."'");
$dataDelar = $query13->rows;
foreach ($dataDelar as $dealer) {
$data['dealerData'][] = array(
'name' => $dealer['name'],
'tin_number' => $dealer['tin_number']
);
}
this is the code am used
 
Can you put the <?php print_r($dealerData); ?> in your tpl file?
You tried that in your controller right?
 
ya i put but showing NULL
see above pic
 
It looks like you are doing something with that variable than
Because it can't go from and array to a null value out of nowhere ;)
Also, I already noticed before, why do you have queries in your controllers?
 
5:42 AM
Actually this is my friend project. Already one developer did this project
He put queries in controller, i changed that but it showing lots of error that's why
 
I work with a rebuilded version of OpenCart at my job, so I know a lot of the structure but I can mistake myself sometimes in the normal versions.
I think the normal version of OpenCart contains an error logging system
That shows you SQL errors as well.
 
Ya you right.. :)
How can i fix this..? any idea
 
Find the reason how $dealerData goes from an array to a null value, you can put debug (print_r()'s) in your code to see where the variable is changed ;)
 
Ya sure just wait i ll change and tell you.. :)
 
I'm going nowhere the next 7 hours haha
 
5:50 AM
Nothing happed bro NULL also gone
@DevNiels It's ok bro enjoy your day...! :)
 
Is it working?
 
Nop
 
Can you put the print_r after your before and after your <?php echo $header ?> in the .tpl file?
And also at the end of your controller, but put some <br/> after it to make it clear where it comes from.
 
Nothing display
 
Did you put $data['dealerData'] = []; before your foreach loop?
 
5:56 AM
$query13 = $this->db->query("select concat(firstname, ' ', lastname) as name, tin_number from ".DB_PREFIX."customer where customer_id='".$customer_id."'");
$dataDelar = $query13->rows;
$data['dealerData'] = [];
foreach ($dataDelar as $dealer) {
$data['dealerData'][] = array(
'name' => $dealer['name'],
'tin_number' => $dealer['tin_number']
);
}
 
if you put a print_r on $dataDelar ?
 
@DevNiels Yeah i put
@DevNiels ya
 
That works, or does it print NULL also?
 
showing empty space
 
var_dump($dataDelar) ?
 
6:01 AM
@DevNiels If am using var_dump($dataDelar) showing NULL
 
You have no error in your log?
 
ya no error displayed
I don't understand what happen... :(
 
var_dump($customer_id);
$query13 = $this->db->query("SELECT concat(firstname, ' ', lastname) as name, tin_number FROM ".DB_PREFIX."customer WHERE customer_id='".$customer_id."'");
if($query13->num_rows == 0) echo 'No results';
 
var_dump($customer_id);
$query13 = $this->db->query("SELECT concat(firstname, ' ', lastname) as name, tin_number FROM ".DB_PREFIX."customer WHERE customer_id='".$customer_id."'");
if($query13->num_rows == 0){
echo 'No results';
} else{
echo 'success';
}
am using your code
showing result like string(2) "25" success
 
Put print_r($query13->rows); after that if/else check.
 
6:08 AM
Result: string(2) "25" successArray ( [0] => Array ( [name] => Admonk test [tin_number] => 55441 ) )
 
$query13 = $this->db->query("SELECT concat(firstname, ' ', lastname) as name, tin_number FROM ".DB_PREFIX."customer WHERE customer_id='".$customer_id."'");
$data['dealerData'] = [];
if($query13->num_rows > 0){
foreach($query13->rows as $row) {
$data['dealerData'][] = [
'name' => $row['name'],
'tin_number' => $row['tin_number']
];
}
}

print_r($data['dealerData']);
Works for me man
 
For me it's not working
Bro still .tpl file showing NULL
 
If you use ['lalala'] and not $data['dealerData']?
$query13 = $this->db->query("SELECT concat(firstname, ' ', lastname) as name, tin_number FROM ".DB_PREFIX."customer WHERE customer_id='".$customer_id."'");
$data['lalala'] = [];
if($query13->num_rows > 0){
foreach($query13->rows as $row) {
$data['lalala'][] = [
'name' => $row['name'],
'tin_number' => $row['tin_number']
];
}
}

print_r($data['lalala']);
 
Result: Array ( [0] => Array ( [name] => Admonk test [tin_number] => 55441 ) )
In tpl NULL
 
Copy/paste your whole controller function please
 
6:17 AM
ya suer
public function add() {

$this->load->language('account/account');
$this->document->setTitle($this->language->get('heading_title'));

$data['breadcrumbs'] = array();

$data['breadcrumbs'][] = array(
'text' => $this->language->get('Home'),
'href' => $this->url->link('common/home')
);

$data['breadcrumbs'][] = array(
'text' => $this->language->get('Previous'),
'href' => $this->url->link('account/invoice', '', 'SSL')
);

$this->load->model('account/add_invoice');
$data['action'] = $this->url->link('account/invoice/add', '', 'SSL');
Your code in line no 57
 
$data = $this->load->language('account/account');
First line in the add function
 
ya i put
 
Because you are not defining the $data variable
This is the reason why you need to devide / organise your controllers and models
 
But still NULL values
*displaying
Oh my god
 
Is your view doing something with the $data variable?
Because your data variable is getting fcked somewhere man
 
6:27 AM
Ya it's okay thanks for your time bro :)
 
No problem
 
i ll tick your answer
 
Would be nice, thank you
Have a great day
 
:)
You too bro
 
7:26 AM
@DevNiels Bro finaly i did it
see my code if ($this->request->server['REQUEST_METHOD'] == 'POST')
under this function i put your code its working now
 

« first day  last day (14 days later) »