private function _postProcess() { if ($this->_postValidation() == false) { return false; } $this->_clearCache('ovicblockcms.tpl'); $this->_clearCache('cmspos.tpl'); $this->_errors = array(); if (Tools::isSubmit('submitBlockCMS')) { $this->context->controller->getLanguages(); $id_cms_category = (int) Tools::getvalue('id_category'); $display_store = (int) Tools::getValue('display_stores'); $location = (int) Tools::getvalue('block_location'); $position = OvicBlockCMSModel::getMaxPosition($location); if (Tools::isSubmit('addBlockCMS')) { $id_cms_block = OvicBlockCMSModel::insertCMSBlock($id_cms_category, $location, $position, $display_store); if ($id_cms_block !== false) { foreach ($this->context->controller->_languages as $language) { OvicBlockCMSModel::insertCMSBlockLang($id_cms_block, $language['id_lang']); } $shops = Shop::getContextListShopID(); foreach ($shops as $shop) { OvicBlockCMSModel::insertCMSBlockShop($id_cms_block, $shop); } } $this->_errors[] = $this->l('Cannot create a block!'); } elseif (Tools::isSubmit('editBlockCMS')) { $id_cms_block = Tools::getvalue('id_cms_block'); $old_block = OvicBlockCMSModel::getBlockCMS($id_cms_block); OvicBlockCMSModel::deleteCMSBlockPage($id_cms_block); if ($old_block[1]['location'] != (int) Tools::getvalue('block_location')) { OvicBlockCMSModel::updatePositions($old_block[1]['position'], $old_block[1]['position'] + 1, $old_block[1]['location']); } OvicBlockCMSModel::updateCMSBlock($id_cms_block, $id_cms_category, $position, $location, $display_store); foreach ($this->context->controller->_languages as $language) { $block_name = Tools::getValue('block_name_' . $language['id_lang']); OvicBlockCMSModel::updateCMSBlockLang($id_cms_block, $block_name, $language['id_lang']); } } $cmsBoxes = Tools::getValue('cmsBox'); if ($cmsBoxes) { foreach ($cmsBoxes as $cmsBox) { $cms_properties = explode('_', $cmsBox); OvicBlockCMSModel::insertCMSBlockPage($id_cms_block, $cms_properties[1], $cms_properties[0]); } } if (Tools::isSubmit('addBlockCMS')) { $redirect = 'addBlockCMSConfirmation'; } elseif (Tools::isSubmit('editBlockCMS')) { $redirect = 'editBlockCMSConfirmation'; } Tools::redirectAdmin(AdminController::$currentIndex . '&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules') . '&' . $redirect); } elseif (Tools::isSubmit('deleteBlockCMS') && Tools::getValue('id_cms_block')) { $id_cms_block = Tools::getvalue('id_cms_block'); if ($id_cms_block) { OvicBlockCMSModel::deleteCMSBlock((int) $id_cms_block); OvicBlockCMSModel::deleteCMSBlockPage((int) $id_cms_block); Tools::redirectAdmin(AdminController::$currentIndex . '&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules') . '&deleteBlockCMSConfirmation'); } else { $this->_html .= $this->displayError($this->l('Error: You are trying to delete a non-existing CMS block.')); } } elseif (Tools::isSubmit('submitFooterCMS')) { $powered_by = Tools::getValue('cms_footer_powered_by_on') ? 1 : 0; $footer_boxes = Tools::getValue('footerBox') ? implode('|', Tools::getValue('footerBox')) : ''; $block_activation = Tools::getValue('cms_footer_on') == 1 ? 1 : 0; Configuration::updateValue('PS_STORES_DISPLAY_FOOTER', Tools::getValue('PS_STORES_DISPLAY_FOOTER_on')); Configuration::updateValue('FOOTER_CMS', rtrim($footer_boxes, '|')); Configuration::updateValue('FOOTER_POWEREDBY', $powered_by); Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', $block_activation); Configuration::updateValue('FOOTER_PRICE-DROP', (int) Tools::getValue('cms_footer_display_price-drop_on')); Configuration::updateValue('FOOTER_NEW-PRODUCTS', (int) Tools::getValue('cms_footer_display_new-products_on')); Configuration::updateValue('FOOTER_BEST-SALES', (int) Tools::getValue('cms_footer_display_best-sales_on')); Configuration::updateValue('FOOTER_CONTACT', (int) Tools::getValue('cms_footer_display_contact_on')); Configuration::updateValue('FOOTER_SITEMAP', (int) Tools::getValue('cms_footer_display_sitemap_on')); $this->_html .= $this->displayConfirmation($this->l('Update your footer\'s information.')); } elseif (Tools::isSubmit('addBlockCMSConfirmation')) { $this->_html .= $this->displayConfirmation($this->l('CMS block added.')); } elseif (Tools::isSubmit('editBlockCMSConfirmation')) { $this->_html .= $this->displayConfirmation($this->l('CMS block edited.')); } elseif (Tools::isSubmit('deleteBlockCMSConfirmation')) { $this->_html .= $this->displayConfirmation($this->l('Deletion successful.')); } elseif (Tools::isSubmit('id_cms_block') && Tools::isSubmit('way') && Tools::isSubmit('position') && Tools::isSubmit('location')) { $this->changePosition(); } elseif (Tools::isSubmit('updatePositions')) { $this->updatePositionsDnd(); } if (count($this->_errors)) { foreach ($this->_errors as $err) { $this->_html .= '<div class="alert error">' . $err . '</div>'; } } }