Jump to content

Как добавить дополнительное текстовое поле для категории?


Recommended Posts

Создаем в бд нужную нам колонку:

 ALTER TABLE s_categories ADD description_two text AFTER description;


Добавляется колонка description_two после колонки description

Включаем обработку движка:
api\Catigories.php примерно 160 строка
Меняем

$query = $this->db->placehold("SELECT id, parent_id, name, description, url, meta_title, meta_keywords, meta_description, image, visible, position
							 FROM __categories ORDER BY parent_id, position"); 


На

		// Выбираем все категории
	$query = $this->db->placehold("SELECT id, parent_id, name, description, description_two, url, meta_title, meta_keywords, meta_description, image, visible, position
							 FROM __categories ORDER BY parent_id, position");



Включаем поле в админке:
simpla\CategoryAdmin.php примерно 27 строка

После

$category->description = $this->request->post('description');



Добавляем с новой строки

$category->description_two = $this->request->post('description_two');




simpla\design\html\category.tpl примерно 225 строка

После

<div class="block layer">
	<h2>Описание</h2>
	<textarea name="description" class="editor_large">{$category->description|escape}</textarea>
</div>




Добавляем с новой строки

<div class="block layer">
	<h2>Описание2</h2>
	<textarea name="description_two" class="editor_large">{$category->description_two|escape}</textarea>
</div>



Включаем в основной шаблон:
design\default\html\products.tpl

Вставляем в любое нужное место

{$category->description_two}
Link to post
Share on other sites
  • 3 weeks later...
  • 1 year later...

а не подскажет, как сделать то же самое для OrdersAdmin.php ?

 

проблема в том, что в этом файле нет ничего подобного 

$category->description = $this->request->post('description');
Link to post
Share on other sites
  • 3 weeks later...
  • 1 year later...

 

Создаем в бд нужную нам колонку:

ALTER TABLE s_categories ADD description_two text AFTER description;

Добавляется колонка description_two после колонки description

 

Включаем обработку движка:

api\Catigories.php примерно 160 строка

Меняем

$query = $this->db->placehold("SELECT id, parent_id, name, description, url, meta_title, meta_keywords, meta_description, image, visible, position
								 FROM __categories ORDER BY parent_id, position");

На

// Выбираем все категории
		$query = $this->db->placehold("SELECT id, parent_id, name, description, description_two, url, meta_title, meta_keywords, meta_description, image, visible, position
								 FROM __categories ORDER BY parent_id, position");

 

Включаем поле в админке:

simpla\CategoryAdmin.php примерно 27 строка

 

После

$category->description = $this->request->post('description');

 

Добавляем с новой строки

$category->description_two = $this->request->post('description_two');

 

 

simpla\design\html\category.tpl примерно 225 строка

 

После

<div class="block layer">
		<h2>Описание</h2>
		<textarea name="description" class="editor_large">{$category->description|escape}</textarea>
	</div>

 

 

Добавляем с новой строки

<div class="block layer">
		<h2>Описание2</h2>
		<textarea name="description_two" class="editor_large">{$category->description_two|escape}</textarea>
	</div>

 

Включаем в основной шаблон:

design\default\html\products.tpl

 

Вставляем в любое нужное место

{$category->description_two}

 

Спасибо огромное, полезное дополнение! Подскажите, а для "Страниц" как такое сделать?

Link to post
Share on other sites
  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...