-1

I was created custom module. & use below code for get language file. So, it was working fine in OpenCart 1.5.6.4.

(admin\controller\module\custom.php)

$language = $this->load->language('module/custom');
$this->data = array_merge($this->data, $language);

but, it is not working in Opencart 2.0.

Get below error in admin side module in OpenCart 2.0

Warning: array_merge() [function.array-merge]: Argument #1 is not an array 

How can I fix it?

Would appreciate the help.

HDP
  • 4,005
  • 2
  • 36
  • 58
  • Please post `$this->data` since the warning says it's not an array – Rizier123 Nov 12 '14 at 05:55
  • if, i have use `$data = array_merge($this->data, $language);` though, create same error. – HDP Nov 12 '14 at 06:07
  • @HarnishDesign of course it would be the same error. It tells you that the first argument of function (`$this->data`) is not an array. Check the content of that variable. – Cheery Nov 12 '14 at 06:12
  • Thanks. I have remove `$this->data` from our code & it is working fine. Thanks you so much. – HDP Nov 12 '14 at 06:27

1 Answers1

0

I have remove $this->data from our code & it is working fine.

Correct code.

$data = array_merge($language);
HDP
  • 4,005
  • 2
  • 36
  • 58
  • It can also work with $this->data , array_merge expects first parameter to be an array ,you have to declare this variable as an array before using it. – Vaibhav Nov 12 '14 at 07:22
  • `array_merge($language)` - what do you think is the result of this call? Didn't you want to call `$data = array_merge($data, $language);`??? – shadyyx Nov 12 '14 at 07:58