Сделать категории VirtueMart в столбик
Была задача, сделать отображение в столбик категорий VirtueMart (который в свою очаредь был взять с virtuemart.ru), кототрый столя на Joomla 1.0.x.
Древний такой магаз достался, почти как говно мамонта, но решать задачу всё равно было нужно и вот что я сделал.
Есть файл такой /administrator/components/com_virtuemart/html/shop.index.php.
Этот файл что-то типо центрального шаблонизатора он выдаёт динамический HTML-код, нам нужны таблицы отвечающие за показ ссылок на категории.
Итак, находим код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | < ?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); /** * * @version $Id: shop.index.php 638 2007-01-16 18:48:21Z soeren_nb $ * @package VirtueMart * @subpackage html * @copyright Copyright (C) 2004-2005 Soeren Eberhardt. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ require_once( CLASSPATH . 'ps_product.php'); require_once( CLASSPATH . 'ps_product_category.php'); $ps_product = new ps_product; // Show only top level categories and categories that are // being published $query = "SELECT * FROM #__{vm}_category, #__{vm}_category_xref "; $query .= "WHERE #__{vm}_category.category_publish='Y' AND "; $query .= "(#__{vm}_category_xref.category_parent_id='' OR #__{vm}_category_xref.category_parent_id='0') AND "; $query .= "#__{vm}_category.category_id=#__{vm}_category_xref.category_child_id "; $query .= "ORDER BY #__{vm}_category.list_order, #__{vm}_category.category_name ASC"; // initialise the query in the $database connector // this translates the '#__' prefix into the real database prefix $db->query( $query ); $iCol = 1; $categories_per_row = 4; $cellwidth = intval( 100 / $categories_per_row ); ?> |
Нам нужна строчка 35, в ней поставить значение переменной $categories_per_row – 1 за место 4
Далее, мне понадобилось, чтобы между категориями был отступ. Это задачу я решил так:
<p><a title="<?php echo $catname ?>" href="< ?php echo $sess->url(URL."index.php?option=com_virtuemart&page=shop.browse&category_id=".$db->f("category_id")); ?>"></a></p>
Тоесть в 55-й строчке (считать строчки в файле shop.index.php) нужно добавить HTML тег «<p>» и закрыть его, соотвественно.
Комментариев пока нет.