Доброго дня, господа форумчане!
Помогите, пожалуйста, с проблемой отображения текста из описания карточки товара.
Использую Joomla 3.7.2 и VirtueMart 3.2.2.
Для отображения товара на главной странице сайта использую модуль News Show Pro GK5 v. 1.9.3.8.
Выглядит товар на сайте следующим образом
1.jpg
У меня стоит задача отобразить вместо 3-й строчкой с ценой (0,00Р.) краткий текст из описания карточки товара ‘product_desc’.
За отображения данной строки отвечает скрипт
modules/mod_news_pro_gk5/tmpl/portal_modes/product_gallery_2/controller.php
следующего содержания
Код:
class NSP_GK5_Product_Gallery_2 {
// necessary class fields
private $parent;
private $mode;
static $instances = 0;
// constructor
function __construct($parent) {
$this->parent = $parent;
NSP_GK5_Product_Gallery_2::$instances += 1;
// detect the supported Data Sources
if(stripos($this->parent->config['data_source'], 'com_content_') !== FALSE) {
$this->mode = 'com_content';
} else if(stripos($this->parent->config['data_source'], 'k2_') !== FALSE) {
$this->mode = 'com_k2';
} else if(stripos($this->parent->config['data_source'], 'com_virtuemart_') !== TRUE) {
$this->mode = 'com_virtuemart';
} else {
$this->mode = false;
}
//
if($this->parent->config['portal_mode_product_gallery_2_button'] == 'cart' && NSP_GK5_Product_Gallery_2::$instances == 1) {
$closeimage = JURI::root(TRUE) .'/components/com_virtuemart/assets/images/fancybox/fancy_close.png';
$vmLangVar = '';
if (VmConfig::get ('vmlang_js', 1)) {
$vmLangVar .= "vmLang = '&lang=" . substr (VmConfig::$vmlang, 0, 2) . "' ;\n";
} else {
$vmLangVar .= 'vmLang = "";' . "\n";
}
$doc = JFactory::getDocument();
$doc->addScriptDeclaration(
$vmLangVar . '
vmSiteurl = \''. JURI::root() .'\' ;
Virtuemart.addtocart_popup = \''.VmConfig::get('addtocart_popup',1).'\' ;
vmCartText = \''.addslashes(vmText::_('COM_VIRTUEMART_CART_PRODUCT_ADDED')).'\' ;
vmCartError = \''.addslashes(vmText::_('COM_VIRTUEMART_MINICART_ERROR_JS')).'\' ;
loadingImage = \''.JURI::root(TRUE) .'/components/com_virtuemart/assets/images/facebox/loading.gif\' ;
closeImage = \''.$closeimage.'\' ;
usefancy = false;
jQuery(document).ready(function() { Virtuemart.product(jQuery("form.product")); });'
);
}
}
// static function which returns amount of articles to render - VERY IMPORTANT!!
static function amount_of_articles($parent) {
return $parent->config['portal_mode_product_gallery_2_rows'] * $parent->config['portal_mode_product_gallery_2_cols'];
}
// store generator
// function used to show the store details
function get_store($config, $id) {
if($this->mode != 'com_virtuemart') {
return array(
"price" => '',
"cart" => ''
);
} else {
// if the VM is available
if (!class_exists( 'VmConfig' )) {
require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'config.php');
}
VmConfig::loadConfig();
// Load the language file of com_virtuemart.
JFactory::getLanguage()->load('com_virtuemart');
// load necessary classes
if (!class_exists( 'calculationHelper' )) {
require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'calculationh.php');
}
if (!class_exists( 'CurrencyDisplay' )) {
require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'currencydisplay.php');
}
if (!class_exists( 'VirtueMartModelVendor' )) {
require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'models'.DS.'vendor.php');
}
if (!class_exists( 'VmImage' )) {
require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'image.php');
}
if (!class_exists( 'shopFunctionsF' )) {
require(JPATH_SITE.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'shopfunctionsf.php');
}
if (!class_exists( 'calculationHelper' )) {
require(JPATH_COMPONENT_SITE.DS.'helpers'.DS.'cart.php');
}
if (!class_exists( 'VirtueMartModelProduct' )){
JLoader::import( 'product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' );
}
// load the base
$productModel = new VirtueMartModelProduct();
$product = $productModel->getProduct($id, 100, true, true, true);
$currency = CurrencyDisplay::getInstance();
$price = '<strong>'.$currency->createPriceDiv($config['vm_show_price_type'], '', $product->prices, true).'</strong>';
if($this->parent->config['portal_mode_product_gallery_2_button'] == 'cart') {
vmJsApi::jPrice();
vmJsApi::writeJS();
}
$news_price = '<div class="PricebasePriceWithTax">';
//
if($config['vm_show_price_type'] != 'none') {
if($config['vm_display_type'] == 'text_price') {
$news_price .= '<span class="PricebasePriceWithTax">'.JText::_('MOD_NEWS_PRO_GK5_PRODUCT_PRICE').' '.$price.'</span>';
} else {
$news_price .= '<span class="PricebasePriceWithTax">'.$price.'</span>';
}
}
$news_price .= '</div>';
// display discount
if($config['vm_show_discount_amount'] == 1) {
$disc_amount = $currency->priceDisplay($product->prices['product_price'], $currency->getId());
$news_price.= '<small class="PricetaxAmount">'.$disc_amount.'</small>';
}
// display tax
if($config['vm_show_tax'] == 1) {
$taxAmount = $currency->priceDisplay($product->prices['product_desc'], $currency->getId());
$news_price.= '<small class="PricetaxAmount">'.$taxAmount.'</small>';
}
У меня стоит задача отобразить вместо 3-й строчкой с ценой (0,00Р.) краткий текст из описания карточки товара ‘product_desc’.
За отображения данной строки отвечает скрипт
modules/mod_news_pro_gk5/tmpl/portal_modes/product_gallery_2/controller.php
следующего содержания[/CODE]
Более точно строка 240 следующий кусок кода
Код:
// display tax
if($config['vm_show_tax'] == 1) {
$taxAmount = $currency->priceDisplay($product->prices['product_desc'], $currency->getId());
$news_price.= '<small class="PricetaxAmount">'.$taxAmount.'</small>';
}
В данном случае результата нет. При помощи 'product_desc' я обращаюсь к базе, что б получить данные, но данных нет. И вообще невозможно получить какие-либо данные из таблицы 'virtuemart_products’. А вот доступ к таблице данных ‘virtuemart_product_prices’ есть, поэтому я и получил цены 29,0 р и 67,0 р. из картинки при помощи аналогичных строк из кода 230 и 237.