1

I am using opencart 2.3.0.2 on xampp and I have this issue when I load the language file to the view it doesn't work here's the controller C:\xampp\htdocs\opencart2302\catalog\controller\product\categorieslist.php:

<?php 
class ControllerProductCategoriesList extends Controller {
    public function index(){
        $this->load->language('product/categorieslist');

        $data = array();

        $data['test'] = "this is text from controller";

        $this->response->setOutput($this->load->view('product/categorieslist',$data));
    }
    // public function add(){
    //     echo "this is add method call from CPC";
    // }
}

?>

and here's the language file
C:\xampp\htdocs\opencart2302\catalog\language\en-gb\product\categorieslist.php :

 <?php 
//Text
$_['title']             = 'All Categories';
$_['meta_title']        = 'All Categories';
$_['meta_description']  = 'All Categories';
$_['meta_keyword']      = 'All Categories';
$_['categories_text']   = 'This is categories list page 2';

and here's the view file C:\xampp\htdocs\opencart2302\catalog\view\theme\default\template\product\categorieslist.tpl :

 <?php echo $meta_keyword; ?>
<?php echo $test; ?>
HamzaWe
  • 23
  • 3

1 Answers1

0

In your controller file you must define meta_keyword

after

$data['test'] = "this is text from controller";

add

$data['meta_keyword'] = $this->language->get('meta_keyword');
K. B.
  • 1,388
  • 2
  • 13
  • 25
  • Yes that did worked, I was watching a video about opencart module development and the guy didn't actually do that he was using opencart 3.0.2.0 he want straight to twig file and he just print {{ meta_keyword }} – HamzaWe Oct 20 '22 at 07:03