Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 0 Ответов
  • 1103 Просмотров
*

misteri27

  • Захожу иногда
  • 490
  • 0 / 0
Доброго дня.
Есть вопрос, может кто уже решал . Как сделать что бы всем фото, что вставляются в редакторе в товаре, автоматом прописывался  title и alt название товара ? Нашел пару плагинов но один SEOFLI - SEO Friendly Links and Images http://joomla-extensions.kubik-rubik.de/downloads/seofli-seo-friendly-links-and-images выводит название изображения, а второй http://www.old.didgo.ru/plagin-avtomaticheskogo-dobavleniya-tega-title-dlya-izobrazhenij.html не работает в JoomShopping вообще.
Вот код одного из них
Код
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );

class plgContentImgTitle extends JPlugin
{
public function plgContentImgTitle( &$subject, $params )
{
parent::__construct( $subject, $params );
$this->img = new plgContentImgTitleTag();

}
public function onContentPrepare($context, &$article, &$params, $limitstart)
{
$this->article =& $article;
$this->articleParams =& $params;
$regex = '#<img\s.*?>#';
$article->text = preg_replace_callback($regex, array($this, "ReplacerTag"), $article->text);
return '';
}
public function ReplacerTag(&$matches)
{
// Инициализация
$newImgStr = $imgStr = $matches[0];
$this->img->parse($imgStr);

// Получение необходимых параметров
$document = & JFactory::getDocument();
    $config =& JFactory::getConfig();

$plugin =& JPluginHelper::getPlugin('content', 'imgtitle');
$pluginParams = new JParameter( $plugin->params );



$meta = $pluginParams->get('meta');
$this->src = $this->img->searchTag('src');
$this->style = $this->img->searchTag('style');
$this->width = $this->img->searchTag('width');
$this->height = $this->img->searchTag('height');
$this->alt = $this->img->searchTag('alt');
$this->title = $this->img->searchTag('title');
$this->classes = $this->img->searchTag('class');
$this->id = $this->img->searchTag('id');
$this->border = $this->img->searchTag('border');
$this->align = $this->img->searchTag('align');

// Вывод результата.
$result = '<img src="'.$this->src.'" ';
if ($this->style != '') {
$result .= 'style="'.$this->style.'" ';
}
if ($this->width != '') {
$result .= 'width="'.$this->width.'" ';
}
if ($this->height != '') {
$result .= 'height="'.$this->height.'" ';
}

// Вывод alt.
if ($this->alt == '' && $meta == '1') {
$result .= 'alt="'.$this->article->metakey.'" ';
}
else if ($this->alt == '' && $meta == '0'){
$result .= '';
}
else {
$result .= 'alt="'.$this->alt.'" ';
}
// /Вывод alt.

// Вывод title.
if ($this->title == '' && $this->alt == '' && $meta == '1') {
$result .= 'title="'.$this->article->metakey.'" ';
}
else if ($this->title == '' && $this->alt != '') {
$result .= 'title="'.$this->alt.'" ';
}
else if ($this->title != '') {
$result .= 'title="'.$this->title.'" ';
}
else {
}
// /Вывод title.

if ($this->classes != '') {
$result .= 'class="'.$this->classes.'" ';
}
if ($this->id != '') {
$result .= 'id="'.$this->id.'" ';
}
if ($this->border != '') {
$result .= 'border="'.$this->border.'" ';
}
if ($this->align != '') {
$result .= 'align="'.$this->align.'" ';
}

$result .= '/>';
return $result;

}
}

class plgContentImgTitleTag
{
public function parse($str)
{
preg_match_all('/([\w-_]+)\s*=\s*([\"\']?)(.*?)\2[\s\/>]/', $str, $matches);
$attributes = $matches[1];
$values = $matches[3];
$this->_attributes = array();
foreach ($attributes as $attribute) {
$this->_attributes[$attribute] = array_shift($values);
}
}
public function searchTag($name)
{
return @$this->_attributes[$name];
}
}
Может кто поможет выправить его так что бы выводило название товара, а не
Код
$result .= 'title="'.$this->article->metakey.'" ';
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

В списке товаров вывести названия категорий каждого товара

Автор shop-user

Ответов: 5
Просмотров: 3021
Последний ответ 25.01.2022, 06:05:12
от kit2m2
Плагин - Инфоблок товара в списке товаров [Скачать]

Автор kit2m2

Ответов: 13
Просмотров: 3194
Последний ответ 20.10.2021, 14:51:08
от kit2m2
Автоматическая генерация кода товара (плагин)

Автор maslybs

Ответов: 8
Просмотров: 3608
Последний ответ 30.08.2021, 20:21:25
от nevigen
Таблица размеров (и т.п.) Плагин модульных позиций для атрибутов на странице товара [Скачать]

Автор kit2m2

Ответов: 39
Просмотров: 8106
Последний ответ 16.05.2021, 18:16:50
от kit2m2
AJAX пагинация товара

Автор ExJTMaster

Ответов: 10
Просмотров: 4151
Последний ответ 12.10.2020, 16:20:18
от sivers