Opencart vqmod 2.3.0.2 $config error - config

i have just installed opencart 2.3.0.2 and vqmod but i am facing a problem now. In previous version of opencart when i was using the below code in vqmod xml file
global $config;
$variableA = $config->get('field_value');
then in $variableA i got the value which i saved in the db from admin section but now in 2.3.0.2 when i use this code it shows fatal error
Fatal error: Call to a member function get() on null
please tell me how can i get the value in vqmod xml file so i can use this variable further
Thanks

Define the variable in a file controller first:
$data['variableA'] = $this->config->get('variableA');
then (for example) echo the variable in a view file:
<?php echo $variableA; ?>

Related

How do I solve fusionauth php client error 'FusionAuthClient' not found?

when I follow https://github.com/FusionAuth/fusionauth-php-client
I can see error:
PHP Fatal error: Uncaught Error: Class 'FusionAuthClient' not found ... on line 6
My application looks like this:
First application
<?php
require_once 'FusionAuthClient.php';
$apiKey = "7W-yBfeXfniDhu8PR_h0dGkSsPDJlpUYuP9rP2xXd_4";
$client = new FusionAuthClient($apiKey, "http://localhost:9011");
line 6 is last.
composer says all is right
$ composer require fusionauth/fusionauth-client
Using version ^1.6 for fusionauth/fusionauth-client
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing fusionauth/fusionauth-client (1.6.1)
Downloading: 100%
Writing lock file
Generating autoload files
FusionAuthClient.php, ClientResponse.php and RESTClient.php are in the same directory as my test script.
Can you point me into the right direction what is cause of this problem?
Have you looked at the first line of the FusionAuthClient.php file? apparently not.
namespace FusionAuth;
Therefore, the class is not in the global namespace, therefore you need to tell php which namespace it's in:
$client = new FusionAuth\FusionAuthClient($apiKey, "http://localhost:9011");
You're welcome.
That looks the require_once function path is invalid
Do have you same bug when using "require" and not "require_once"?

Prestashop 1.6.1.4 - Undefined constant for custom module

We have upgraded from Prestashop 1.6.0.9 to 1.6.1.4. After updating to new version one of our custom module started throwing Fatal Error like :
PHP ERROR
We have defined this constant in the classes/pdf/PDF.php file.
I am not able to trace the error as it was working previously. Any help or reference will be appreciated.
Try to define this constant in your custom module like that:
if (!defined('TEMPLATE_PRODUCT_RETURN'))
{
define('TEMPLATE_PRODUCT_RETURN', '...');
}

yii2 fileinput not working

I'm new in yii2.
On my project use kartik\file\Fileinput;
In local its good working and when upload to my host get this error:
in the first of my file this :
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\file\FileInput;
PHP Fatal Error – yii\base\ErrorException
Class 'kartik\file\FileInput' not found
1. in /home/user/domains/myhost.com/public_html/modules/admin/views/photos/_form.php
at line 27 18192021222324252627282930313233343536
echo $form->field($model, 'filename[]')->widget(FileInput::classname(), [...
Try this use kartik\widgets\FileInput; instead of use kartik\file\FileInput;

How add auto update functionality to prestashop plugin

I've create my first plugin for prestashop. I want to add autoupdate functionality for autoupdate as do for example eBay module.
I did not found anything about that on documentation.
I've been struggeling to figure out the correct process for this for a while.
I thought the "upgrade it" button was only available for developers, who release their modules through the prestashop addons website (which is true) but if you chose not to publish there, here's how you update your own modules:
In the main file of your model, within the contructor method, you must have this line of code:
$this->version = '1.0.0';
make a subdirectory in your module folder called upgrade
create a new file in this directory called install-1.0.1.php
put this code in the file:
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_0_1($object, $install = false)
{
//your code here, for example changes to the DB...
return true; //if there were no errors
}
?>
In your main file, change it to $this->version = '1.0.1';
Create a zip file of your module folder
Navigate to the Modules page on your stores back end, and say "upload new module"
Upload the zip file
Now you should see 2 messages:
The module was successfully downloaded.
and
The following module(s) were upgraded successfully:
MyModule :
Current version: 1.0.1
1 file upgrade applied
Prestashop Documentation.
You can also add an update file to your module: create an /upgrade folder in your module's folder, and put your update files in it, using the install-1.8.0.php name norm.
<?php
// Sample file for module update
if (!defined('_PS_VERSION_'))
exit;
// object module ($this) available
function upgrade_module_1_8_0($object)
{
// Your code to upgrade from version 1.8.0 of the module
}
?>

Apache Problem, phpinfo gives following arror

Simply calling phpinfo(); gives the following info..
Fatal error: Using $this when not in object context in /var/www/phpinfo.php on line 2
It is a fresh Ubuntu + Apache install on Amazon EC2.
not possible, there has to be something else in the file.
<?php
phpinfo();
?>
You might be using
$this->phpinfo();
Try using simply
phpinfo();
More info here http://php.net/manual/en/function.phpinfo.php