Elriq Hunter Posted May 22, 2019 Share Posted May 22, 2019 Bonjour, Nouveau sur Prestashop, j'interviens sur un site en chantier laissé depuis 1 an en stand by. Impossible d'y accéder : Page blanche error 500. En activant debug, j'ai le message suivant : Fatal error: Declaration of AdminApPageBuilderPositionsController::setMedia() must be compatible with AdminControllerCore::setMedia($isNewTheme = false) in /home/elriqhunter/public_html/modules/appagebuilder/controllers/admin/AdminApPageBuilderPositions.php on line 23 Et là je sèche. Si une bonne âme peut éclairer ma lanterne, d'avance merci. Link to comment Share on other sites More sharing options...
Elriq Hunter Posted May 22, 2019 Author Share Posted May 22, 2019 (edited) Me semble que c'est la version 1.7 de Prestashop. l'ApPageBuilder est un module livré avec le thème Estilo. Si y'a moyen de virer ce thème en gardant la base pour que ce soit plus simple et revenir sur une base saine, je suis preneur. Edited May 22, 2019 by Elriq Hunter (see edit history) Link to comment Share on other sites More sharing options...
Elriq Hunter Posted May 22, 2019 Author Share Posted May 22, 2019 Je vois bien le dossier controller du module appagebuilder mais je ne saisis pas votre explication : Pour info je ne suis pas développeur. Link to comment Share on other sites More sharing options...
Elriq Hunter Posted May 22, 2019 Author Share Posted May 22, 2019 <?php /** * 2007-2015 Apollotheme * * NOTICE OF LICENSE * * ApPageBuilder is module help you can build content for your shop * * DISCLAIMER * * @author Apollotheme <[email protected]> * @copyright 2007-2015 Apollotheme * @license http://apollotheme.com - prestashop template provider */ if (!defined('_PS_VERSION_')) { # module validation exit; } require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageBuilderPositionsModel.php'); class AdminApPageBuilderPositionsController extends ModuleAdminControllerCore { public $position_js_folder = ''; public $position_css_folder = ''; public $module_name = 'appagebuilder'; public $explicit_select; public $order_by; public $order_way; public $theme_dir; public function __construct() { $this->bootstrap = true; $this->table = 'appagebuilder_positions'; $this->className = 'ApPageBuilderPositionsModel'; $this->lang = false; $this->explicit_select = true; $this->allow_export = true; $this->context = Context::getContext(); $this->order_by = 'position'; $this->order_way = 'DESC'; $this->_join = ' INNER JOIN `'._DB_PREFIX_.'appagebuilder_positions_shop` ps ON (ps.`id_appagebuilder_positions` = a.`id_appagebuilder_positions`)'; parent::__construct(); $this->fields_list = array( 'id_appagebuilder_positions' => array( 'title' => $this->l('ID'), 'align' => 'center', 'width' => 50, 'class' => 'fixed-width-xs' ), 'position' => array( 'title' => $this->l('Position'), 'width' => 140, 'type' => 'text', 'filter_key' => 'a!position', 'remove_onclick' => true ), 'name' => array( 'title' => $this->l('Name'), 'width' => 140, 'type' => 'text', 'filter_key' => 'a!name', 'remove_onclick' => true ), 'position_key' => array( 'title' => $this->l('Key'), 'filter_key' => 'a!position_key', 'type' => 'text', 'width' => 140, 'remove_onclick' => true ) ); $this->list_no_link = 'no'; $this->bulk_actions = array( 'delete' => array( 'text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash' ), 'correctlink' => array( 'text' => $this->l('Correct Image Link'), 'confirm' => $this->l('Are you sure you want to change image url from old theme to new theme?'), 'icon' => 'icon-edit' ), 'insertLang' => array( 'text' => $this->l('Auto Input Data for New Lang'), 'confirm' => $this->l('Auto insert data for new language?'), 'icon' => 'icon-edit' ) ); $this->_where = ' AND ps.id_shop='.(int)$this->context->shop->id; $this->theme_dir = _PS_ALL_THEMES_DIR_.apPageHelper::getThemeName().'/'; $this->position_css_folder = _PS_ALL_THEMES_DIR_.apPageHelper::getThemeName().'/modules/appagebuilder/css/positions/'; $this->position_js_folder = _PS_ALL_THEMES_DIR_.apPageHelper::getThemeName().'/modules/appagebuilder/js/positions/'; if (!is_dir($this->position_css_folder)) { mkdir($this->position_css_folder, 0755, true); } if (!is_dir($this->position_js_folder)) { mkdir($this->position_js_folder, 0755, true); } } public function processDelete() { $object = $this->loadObject(); // Check using other profile $result = ApPageBuilderPositionsModel::getProfileUsingPosition($object->id); if (!$result) { $object = parent::processDelete(); if ($object->position_key) { Tools::deleteFile($this->position_css_folder.$object->position.$object->position_key.'.css'); Tools::deleteFile($this->position_js_folder.$object->position.$object->position_key.'.js'); } } else { $name_profile = ''; $sep = ''; foreach ($result as $item) { $name_profile .= $sep.$item['name']; $sep = ', '; } $this->errors[] = sprintf($this->l('Can not delete position "%s", it is being used by Profile : "%s"'), $object->name, $name_profile); } return $object; } public function processBulkDelete() { // Remove resouce and update table profiles $arr = $this->boxes; if (!$arr) { return; } foreach ($arr as $id) { $profiles = ApPageBuilderPositionsModel::getProfileUsingPosition($id); $object = new ApPageBuilderPositionsModel($id); if (!$profiles) { $object->delete(); if ($object->position_key) { Tools::deleteFile($this->position_css_folder.$object->position.$object->position_key.'.css'); Tools::deleteFile($this->position_js_folder.$object->position.$object->position_key.'.js'); } } else { $name_profile = ''; $sep = ''; foreach ($profiles as $profile) { $name_profile .= $sep.$profile['name']; $sep = ', '; } $this->errors[] = sprintf($this->l('Can not delete position "%s", it is being used by Profile : "%s"'), $object->name, $name_profile); } } if (empty($this->errors)) { $this->confirmations[] = $this->_conf[1]; } } public function renderView() { $object = $this->loadObject(); $this->redirect_after = Context::getContext()->link->getAdminLink('AdminApPageBuilderHome'); $this->redirect_after .= '&id_appagebuilder_positions='.$object->id; $this->redirect(); } public function processStatus() { if (Validate::isLoadedObject($object = $this->loadObject())) { if ($object->toggleStatus()) { $matches = array(); if (preg_match('/[\?|&]controller=([^&]*)/', (string)$_SERVER['HTTP_REFERER'], $matches) !== false && Tools::strtolower($matches[1]) != Tools::strtolower(preg_replace('/controller/i', '', get_class($this)))) { $this->redirect_after = preg_replace('/[\?|&]conf=([^&]*)/i', '', (string)$_SERVER['HTTP_REFERER']); } else { $this->redirect_after = self::$currentIndex.'&token='.$this->token; } $id_category = (($id_category = (int)Tools::getValue('id_category')) && Tools::getValue('id_product')) ? '&id_category='.$id_category : ''; $this->redirect_after .= '&conf=5'.$id_category; } else { $this->errors[] = $this->l('You can not disable default profile, Please select other profile as default'); } } else { $this->errors[] = $this->l('An error occurred while updating the status for an object.').' <b>'.$this->table.'</b> '.$this->l('(cannot load object)'); } return $object; } public function postProcess() { parent::postProcess(); if (Tools::getIsset('duplicateappagebuilder_positions')) { if (!$this->access('add')) { $this->errors[] = $this->trans('You do not have permission to duplicate (permision add).', array(), 'Admin.Notifications.Error'); } else { $id = Tools::getValue('id_appagebuilder_positions'); $this->duplicatePosition($id, ''); } } # Delete POSITIONS NOT USE if (Tools::getValue('leo_delete_position') && Tools::getValue('leo_delete_position')) { apPageHelper::processDeleteOldPosition(); $this->confirmations[] = 'POSITIONS NOT USE have been deleted successfully.'; } } public function duplicatePosition($id, $type = '', $name = '') { $id = (int)$id; $object = ApPageBuilderPositionsModel::getPositionById($id); if ($object) { $key = ApPageSetting::getRandomNumber(); $old_key = $object['position_key']; $name = $name ? $name : $this->l('Duplicate ').$key; $data = array('name' => $name, 'position' => $object['position'], 'position_key' => 'duplicate_'.$key); $model = new ApPageBuilderPositionsModel(); $duplicate_id = $model->addAuto($data); AdminApPageBuilderShortcodesController::duplcateDataPosition($id, $duplicate_id); if ($duplicate_id) { //duplicate shortCode ApPageSetting::writeFile($this->position_js_folder, $data['position'].$data['position_key'].'.js', Tools::file_get_contents($this->position_js_folder.$data['position'].$old_key.'.js')); ApPageSetting::writeFile($this->position_css_folder, $data['position'].$data['position_key'].'.css', Tools::file_get_contents($this->position_css_folder.$data['position'].$old_key.'.css')); if ($type != 'ajax') { $this->redirect_after = self::$currentIndex.'&token='.$this->token; $this->redirect(); } else { return $duplicate_id; } } else { if ($type != 'ajax') { Tools::displayError('Can not duplicate Position'); } else { return 0; } } } else if ($type != 'ajax') { Tools::displayError('Can not duplicate Position'); } else { return 0; } } public function renderList() { $this->initToolbar(); $this->addRowAction('view'); $this->addRowAction('edit'); $this->addRowAction('duplicate'); $this->addRowAction('delete'); return parent::renderList(); } public function renderForm() { if (!$this->access('edit')) { // $this->errors[] = $this->trans('You do not have permission to edit.', array(), 'Admin.Notifications.Error'); return; } $this->initToolbar(); $this->context->controller->addJqueryUI('ui.sortable'); $this->fields_form = array( 'legend' => array( 'title' => $this->l('Ap Position Manage'), 'icon' => 'icon-folder-close' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'required' => true, 'hint' => $this->l('Invalid characters:').' <>;=#{}' ), array( 'type' => 'text', 'label' => $this->l('Position Key'), 'name' => 'position_key', 'required' => true, 'desc' => $this->l('Use it to save as file name of css and js of Position'), 'hint' => $this->l('Invalid characters:').' <>;=#{}' ), array( 'type' => 'select', 'label' => $this->l('Type'), 'name' => 'position', 'options' => array( 'query' => array( array( 'id' => 'header', 'name' => $this->l('Header'), ), array( 'id' => 'content', 'name' => $this->l('Content'), ), array( 'id' => 'footer', 'name' => $this->l('Footer'), ), array( 'id' => 'product', 'name' => $this->l('Product'), ) ), 'id' => 'id', 'name' => 'name' ), ), array( 'type' => 'textarea', 'label' => $this->l('Custom Css'), 'name' => 'css', 'desc' => sprintf($this->l('Please set write Permission for folder %s'), $this->position_css_folder), ), array( 'type' => 'textarea', 'label' => $this->l('Custom Js'), 'name' => 'js', 'desc' => sprintf($this->l('Please set write Permission for folder %s'), $this->position_js_folder), ) ), 'submit' => array( 'title' => $this->l('Save'), ), 'buttons' => array( 'save-and-stay' => array( 'title' => $this->l('Save and Stay'), 'name' => 'submitAdd'.$this->table.'AndStay', 'type' => 'submit', 'class' => 'btn btn-default pull-right', 'icon' => 'process-icon-save' )) ); return parent::renderForm(); } public function getFieldsValue($obj) { $file_value = parent::getFieldsValue($obj); if ($obj->id && $obj->position_key) { $file_value['css'] = Tools::file_get_contents($this->position_css_folder.$obj->position.$obj->position_key.'.css'); $file_value['js'] = Tools::file_get_contents($this->position_js_folder.$obj->position.$obj->position_key.'.js'); } else { $file_value['position_key'] = 'position'.ApPageSetting::getRandomNumber(); } return $file_value; } public function processAdd() { if ($obj = parent::processAdd()) { $this->saveCustomJsAndCss($obj->position.$obj->position_key, ''); } } public function processUpdate() { // Check ifchange position => need delete current file css/js before update $old_object = parent::loadObject(); if ($obj = parent::processUpdate()) { $this->saveCustomJsAndCss($obj->position.$obj->position_key, $old_object->position.$obj->position_key); } } public function saveCustomJsAndCss($key, $old_key = '') { // Delete old file if ($old_key) { Tools::deleteFile($this->position_css_folder.$old_key.'.css'); Tools::deleteFile($this->position_js_folder.$old_key.'.js'); } //DONGND:: validate // if (!empty(Tools::getValue('js'))) { if (Tools::getValue('js') != '') { ApPageSetting::writeFile($this->position_js_folder, $key.'.js', Tools::getValue('js')); } //DONGND:: validate // if (!empty(Tools::getValue('css'))) { if (Tools::getValue('css') != '') { ApPageSetting::writeFile($this->position_css_folder, $key.'.css', Tools::getValue('css')); } } /** * Auto create a position for page build profile editing/creating * @param type $obj */ public function autoCreatePosition($obj) { $model = new ApPageBuilderPositionsModel(); $id = $model->addAuto($obj); if ($id) { $this->saveCustomJsAndCss($obj['position'].$obj['position_key'], ''); } return $id; } public function updateName($id, $name) { return ApPageBuilderPositionsModel::updateName($id, $name); } public function initToolbar() { # Delete POSITIONS NOT USE switch ($this->display) { default: $this->toolbar_btn['eraser'] = array( 'href' => self::$currentIndex.'&leo_delete_position=1&token='.$this->token, 'desc' => $this->l('Delete position do not use (fix error when create profile)'), 'imgclass' => 'eraser', 'class' => 'leo_delete_position', ); } parent::initToolbar(); } public function setMedia() { parent::setMedia(); Context::getContext()->controller->addJs(apPageHelper::getJsAdminDir().'admin/form_admin_positions.js'); Media::addJsDefL('leo_confirm_text', $this->l('Are you sure you want to Delete do not use position. Please back-up all thing before?')); Media::addJsDefL('leo_form_submit', Context::getContext()->link->getAdminLink('AdminApPageBuilderPositions')); } public function displayDuplicateLink($token = null, $id = null, $name = null) { $controller = 'AdminApPageBuilderPositions'; $token = Tools::getAdminTokenLite($controller); $html = '<a href="#" title="Duplicate" onclick="confirm_link(\'\', \'Duplicate Position ID '.$id.'. If you wish to proceed, click "Yes". If not, click "No".\', \'Yes\', \'No\', \'index.php?controller='.$controller.'&id_appagebuilder_positions='.$id.'&duplicateappagebuilder_positions&token='.$token.'\', \'#\')"> <i class="icon-copy"></i> Duplicate </a>'; // validate module unset($name); return $html; } } Ci-dessus le contenu du fichier AdminApPageBuilderPositions Link to comment Share on other sites More sharing options...
Elriq Hunter Posted May 22, 2019 Author Share Posted May 22, 2019 C'est fait mais le post est hidden. Validation par le forum ? Link to comment Share on other sites More sharing options...
Elriq Hunter Posted May 22, 2019 Author Share Posted May 22, 2019 3 hours ago, okom3pom said: @ttoine tu pourrais valider le post de Hunter Si compliqué, possible de virer manuellement via ftp et base de donnée le thème installée et les modules qui y sont associés ? D'avance merci. Link to comment Share on other sites More sharing options...
Webmain Posted May 22, 2019 Share Posted May 22, 2019 Ajouter un X au dossier du module Xappagebuilder Ce qui devrais débloquer le site déjà. La positions du module n'est pas ok. Ensuite si tu veux réinstaller le module si il est du thème tu peu surement le retrouvé dans catalogue de module Tu recherche appage... Link to comment Share on other sites More sharing options...
Elriq Hunter Posted May 22, 2019 Author Share Posted May 22, 2019 Nickel, je peux enfin y accéder. Un immense merci Link to comment Share on other sites More sharing options...
Webmain Posted May 22, 2019 Share Posted May 22, 2019 Pas de problème merci de mettre le poste en résolu. Link to comment Share on other sites More sharing options...
Webmain Posted May 22, 2019 Share Posted May 22, 2019 le Dossier est juste désactiver sans pour autant que sa gêne au fonctionnement du site.au lieu de le désactiver via le bo tu le désactive via le ftp. Il peu tout a fait le remettre si le module est vraiment utile. La il voulais juste l’enlever car il change apparement carrément son thème donc le module peu être inutile pour la suite. Link to comment Share on other sites More sharing options...
Webmain Posted May 22, 2019 Share Posted May 22, 2019 tu n’as pas suivis le sujet ? Il dit qu’il a ce bug est que c’est module lier au thème plus bas il dit si il as un moyen de virer ce thème est repartir sur une base Seine. Donc le fait de désactiver le module il a maintenant l accès ensuite pour l desinstalle le thème est les modules lier puis il refait l installation du thème ce qui installera de nouveau ce module il pourra ensuite supprimer le dossier renommer qui n’a plus aucune utilité. Donc en gros plus de problème à moins que le’ module sois encore en cause chose qui est peu être pas le cas puisqu’il n’est pas revenu indiquer que c’est de nouveau ce bug. Je suis d accord avec toi sur le fait qu’il faut dépanner l erreur. Si il viens sur le forum c’est pour demander de l aide tout en sachant que le module qu’il as achetez ou le thème n’est plus en support vue que cela fait plus d’1 an, à moins que tu ai la solution pour résoudre son code je ne vois rien d autres que celle que j’ai donner et qui a fonctionner. Bonne soirée Link to comment Share on other sites More sharing options...
Webmain Posted May 22, 2019 Share Posted May 22, 2019 Oui donc juste ajouter la fonction false pour dire de désactiver la position Link to comment Share on other sites More sharing options...
Elriq Hunter Posted May 23, 2019 Author Share Posted May 23, 2019 Bonjour, Merci pour vos conseils. Je souhaitais effectivement avoir accès au tableau de bord prestashop afin de virer le thème installé et repartir sur une base clean. Les manip d'hier ont par contre eu comme conséquence une error 500 sur plusieurs pages (catégories, produits...) hors accueil. Avec le mode debug sur la page produit : (1/1) FatalThrowableError Appel à une fonction membre buildShortCode () sur un booléen dans la ligne 27 de ProductController.php à ProductController -> getTemplateVarProduct ()dans la ligne 336 de ProductController.php sur ProductControllerCore -> initContent ()dans la ligne Controller 281 sur ControllerCore -> run ()dans la ligne 511 de Dispatcher.php sur DispatcherCore -> dispatch ()dans index.php ligne 28 Donc... y'a t il un moyen de réinitialiser prestashop en gardant le contenu, ou de corriger les erreurs citée, ou de carrément tout virer ? D'avance merci. Link to comment Share on other sites More sharing options...
Webmain Posted May 23, 2019 Share Posted May 23, 2019 Bonjour, avez vous supprimer le thème déjà ou non ? Enlever le X du module est essayer le Patch donner plus haut. Link to comment Share on other sites More sharing options...
Elriq Hunter Posted May 23, 2019 Author Share Posted May 23, 2019 Oui, j'ai supprimé le thème installé. Link to comment Share on other sites More sharing options...
Elriq Hunter Posted May 23, 2019 Author Share Posted May 23, 2019 Dans le gestionnaire de modules, il n'y a plus de module fiche produit, paiement, livraison&logistique, trafic, clients, réseaux sociaux, spécialisations. Ca fait beaucoup... Je pense que je vais aller à l'essentiel : tout virer. Faut-il réinstaller le thème de base ou y'a t il une manip particulière ? Link to comment Share on other sites More sharing options...
Webmain Posted May 23, 2019 Share Posted May 23, 2019 Ola il a eu quoi ce prestashop ? bah Le mieux si tu veux tout recommencer créer une nouvelle version 1.7 puis livre les données client, commandes, catégories produits etc. Tu repars sur une base saines Link to comment Share on other sites More sharing options...
Elriq Hunter Posted May 23, 2019 Author Share Posted May 23, 2019 C'est fait. Tout propre. Vide, mais propre. Merci à tous. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now