get data from array in controller OpenCart -


i have array in controller file:

$total_data = array();                  $totals = $this->model_sale_order->getordertotals($order_id);                  foreach ($totals $total) {                     $total_data[] = array(                         'title' => $total['title'],                         'text'  => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']),                     );                 } 

how pass 'text' in same controller file? example:$text = $total['text'];i getting error undefined index: text in.... problem?

i don't know want do, can send variable controller view $data in opencart 2.x

you can send $total_data tpl file way:

$data['total_data'] = $total_data; 

so code must be:

$total_data = array();  $totals = $this->model_sale_order->getordertotals($order_id);  foreach ($totals $total) {     $total_data[] = array(         'title' => $total['title'],         'text'  => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value'])     ); }  $data['total_data'] = $total_data; 

and use in view (tpl file):

<?php      foreach($total_data $total){         echo $total['text'];      } ?> 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -