We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I'm developping a custom module which generate categories, when I start the category generation I have the following error :
Fatal error: Uncaught Error: Call to a member function getLanguages() on null in C:\wamp64\www***\modules\gshoppingflux\gshoppingflux.php on line 160
To reproduce ->
Launch this php script :
`<?php
require dirname(FILE) . '../../../../config/config.inc.php'; require dirname(FILE) . '../../../../classes/Category.php';
$id_lang = Context::getContext()->language->id;
$mainCat = new Category; $mainCat->id_parent = 2; $mainCat->description = createMultiLangField(""); $mainCat->meta_description = createMultiLangField(""); $mainCat->meta_title = createMultiLangField(""); $mainCat->is_root_category = false; $mainCat->name = createMultiLangField(""); $mainCat->link_rewrite = createMultiLangField("**"); $mainCat->add();
$rootBrandId = $mainCat->id;
echo $bool;
function createMultiLangField($field) { $languages = Language::getLanguages(false); $res = array(); foreach ($languages AS $lang) $res[$lang['id_lang']] = $field; return $res; } ?>`
*** values are to protect potential sensitive informations.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I'm developping a custom module which generate categories, when I start the category generation I have the following error :
Fatal error: Uncaught Error: Call to a member function getLanguages() on null in C:\wamp64\www***\modules\gshoppingflux\gshoppingflux.php on line 160
To reproduce ->
Launch this php script :
`<?php
require dirname(FILE) . '../../../../config/config.inc.php';
require dirname(FILE) . '../../../../classes/Category.php';
$id_lang = Context::getContext()->language->id;
$mainCat = new Category;
$mainCat->id_parent = 2;
$mainCat->description = createMultiLangField("");
$mainCat->meta_description = createMultiLangField("");
$mainCat->meta_title = createMultiLangField("");
$mainCat->is_root_category = false;
$mainCat->name = createMultiLangField("");
$mainCat->link_rewrite = createMultiLangField("**");
$mainCat->add();
$rootBrandId = $mainCat->id;
echo $bool;
function createMultiLangField($field)
{
$languages = Language::getLanguages(false);
$res = array();
foreach ($languages AS $lang)
$res[$lang['id_lang']] = $field;
return $res;
}
?>`
*** values are to protect potential sensitive informations.
The text was updated successfully, but these errors were encountered: