Выкладываю:
Уточняю, что данный хак делал не я сам (я его купил) - давайте скажем спасибо нашему коллеге
Alex0802 http://joomlaforum.ru/index.php?action=profile;u=13148 .
1. Добавить в таблицу дополнительные поля о товаре.Вот пример:
http://inetta.ru/Primochki-na-vse-sluchai-zhizni/Kak-dobavit-novoe-pole-v-adminku-Virtuemart.html2. В файле (так как я вывожу эти картинки при отображении категории) product.product_list.php меняем:
// these are the columns in the table
$columns = Array( '#' => '',
"<input type=\"checkbox\" name=\"toggle\" value=\"\" onclick=\"checkAll(".$num_rows.")\" />" => "",
$VM_LANG->_('PHPSHOP_PRODUCT_LIST_NAME') => "width=\"30%\"",
$VM_LANG->_('VM_PRODUCT_LIST_MEDIA') => 'width="5%"',
$VM_LANG->_('PHPSHOP_PRODUCT_LIST_SKU') => "width=\"15%\"",
$VM_LANG->_('PHPSHOP_PRODUCT_FORM_NEW_PRODUCT') => "width=\"15%\"",
$VM_LANG->_('PHPSHOP_PRODUCT_FORM_IS_LEADER') => "width=\"15%\"",
$VM_LANG->_('PHPSHOP_PRODUCT_PRICE_TITLE') => "width=\"10%\"",
$VM_LANG->_('PHPSHOP_CATEGORY') => "width=\"15%\"" );
И
// The product sku
$listObj->addCell( $db->f("product_sku") );
$tmpcell = "<a href=\"". $sess->url( $_SERVER['PHP_SELF']."?page=product.product_list&category_id=$category_id&product_id=".$db->f("product_id")."&func=changeNewState" );
if (!$db->f("product_is_new")) {
$tmpcell .= "&task=is_new\">";
}
else {
$tmpcell .= "&task=isnt_new\">";
}
$tmpcell .= vmCommonHTML::getYesNoIcon( $db->f("product_is_new"), "Новый", "Не новый" );
$tmpcell .= "</a>";
$listObj->addCell( $tmpcell );
$tmpcell = "<a href=\"". $sess->url( $_SERVER['PHP_SELF']."?page=product.product_list&category_id=$category_id&product_id=".$db->f("product_id")."&func=changeLeaderState" );
if (!$db->f("product_is_new")) {
$tmpcell .= "&task=is_leader\">";
}
else {
$tmpcell .= "&task=isnt_leader\">";
}
$tmpcell .= vmCommonHTML::getYesNoIcon( $db->f("product_is_leader"), "Лидер продаж", "Не лидер продаж" );
$tmpcell .= "</a>";
$listObj->addCell( $tmpcell );
3. Далее в настройках отображения категории смотрим, какой файл используется:
В моем случае это browse_1, но при выводе таблицей по 1 товару в строке – этот файл - components/com_virtuemart/themes/default/templates/browse/includes/browse_listtable.tpl.php
В нем прописываем :
foreach( $products as $product ) {
foreach( $product as $attr => $val ) {
// Using this we make all the variables available in the template
// translated example: $this->set( 'product_name', $product_name );
$this->set( $attr, $val );
}
$data[$row][] = '<a href="'.$product['product_flypage'].'" title="'.$product['product_name'].'">'.$product['product_name'].'</a>';
$data[$row][] = $product['product_sku'];
if( _SHOW_PRICES && $auth['show_prices'] ) {
$data[$row][] = $product['product_price'];
}
$img_cell = "<div style='position: relative; width: 145px;'>";
$img_cell .= '<a href="'.$product['product_flypage'].'" title="'.$product['product_name'].'">'
. ps_product::image_tag( $product['product_thumb_image'] )
. '</a>';
$img_cell .= "<div style='position: absolute; right: 0px; top: 0;'>".$product['new_img']."</div><div style='position: absolute; right: 0px; bottom: 0;'>".$product['leader_img']."</div></div>";
$data[$row][] = $img_cell;
$data[$row][] = $product['product_s_desc'];
if( $product['has_addtocart'] ) {
$data[$row][] = $product['form_addtocart'];
}
else {
$data[$row][] = '<a href="'.$product['product_flypage'].'" title="'.$product['product_name'].'">'
. $product['product_details']
. '</a>';
}
$row++;
}
4. Не забываем про сами картинки, у меня они лежат в:
\components\com_virtuemart\shop_image\ps_image\
Добавлено:
Забыл совсем про вывод самих ярлыков: они указываются в файле www\administrator\components\com_virtuemart\html\shop.browse.php
Необходимо добавить вот это:
if (PSHOP_ALLOW_REVIEWS == '1' && @$_REQUEST['output'] != "pdf") {
// Average customer rating: xxxxx
// Total votes: x
$product_rating = ps_reviews::allvotes( $db_browse->f("product_id") );
}
else {
$product_rating = "";
}
if ($db_browse->f("product_is_new")) {
$new_img = "<img src='".IMAGEURL."ps_image/ico_new.png'>";
}
else {
$new_img = "";
}
if ($db_browse->f("product_is_leader")) {
$leader_img = "<img src='".IMAGEURL."ps_image/ico_leader.png'>";
}
else {
$leader_img = "";
}
// Add-to-Cart Button
Обновил архив. ps_image_and_ps_leader.rar
[вложение удалено Администратором]