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

Web_Studio_MAX

  • Захожу иногда
  • 105
  • 0 / 0

Нужно просто убрать ссылку на изображении в карточке товара, вот такой вроде бы простой вопрос завел меня в тупик
Подскажите где копать?

Предполагаю что делать это нужно в файле default_images.php

Код
<?php
/**
 *
 * Show the product details page
 *
 * @package VirtueMart
 * @subpackage
 * @author Max Milbers, Valerie Isaksen

 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. 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.
 * @version $Id: default_images.php 6188 2012-06-29 09:38:30Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
vmJsApi::js( 'fancybox/jquery.fancybox-1.3.4.pack');
vmJsApi::css('jquery.fancybox-1.3.4');
$document = JFactory::getDocument ();
$imageJS = '
jQuery(document).ready(function() {
jQuery("a[rel=vm-additional-images]").fancybox({
"titlePosition" : "inside",
"transitionIn" : "elastic",
"transitionOut" : "elastic"
});
jQuery(".additional-images a.product-image.image-0").removeAttr("rel");
jQuery(".additional-images img.product-image").click(function() {
jQuery(".additional-images a.product-image").attr("rel","vm-additional-images" );
jQuery(this).parent().children("a.product-image").removeAttr("rel");
var src = jQuery(this).parent().children("a.product-image").attr("href");
jQuery(".main-image img").attr("src",src);
jQuery(".main-image img").attr("alt",this.alt );
jQuery(".main-image a").attr("href",src );
jQuery(".main-image a").attr("title",this.alt );
jQuery(".main-image .vm-img-desc").html(this.alt);
});
});
';
$document->addScriptDeclaration ($imageJS);

if (!empty($this->product->images)) {
$image = $this->product->images[0];
?>
<div class="main-image">

<?php
echo $image->displayMediaFull("",true,"rel='vm-additional-images'");
?>

<div class="clear"></div>
</div>
<?php
$count_images = count ($this->product->images);
if ($count_images > 1) {
?>
<div class="additional-images">
<?php
$start_image = VmConfig::get('add_img_main', 1)? 0 : 1;
for ($i = $start_image; $i < $count_images; $i++) {
$image = $this->product->images[$i];
?>
<div class="floatleft">
<?php
if(VmConfig::get('add_img_main', 1)) {
echo $image->displayMediaThumb('class="product-image" style="cursor: pointer"',false,"");
echo '<a href="'. $image->file_url .'"  class="product-image image-'. $i .'" style="display:none;" title="'. $image->file_meta .'" rel="vm-additional-images"></a>';
} else {
echo $image->displayMediaThumb("",true,"rel='vm-additional-images'");
}
?>
</div>
<?php
}
?>
<div class="clear"></div>
</div>
<?php
}
}
// Showing The Additional Images END ?>
*

xlite

  • Захожу иногда
  • 65
  • 5 / 0
Ну тут используется PHP для генерации превью.. а вообще если подключать сторонние скрипты ( лупы, карусели и прочие ) то оптимальнее использовать конструкции
типа
$this->product->images[0]->file_url_thumb для ссылки на превью
$this->product->images[0]->file_url для ссылки на полноразмерное фото и учесть что
images[0] - где 0 это порядковый номер для фото 0 для первого, 1 для второго  и так далее ..
можно выводить циклом
Код
<?php
$count_images = count ($this->product->images);
if ($count_images > 1) {
?>
   <ul id="demo2carousel" class="elastislide-list">
<?php
for ($i = 0; $i < $count_images; $i++) {
$image = $this->product->images[$i];
?>
            <li><a href="#">
            <img src="http://корень  сайта ( не подключал стиль) /<?php echo $image->file_url_thumb; ?>" data-largeimg="http://корень сайта /<?php echo $image->file_url;?>" />
            </a>
            </li>
<?php
}
?>
     
    </ul>
<?php
}?>


Это пример для карусели .. корень сайта подключался потому как далее подключался скрипт
 
*

Stasweb

  • Завсегдатай
  • 1492
  • 24 / 0
У меня немного другая проблема на старом сайте 2 изображения и при клики на изображение в главной картинке оно меняется. Перенес шаблон на 3-ю версию движка и теперь ту это не работает вот 3-я версия. В файл default_images.php изменения не вносил
Код
<?php
/**
 *
 * Show the product details page
 *
 * @package VirtueMart
 * @subpackage
 * @author Max Milbers, Valerie Isaksen

 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. 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.
 * @version $Id: default_images.php 6188 2012-06-29 09:38:30Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
if(VmConfig::get('usefancy',1)){
vmJsApi::js( 'fancybox/jquery.fancybox-1.3.4.pack');
vmJsApi::css('jquery.fancybox-1.3.4');
$document = JFactory::getDocument ();
$imageJS = '
jQuery(document).ready(function() {
jQuery("a[rel=vm-additional-images]").fancybox({
"titlePosition" : "inside",
"transitionIn" : "elastic",
"transitionOut" : "elastic"
});
  jQuery(".additional-images a.product-image.image-0").removeAttr("rel");
jQuery(".additional-images img.product-image").click(function() {
jQuery(".additional-images a.product-image").attr("rel","vm-additional-images" );
jQuery(this).parent().children("a.product-image").removeAttr("rel");
var src = jQuery(this).parent().children("a.product-image").attr("href");
jQuery(".main-image img").attr("src",src);
jQuery(".main-image img").attr("alt",this.alt );
jQuery(".main-image a").attr("href",src );
jQuery(".main-image a").attr("title",this.alt );
jQuery(".main-image .vm-img-desc").html(this.alt);
});
});
    ';

} else {
vmJsApi::js( 'facebox' );
vmJsApi::css( 'facebox' );
$document = JFactory::getDocument ();
$imageJS = '
jQuery(document).ready(function() {
jQuery("a[rel=vm-additional-images]").facebox();

var imgtitle = jQuery("span.vm-img-desc").text();
jQuery("#facebox span").html(imgtitle);


});
';
}
$document->addScriptDeclaration ($imageJS);

if (!empty($this->product->images)) {
$image = $this->product->images[0];
?>
<div class="main-image">
<?php echo $image->displayMediaFull("",true,"rel='vm-additional-images'"); ?>
<div class="clear"></div>
</div>
<?php
$count_images = count ($this->product->images);
if ($count_images > 1) {
?>
<div class="additional-images">
<?php
$start_image = VmConfig::get('add_img_main', 1)? 0 : 1;
for ($i = $start_image; $i < $count_images; $i++) {
$image = $this->product->images[$i];
?>
<div class="floatleft">


<?php
if(VmConfig::get('add_img_main', 1)) {
echo $image->displayMediaThumb('class="product-image" style="cursor: pointer"',false,"");
echo '<a href="'. $image->file_url .'"  class="product-image image-'. $i .'" style="display:none;" title="'. $image->file_meta .'" rel="vm-additional-images"></a>';
} else {
echo $image->displayMediaThumb("",true,"rel='vm-additional-images'");
}
?>
</div>
<?php
}
?>
<div class="clear"></div>
</div>
<?php
}
}
// Showing The Additional Images END ?>
*

fsv

  • Moderator
  • 2765
  • 402 / 2
2 изображения и при клики на изображение в главной картинке оно меняется. Перенес шаблон на 3-ю версию движка и теперь ту это не работает
В файл default_images.php изменения не вносил
Такие вещи на js работают, причем тут .php?
Зашел на новый сайт, в консоли туча ошибок. Банальный конфликт скриптов. Разбирайтесь с ними для начала.
Веб-разработка: заказ. Только новая объемная разработка. Качественно, дорого.
*

Stasweb

  • Завсегдатай
  • 1492
  • 24 / 0
А что за ошибки можно по подробнее.
Через консоль чего вы зашли
*

fsv

  • Moderator
  • 2765
  • 402 / 2
А что за ошибки можно по подробнее.
А самому посмотреть? Или мне надо их скопипастить?

Через консоль чего вы зашли
Какая разница? Смотрите через ту, с которой обычно работаете.

Вы разработчик? Направление то дал, туда и "копайте".
« Последнее редактирование: 02.12.2015, 15:40:27 от fsv »
Веб-разработка: заказ. Только новая объемная разработка. Качественно, дорого.
*

Stasweb

  • Завсегдатай
  • 1492
  • 24 / 0
Ошибки лезут в основном с /media/jui/js/ но почему ведь поставил чистую систему и файлы в этой директории не трогал.
и эти скрипты заблокированы в индексе
Код
JHtml::_('jquery.framework');
$doc = JFactory::getDocument();
unset($doc->_scripts[JURI::root(true). '/media/jui/js/jquery.min.js']);
unset($doc->_scripts[JURI::root(true). '/media/jui/js/jquery-noconflict.js']);
unset($doc->_scripts[JURI::root(true). '/media/jui/js/bootstrap.min.js']);
unset($doc->_scripts[JURI::root(true). '/media/jui/js/jquery-migrate.min.js']);

« Последнее редактирование: 02.12.2015, 15:22:00 от Stasweb »
*

Stasweb

  • Завсегдатай
  • 1492
  • 24 / 0
Не получается исправить одну ошибку
Uncaught TypeError: jQuery(...).fancybox is not a function
в этом коде
Код
	
jQuery("a[rel=vm-additional-images]").fancybox({
"titlePosition" : "inside",
"transitionIn" : "elastic",
"transitionOut" : "elastic"
});
код выводится так
Код
$imageJS = '
jQuery(document).ready(function() {
    jQuery("a[rel=vm-additional-images]").fancybox({
"titlePosition" : "inside",
"transitionIn" : "elastic",
"transitionOut" : "elastic"
});
   jQuery(".additional-images a.product-image.image-0").removeAttr("rel");
jQuery(".additional-images img.product-image").click(function() {
jQuery(".additional-images a.product-image").attr("rel","vm-additional-images" );
jQuery(this).parent().children("a.product-image").removeAttr("rel");
var src = jQuery(this).parent().children("a.product-image").attr("href");
jQuery(".main-image img").attr("src",src);
jQuery(".main-image img").attr("alt",this.alt );
jQuery(".main-image a").attr("href",src );
jQuery(".main-image a").attr("title",this.alt );
jQuery(".main-image .vm-img-desc").html(this.alt);
});
});
    ';
что не так почему не работает не понял так как он раньше работал нормально вот тут а тут не хочет
*

fsv

  • Moderator
  • 2765
  • 402 / 2
Не получается исправить одну ошибку
Uncaught TypeError: jQuery(...).fancybox is not a function
Потому что fancybox не загружен, а код, его использующий, есть.
Кстати, сейчас и код этот кривой, видимо вы после последнего поста уже успели его рефакторинг произвести. Работать не будет.
Код
.fancybox();{
Веб-разработка: заказ. Только новая объемная разработка. Качественно, дорого.
*

Stasweb

  • Завсегдатай
  • 1492
  • 24 / 0
Вернул на зад
Код
	jQuery(document).ready(function() {
    jQuery("a[rel=vm-additional-images]")
    .fancybox({
"titlePosition" : "inside",
"transitionIn" : "elastic",
"transitionOut" : "elastic"
});
fancybox также подключил
Код
<jdoc:include type="head" />
<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/facebox.js"></script>
<script type="text/javascript">jQuery.noConflict(); </script>
но тут опять вопрос?
Подключил после <jdoc:include type="head" /> и соответственно он его выводит после скрипта как его подключить перед скриптом в котором он требуется
*

Stasweb

  • Завсегдатай
  • 1492
  • 24 / 0
Ошибки подправил теперь все нормально ошибок нет.
Но по прежнему при наведении на миниатюру главная картинка не меняется но при нажатии картинки листаются.
Проблему решил путем подключения fancybox и jquery не с VirtueMart а на прямую с шаблона
Код
$this->addScript($this->baseurl.'/templates/'.$this->template.'/js/fancybox/jquery.fancybox-1.3.4.pack.js');
$this->addScript($this->baseurl.'/templates/'.$this->template.'/js/fancybox.js');

и код изменил с
Код
jQuery(document).ready(function() {
    jQuery("a[rel=vm-additional-images]")
    .fancybox({
            "titlePosition" :"inside",
"transitionIn" : "elastic",
"transitionOut" : "elastic"
});
на
Код
var j$ = jQuery.noConflict();
j$(document).ready(function() {
    j$("a[rel=vm-additional-images]").fancybox({
        "titlePosition" : "inside",
        "transitionIn" : "elastic",
        "transitionOut" : "elastic"
    });
});
получилось так
Спойлер
[свернуть]
Стало срабатывать на листание а вот при нажатии не меняется
вот две одинаковые страницы с рабочем и не рабочим вариантом
тут работает https://lik-astana.kz/oformlenie-v-baget-ramki/oformlenie-kollektsionnogo-oruzhiya-detail.html
а тут нет https://new.lik-astana.kz/oformlenie-v-baget-ramki/oformlenie-kollektsionnogo-oruzhiya-detail.html
В чем еще проблема
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

При выводе списка категорий не выводятся изображения самих категорий

Автор chtec95

Ответов: 3
Просмотров: 1139
Последний ответ 30.09.2022, 17:11:54
от marksetter
Модуль SJ Filter for VirtueMart - только 30 custom fields

Автор Alex_gs

Ответов: 0
Просмотров: 1124
Последний ответ 08.08.2022, 15:09:59
от Alex_gs
Изображения в модуле категорий mod_virtuemart_category

Автор Tref_mast

Ответов: 13
Просмотров: 6133
Последний ответ 04.08.2020, 03:05:04
от Damarkuzz
Файл дополнительного поля изображения

Автор web3.0

Ответов: 0
Просмотров: 1376
Последний ответ 16.05.2020, 15:59:09
от web3.0
Как убрать показ дополнительного изображения в категории товаров?

Автор ElenaNova

Ответов: 0
Просмотров: 1497
Последний ответ 22.04.2020, 13:13:27
от ElenaNova