Prestashop 1.7 Override CmsController - overriding

In prestashop v1.7.4.2, with VisualComposer installed,
after I bought another module named: FormBuilder, can't enable and cause error like this:
Cannot enable module gformbuilderpro. Unable to install override: The
method initContent in the class CmsController is already overridden by
the module jscomposer version 4.4.7 at 2018-08-25 18:20:10 .
any knowledge or instruction to solve this conflict?
screenshot

You have 2 override:
1- jscomposer => override => cmsController => initContent
2- gformbuilderpro => override => cmsController => initContent
Second method has conflict with first method
Solution:
1- remove initContent method from gformbuilderpro module
2- merge content of both initContent methods on this path :
root/override/controllers/front/CmsController.php
3- install gformbuilderpro module and enjoy PrestaShop
!!!! It's better to put new merged initContent method on jscomposer for future changes

Related

Typo3 V8: uninstall extensions manually

My Backend shows an error due to an incompatible extension. How can I uninstall it manually? In Typo3 V7 I could edit PackageStates.php like this:
'myownext' => [
'packagePath' => 'typo3conf/ext/myownext/',
'state' => 'inactive',
],
But V8 removed all state keys - and it does not listen to this key if I add it manually. When I remove the whole entry from the file it is added again after refresh of the BE.
TYPO3 8.7.19: If I remove an entry of an extension in PackageStates.php the extension is disabled. As example I disable powermail by removing the following entry:
'powermail' => [
'packagePath' => 'typo3conf/ext/powermail/',
],
Don't forget to load the file PackageStates.php after editing again on the server-

Limit languages in cms

I use silverstripe 3.1
I would like to limit the languages (To only German and English) which are available in the drop down in the CMS. Therefore I put
the following code in my mysite/_config.php
i18n::set_locale('de_DE');
$allowed_locales = array(
'de_DE' => array('Deutsch', 'Deutsch'),
'en_EN' => array('English', 'English')
);
i18n::$common_locales = $allowed_locales;
Afer a flush=1 i get the following error:
Fatal error: Cannot access private property i18n::$common_locales in ... _config.php
Any ideas what goes wrong?
Thank you
as of 3.1 most of the static php variables are private. this means you can no longer access those.
the reason for this api change is that they are now cached by the config layer (this is also why you have to ?flush=1 now after changing private statics in classes like for example with private static $db)
if you want to update something in the config layer, you can do this with:
Config::inst()->update('CLASS', 'FIELD', $value);
you could use use the config update to overwrite the common locales (class would be 'i18n', and field would be 'common_locales'):
Config::inst()->update('i18n', 'common_locales', $array);
Note: if you want to completely overwrite an existing configuration, you have to do a remove() first.
Config::inst()->remove('i18n', 'common_locales');
Config::inst()->update('i18n', 'common_locales', $array);
however, if you are using the translatable module and you want to limit the number of translatable languages, there is a much better way already built in:
// in your _config.php
i18n::set_locale('en_US');
Translatable::set_allowed_locales(array(
'de_DE',
'en_US',
));
Config it through YAML:
i18n:
common_locales:
nl_BE:
name: Dutch (Belgium)
native: Nederlands
fr_BE:
name: French (Belgium)
native: Francais

How to use Facebook PHP SDK with Zend Framework 2

I want to be able to use the Facebook PHP SDK with the new ZEND Framework 2 platform. How to do it?
Zend Framework 2 is quite different as previous version ZF1.
When I try the standard PHP in the main application controller IndexController':
require_once("facebook.php");
class IndexController extends AbstractActionController
{
public $facebook;
public function __construct() {
$this->facebook = new Facebook(array(
'appId' => 'appId',
'secret' => 'secret_key'
));
}
/*
...
*/
}
I get following error: Fatal error: Cannot redeclare class Facebook in /../module/Application/src/Application/Controller/Facebook.php on line 160
According to that error message the problem is that you now have two classes called Facebook in that namespace. Try ensuring you only have one class called Facebook.
I had the same problem when I needed to include the Facebook SDK in a ZF2 application.
You don't need to use any additional modules for FB SDK integration. The trick is to include the facebook library with ClassMapAutoloader, e.g.:
array(
'Facebook' => 'vendor/FB/facebook.php',
)
Detailed instructions are here
I can't help you specifically on the difference between ZF1 & ZF2 but a simple search in google gave me this result, I think because ZF autoloads classes and you tried to require it again they are in conflict.

Symfony2 class loader doesnt work if path does not match folder structure?

Here is my current structure
plugins/
|---init.php
|---/plugin1/lib/
|---/plugin2/lib/
|---/Symfony/
I have my code like this:
set_include_path(DIR_FS_CATALOG.'plugins');
require_once(DIR_FS_CATALOG.'plugins/Symfony/Component/ClassLoader/UniversalClassLoader.php');
// load the class loader and dependency injection component
$loader = new Symfony\Component\ClassLoader\UniversalClassLoader();
$loader->registerNamespaces(array('plugins\\plugin1' => __DIR__.'/plugins/plugin1/lib', 'plugins' => DIR_FS_CATALOG.'plugins'));
$loader->registerNamespace('Symfony',__DIR__.'/plugins');
$loader->register();
use plugins\plugin1\MyClass;
MyClass::init();
Fatal error: Class 'plugins\plugin1\MyClass' not found
I wonder what did I do wrong? Any help would be much appreciated.
The Symfony2 class loader is PSR-0 compliant (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) which means, that your namespaces must reflect your file system structure.

How to install or integrate bundles in Symfony2

i have downloaded a sonata admin bundle, and have placed in /var/www/Symfony/vendor/symfony/src/Symfony/Bundle, and have made an entry in AppKernel.php as $bundles = array( ... new Symfony\Bundle\SonataAdminBundle\SonataAdminBundle(),), but throwing an error as
Fatal error: Class
'Symfony\Bundle\SonataAdminBundle\SonataAdminBundle' not found in
/var/www/Symfony/app/AppKernel.php on line 21 Call Stack: 0.0001
326332 1. {main}() /var/www/Symfony/web/app_dev.php:0 0.0122 1121592
2. Symfony\Component\HttpKernel\Kernel->handle()
please help me as i am very new to symfony 2. As a whole please give a link or detail like how to install/configure any bundle that is downloaded.
Thanks
Ravi.M
You need to move the bundle to
/var/www/Symfony/vendor/bundles
Then in AppKernel.php add
new Sonata\AdminBundle\SonataAdminBundle(),
in your $bundles array.
In autoload.php add
'Sonata' => __DIR__.'/../vendor/bundles',
to the $loader->registerNamespaces array
First off, SonataAdminBundle lives in Sonata namespace, not Symfony. So you'll have to rewrite the instantiation in app/AppKernel.php to:
new Sonata\AdminBundle\SonataAdminBundle()
You also have to register namespace in app/autoload.php:
$loader->registerNamespaces(array(
...
'Sonata' => __DIR__.'/path/to/parent/of/Sonata/folder'
...
));

Resources