Сделайте вначале резервную копию файлов, а затем следуйте инструкции:
Для того чтоб сделать вкладки мультиязычности в теме Bender нужно определиться с количеством языков ( я использую 3 языка: русский, английский и сербский). Итак, заходим в файл oc-includes/osclass/frm/Item.form.class.php
Находим строку мультиязычности, где-то 409-я. Выделяем текст от этой строки, и до 438-й (выделяем всё что между этих строк вместе с этими строками):
PHP:
static public function multilanguage_title_description($locales = null, $item = null) {
*
*
*
*
*
*
self::description_textarea('description', $locale['pk_c_code'], $description);
Меняем всё, что выделили на следующие строки:
PHP:
static public function multilanguage_title_description($locales = null, $item = null) {
if($locales==null) { $locales = osc_get_locales(); }
if($item==null) { $item = osc_item(); }
$num_locales = count($locales);
if($num_locales>1) { echo '<div class="tabber"><input type="radio" name="odin" checked="checked" id="vkl1"/><label for="vkl1">' . __('Version in English') . '</label><input type="radio" name="odin" id="vkl2"/><label for="vkl2">' . __('Version in Russian') . '</label><input type="radio" name="odin" id="vkl3"/><label for="vkl3">' . __('Version in Serbian') . '</label>'; };
foreach($locales as $locale) {
if($num_locales>1) { echo '<div class="tabbertab">'; };
if($num_locales>1) { echo ''; };
echo '<div class="title">';
echo '<div><label for="title">' . __('Title') . ' *</label></div>';
$title = (isset($item) && isset($item['locale'][$locale['pk_c_code']]) && isset($item['locale'][$locale['pk_c_code']]['s_title'])) ? $item['locale'][$locale['pk_c_code']]['s_title'] : '';
if( Session::newInstance()->_getForm('title') != "" ) {
$title_ = Session::newInstance()->_getForm('title');
if( $title_[$locale['pk_c_code']] != "" ){
$title = $title_[$locale['pk_c_code']];
}
}
self::title_input('title', $locale['pk_c_code'], $title);
echo '</div>';
echo '<div class="description">';
echo '<div><label for="description">' . __('Description') . ' *</label></div>';
$description = (isset($item) && isset($item['locale'][$locale['pk_c_code']]) && isset($item['locale'][$locale['pk_c_code']]['s_description'])) ? $item['locale'][$locale['pk_c_code']]['s_description'] : '';
if( Session::newInstance()->_getForm('description') != "" ) {
$description_ = Session::newInstance()->_getForm('description');
if( $description_[$locale['pk_c_code']] != "" ){
$description = $description_[$locale['pk_c_code']];
}
}
self::description_textarea('description', $locale['pk_c_code'], $description);
Шаг номер два – это замена кода в файле oc-content/themes/bender/item-post.php
Находим строчку с ценой – это наш ориентир:
PHP:
<?php if( osc_price_enabled_at_items() ) { ?>
И всё что выше этой строчки удаляем – всю первую часть файла, до самого верха.
Вместо этого вставляем новую половину файла:
PHP:
<?php
/*
* Osclass – software for creating and publishing online classified
* advertising platforms
*
* Copyright (C) 2013 OSCLASS
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// meta tag robots
osc_add_hook('header','bender_nofollow_construct');
osc_enqueue_script('jquery-validate');
bender_add_body_class('item item-post');
$action = 'item_add_post';
$edit = false;
if(Params::getParam('action') == 'item_edit'){
$action = 'item_edit_post';
$edit = true;
}
?>
<style>
.tabber > div, .tabber > input { display: none; }
.tabber label { padding: 5px; border: 0px solid #aaa; line-height: 28px; cursor: pointer; position: relative; bottom: 1px; }
.tabber input[type="radio"]:checked + label { border-bottom: 0px solid #fff; background-color: #F0FDFF; border-radius: 5px; padding-bottom: 4px; }
.tabber > input:nth-of-type(1):checked ~ div:nth-of-type(1),
.tabber > input:nth-of-type(2):checked ~ div:nth-of-type(2),
.tabber > input:nth-of-type(3):checked ~ div:nth-of-type(3) { display: block; padding: 5px; border: 0px solid #aaa; background-color: #F0FDFF; border-radius: 5px; }
</style>
<?php osc_current_web_theme_path('header.php') ; ?>
<?php ItemForm::location_javascript_new(); ?>
<div class="form-container form-horizontal">
<div class="resp-wrapper">
<div class="header">
<h1 style="font-weight: lighter;"><?php _e('Publish a listing', 'bender'); ?></h1>
</div>
<ul id="error_list"></ul>
<form name="item" action="<?php echo osc_base_url(true);?>" method="post" enctype="multipart/form-data" id="item-post">
<fieldset>
<input type="hidden" name="action" value="<?php echo $action; ?>" />
<input type="hidden" name="page" value="item" />
<?php if($edit){ ?>
<input type="hidden" name="id" value="<?php echo osc_item_id();?>" />
<input type="hidden" name="secret" value="<?php echo osc_item_secret();?>" />
<?php } ?>
<div class="control-group">
<label class="control-label" for="select_1"><?php _e('Category', 'bender'); ?></label>
<div class="controls">
<?php ItemForm::category_select(null, null, __('Select a category', 'bender')); ?>
</div>
</div>
<h2 style="font-weight: lighter;"><?php _e('Select the tab of your language', 'bender'); ?></h2>
<div>
<?php ItemForm::multilanguage_title_description(); ?>
</div>
Прошу обратить внимание, что тут мы используем CSS для удобного отображения вкладок.
Код:
<style>
.tabber > div, .tabber > input { display: none; }
.tabber label { padding: 5px; border: 0px solid #aaa; line-height: 28px; cursor: pointer; position: relative; bottom: 1px; }
.tabber input[type="radio"]:checked + label { border-bottom: 0px solid #fff; background-color: #F0FDFF; border-radius: 5px; padding-bottom: 4px; }
.tabber > input:nth-of-type(1):checked ~ div:nth-of-type(1),
.tabber > input:nth-of-type(2):checked ~ div:nth-of-type(2),
.tabber > input:nth-of-type(3):checked ~ div:nth-of-type(3) { display: block; padding: 5px; border: 0px solid #aaa; background-color: #F0FDFF; border-radius: 5px; }
</style>
После этого должно все получиться.
Обратите внимание на версию 4.* в ней свои решения, скорее всего тут нужно подумать над кодом.