Перейти к содержимому


Фото для карточки товаров

фото карточка товаров карточка товаров

  • Вы не можете ответить в тему
Сообщений в теме: 20

#1 ramshaus

    Продвинутый пользователь

  • Download User
  • PipPipPip
  • 80 сообщений
Репутация: 15
Начинающий

Отправлено 16 April 2013 - 03:41 PM

Вот как смотрится можно посмотреть http://www.sport-skl...rack_gx4.1.html
Просьба без помидоров.... :)
Спасибо badisoft и eugene_wb
Все работает как и было задумано :)

1) добавить файлы, которые необходимо прописывать в head и заливать в папку с шаблоном
<script type="text/javascript" src="data/{$smarty.const.TPL}/js/scripts.js"></script>
<script type="text/javascript" src="data/{$smarty.const.TPL}/js/jquery.prettyPhoto.js"></script>
<link rel="stylesheet" href="data/{$smarty.const.TPL}/css/prettyPhoto.css" type="text/css" media="screen">

2) файлы копируем архив в папку data ( по умолчанию в default) если есть свой шаблон то копируем в него.

3) в файле product_detailed.tpl.html меняем
{if $product_info.thumbnail}
						{if $product_info.big_picture} <a href="data/big/{$product_info.big_picture}" class="highslide" onclick="return hs.expand(this)"><img src="data/medium/{$product_info.thumbnail}" alt="{$product_info.name}" id="{$product_info.big_picture}"></a>{*
						<div class="fil"></div>
						<a href="data/big/{$product_info.big_picture}" onclick="return hs.expand(this,{literal}{{/literal}thumbnailId: '{$product_info.big_picture}'{literal}}{/literal})" class="cl9">{$smarty.const.ENLARGE_PICTURE}</a> *}
						{else} <img src="data/medium/{$product_info.thumbnail}" alt="{$product_info.name}"> {/if}
						{elseif $product_info.picture}
						{if $product_info.big_picture} <a href="data/big/{$product_info.big_picture}" class="highslide" onclick="return hs.expand(this)"><img src="data/small/{$product_info.picture}" alt="{$product_info.name}" id="{$product_info.big_picture}"></a>{*
						<div class="fil"></div>
						<a href="data/big/{$product_info.big_picture}" onclick="return hs.expand(this,{literal}{{/literal}thumbnailId: '{$product_info.big_picture}'{literal}}{/literal})" class="cl9">{$smarty.const.ENLARGE_PICTURE}</a> *}
						{else} <img src="data/small/{$product_info.picture}" alt="{$product_info.name}"> {/if}
						{else}
						{if $smarty.const.CONF_DISPLAY_NOPHOTO eq 1} <img src="data/empty.gif" alt="no photo"> {/if}
						{/if}
						{if $all_product_pictures}
						{section name=i loop=$all_product_pictures}
						<div class="fil"></div>
						{if $all_product_pictures[i].enlarged} <a href="data/big/{$all_product_pictures[i].enlarged}" class="highslide" onclick="return hs.expand(this)"><img src="data/small/{$all_product_pictures[i].filename}" alt="{$product_info.name}" id="{$all_product_pictures[i].enlarged}"></a>{*
						<div class="fil"></div>
						<a href="data/big/{$all_product_pictures[i].enlarged}" onclick="return hs.expand(this,{literal}{{/literal}thumbnailId: '{$all_product_pictures[i].enlarged}'{literal}}{/literal})" class="cl9">{$smarty.const.ENLARGE_PICTURE}</a> *}
						{else} <img src="data/small/{$all_product_pictures[i].filename}" alt="{$product_info.name}"> {/if}
						{/section}
						{/if}
и меняем
{if $product_info.thumbnail}
{if $product_info.big_picture}
						<div class="img_middle_big" id="product_image_big_photos"><div><div>
						<a rel="prettyPhoto[pp_gal]" href="data/big/{$product_info.big_picture}" target="_blank" {if $smarty.section.i.index}style="display:none;"{/if}>
						<img src="data/small/{$product_info.thumbnail}">
						<b class="zoom"></b></a>
						
						{if $all_product_pictures}
						{section name=i loop=$all_product_pictures}
						<a rel="prettyPhoto[pp_gal]" href="data/big/{$all_product_pictures[i].enlarged}" target="_blank" style="display:none;">
						<img src="data/medium/{$all_product_pictures[i].filename}">
						<b class="zoom"></b></a>{/section}{/if}
						</div></div></div>

<div class="photos" id="product_images_small_photos">
			<div class="img_middle_small"><div>
<a href="data/big/{$product_info.big_picture}" target="_blank">
<img class="game_img_selected" src="data/small/{$product_info.thumbnail}" style="width:50px"></a>
			</div></div>
			
						{section name=i loop=$all_product_pictures}
						<div class="img_middle_small"><div>
<a href="data/big/{$all_product_pictures[i].enlarged}" target="_blank"><img class="" src="data/small/{$all_product_pictures[i].enlarged}" style="width:50px"></a></div></div>&nbsp{/section}{/if}
</div>
<div class="clearer"></div>
{/if}

{literal}
<script type="text/javascript">
$(function(){
$('#product_images_small_photos a').click(function(){
  var $a = $(this);
  var $sImg = $a.find('img');
  $('#product_images_small_photos img.game_img_selected').removeClass('game_img_selected');
  $sImg.addClass('game_img_selected');
  var index = $(this).index('#product_images_small_photos a')
  $('#product_image_big_photos a').hide();
  $('#product_image_big_photos a').eq(index).show();
  return false;
});
$('#product_image_big_photos a').hover(
  function(){$(this).children('b').addClass('hover');},
  function(){$(this).children('b').removeClass('hover');}
);

});
</script>
<script type="text/javascript">
$(function() {
$("#product_image_big_photos a[rel^='prettyPhoto']").prettyPhoto({
  animation_speed: 0,
  slideshow: false,
  social_tools: '',
  deeplinking: false,
  default_width: 1500,
  default_height: 938,
  allow_imgize: true
});
});
</script>
{/literal}
прикрепил архив
Прикрепленный файл  data.rar   159.31К   29 Количество загрузок:
  • 0

#2 eugene_wb

    Продвинутый пользователь

  • Модераторы
  • 827 сообщений
Репутация: 167
Мастер

Отправлено 16 April 2013 - 03:54 PM

1) добавить файлы, которые необходимо прописывать в head и заливать в папку с шаблоном
  • 0
Изображение Изображение Изображение

#3 ramshaus

    Продвинутый пользователь

  • Download User
  • PipPipPip
  • 80 сообщений
Репутация: 15
Начинающий

Отправлено 17 April 2013 - 08:50 PM

жаль что никто не может помочь подправить, а сам я что то не пойму где все таки сделал ошибку ((((
демо взято от сюда http://bayguzin.ru/m...rettyphoto.html
  • 0

#4 badisoft

    Продвинутый пользователь

  • Assistent vsupport.club
  • PipPipPip
  • 5075 сообщений
Репутация: 786
Мастер

Отправлено 17 April 2013 - 08:57 PM

жаль что никто не может помочь подправить, а сам я что то не пойму где все таки сделал ошибку

Просто никому именно сейчас оно не нужно :). Как будет кому нужно, так подправят. Скрипт интересный. Выглядит (судя по ссылке) интересно. Хотя и - наверняка! - таких скриптов десятки, уж больно стандартна задача. Мне вот не надо, поэтому я посмотрел, поставил в уме галочку "ага! для ShopCMS есть такой вариант расположения фоток" и пошел дальше.
  • 0
http://cpu.badisoft.ru (тестовый сайт), http://badisoft.ru (модули)

#5 ramshaus

    Продвинутый пользователь

  • Download User
  • PipPipPip
  • 80 сообщений
Репутация: 15
Начинающий

Отправлено 19 April 2013 - 11:25 AM

нашел где ошибка, но теперь не знаю как исправить, все из за style="display: none"
нужно что бы первая картинка выводилось в style=""
а вот последующие должны выводиться в style="display: none"

<a rel="prettyPhoto[pp_gal]" href="data/big/{$all_product_pictures[i].enlarged}" target="_blank" style="display: none">
  • 0

#6 badisoft

    Продвинутый пользователь

  • Assistent vsupport.club
  • PipPipPip
  • 5075 сообщений
Репутация: 786
Мастер

Отправлено 19 April 2013 - 04:46 PM

если надо задать стиль именно первого (только первого) элемента, то можно использовать псевдокласс first-child (http://htmlbook.ru/css/first-child). Правда, задать его можно только путем <style>...</style> либо в css-файле. В style="..." не получится.

Но думаю, что в данном случае первый элемент отрабатывается куда проще -

{if $smarty.section.i.index}style="display:none;"{/if}

при этом строка выведется только если i (индекс цикла section) больше нуля ,т.е. для всех элементов цикла кроме первого.
  • 0
http://cpu.badisoft.ru (тестовый сайт), http://badisoft.ru (модули)

#7 ramshaus

    Продвинутый пользователь

  • Download User
  • PipPipPip
  • 80 сообщений
Репутация: 15
Начинающий

Отправлено 20 April 2013 - 12:59 PM

Но думаю, что в данном случае первый элемент отрабатывается куда проще -

{if $smarty.section.i.index}style="display:none;"{/if}
при этом строка выведется только если i (индекс цикла section) больше нуля ,т.е. для всех элементов цикла кроме первого.


помогло, я еще изменил код, теперь остался вопрос:
как сделать если одна картинка товара? а то выводится пустой div
  • 0

#8 badisoft

    Продвинутый пользователь

  • Assistent vsupport.club
  • PipPipPip
  • 5075 сообщений
Репутация: 786
Мастер

Отправлено 20 April 2013 - 03:14 PM

помогло, я еще изменил код, теперь остался вопрос: как сделать если одна картинка товара?

Рецепт будет, видимо, неожиданным - разобраться в том, чем занимаешься. По HTML|PHP/Smarty куча документации на руccком языке, было бы желание читать. А то будет как у чувака на официальном форуме:
- не влезает картинка по длине имени файла
- увеличь размер полей xxx и yyy с 50 символов до 255 в таблицах aaa и bbb
- а где это? искал такие таблицы по всем каталогам, так и не нашел

PS. Насколько я помню (и насколько понял), в дефолтовом шаблоне ситуации "одна картинка" и "несколько картинок" обрабатываются разными ветками смарти-логики. Могу ошибаться, помню смутно, надобности не было.
  • 0
http://cpu.badisoft.ru (тестовый сайт), http://badisoft.ru (модули)

#9 eugene_wb

    Продвинутый пользователь

  • Модераторы
  • 827 сообщений
Репутация: 167
Мастер

Отправлено 20 April 2013 - 03:49 PM

в дефолтовом шаблоне ситуации "одна картинка" и "несколько картинок" обрабатываются разными ветками смарти-логики

все правильно, за дополнительные картинки идет ветка
{$all_pictures}

  • 0
Изображение Изображение Изображение

#10 ramshaus

    Продвинутый пользователь

  • Download User
  • PipPipPip
  • 80 сообщений
Репутация: 15
Начинающий

Отправлено 20 April 2013 - 07:22 PM

Спасибо badisoft и eugene_wb
теперь код заработал как надо, в шапке сделал изменения.
  • 0

#11 l17l

    Продвинутый пользователь

  • Assistent vsupport.club
  • PipPipPip
  • 106 сообщений
Репутация: -5
Начинающий

Отправлено 11 June 2013 - 04:50 AM

Здравствуйте, пытался поменять, не вышло...

в product_detailed.tpl.html

Код который нужно менять, дублируется в двух местах.

первый
{if $product_info.thumbnail}
		    {if $product_info.big_picture}
		    <a href="data/big/{$product_info.big_picture}" class="highslide" onclick="return hs.expand(this)"><img src="data/medium/{$product_info.thumbnail}" alt="{$product_info.name}" id="{$product_info.big_picture}"></a>{*
		    <div class="fil"></div>
		    <a href="data/big/{$product_info.big_picture}" onclick="return hs.expand(this,{literal}{{/literal}thumbnailId: '{$product_info.big_picture}'{literal}}{/literal})" class="cl9">{$smarty.const.ENLARGE_PICTURE}</a> *}
		    {else} <img src="data/medium/{$product_info.thumbnail}" alt="{$product_info.name}"> {/if}
           
		    {elseif $product_info.picture}
		    {if $product_info.big_picture} <a href="data/big/{$product_info.big_picture}" class="highslide" onclick="return hs.expand(this)"><img src="data/small/{$product_info.picture}" alt="{$product_info.name}" id="{$product_info.big_picture}"></a>{*
		    <div class="fil"></div>
		    <a href="data/big/{$product_info.big_picture}" onclick="return hs.expand(this,{literal}{{/literal}thumbnailId: '{$product_info.big_picture}'{literal}}{/literal})" class="cl9">{$smarty.const.ENLARGE_PICTURE}</a> *}
		    {else} <img src="data/small/{$product_info.picture}" alt="{$product_info.name}"> {/if}
		    {else}
		    {if $smarty.const.CONF_DISPLAY_NOPHOTO eq 1} <img src="data/empty.gif" alt="no photo"> {/if}
		    {/if}
		    {if $all_product_pictures}
		    {section name=i loop=$all_product_pictures}
		    <div class="fil"></div>
		    {if $all_product_pictures[i].enlarged} <a href="data/big/{$all_product_pictures[i].enlarged}" class="highslide" onclick="return hs.expand(this)"><img src="data/small/{$all_product_pictures[i].filename}" alt="{$product_info.name}" id="{$all_product_pictures[i].enlarged}"></a>{*
		    <div class="fil"></div>
		    <a href="data/big/{$all_product_pictures[i].enlarged}" onclick="return hs.expand(this,{literal}{{/literal}thumbnailId: '{$all_product_pictures[i].enlarged}'{literal}}{/literal})" class="cl9">{$smarty.const.ENLARGE_PICTURE}</a> *}
		    {else} <img src="data/small/{$all_product_pictures[i].filename}" alt="{$product_info.name}"> {/if}
{/section}
{/if} </td>
{/if}

второй идет ниже
{if $product_info.thumbnail}
		    {if $product_info.big_picture} <a href="data/big/{$product_info.big_picture}" class="highslide" onclick="return hs.expand(this)"><img src="data/medium/{$product_info.thumbnail}" alt="{$product_info.name}" id="{$product_info.big_picture}"></a>{*
		    <div class="fil"></div>
		    <a href="data/big/{$product_info.big_picture}" onclick="return hs.expand(this,{literal}{{/literal}thumbnailId: '{$product_info.big_picture}'{literal}}{/literal})" class="cl9">{$smarty.const.ENLARGE_PICTURE}</a> *}
		    {else} <img src="data/medium/{$product_info.thumbnail}" alt="{$product_info.name}"> {/if}
		    {elseif $product_info.picture}
		    {if $product_info.big_picture} <a href="data/big/{$product_info.big_picture}" class="highslide" onclick="return hs.expand(this)"><img src="data/small/{$product_info.picture}" alt="{$product_info.name}" id="{$product_info.big_picture}"></a>{*
		    <div class="fil"></div>
		    <a href="data/big/{$product_info.big_picture}" onclick="return hs.expand(this,{literal}{{/literal}thumbnailId: '{$product_info.big_picture}'{literal}}{/literal})" class="cl9">{$smarty.const.ENLARGE_PICTURE}</a> *}
		    {else} <img src="data/small/{$product_info.picture}" alt="{$product_info.name}"> {/if}
		    {else}
		    {if $smarty.const.CONF_DISPLAY_NOPHOTO eq 1} <img src="data/empty.gif" alt="no photo"> {/if}
		    {/if}
		    {if $all_product_pictures}
		    {section name=i loop=$all_product_pictures}
		    <div class="fil"></div>
		    {if $all_product_pictures[i].enlarged} <a href="data/big/{$all_product_pictures[i].enlarged}" class="highslide" onclick="return hs.expand(this)"><img src="data/small/{$all_product_pictures[i].filename}" alt="{$product_info.name}" id="{$all_product_pictures[i].enlarged}"></a>{*
		    <div class="fil"></div>
		    <a href="data/big/{$all_product_pictures[i].enlarged}" onclick="return hs.expand(this,{literal}{{/literal}thumbnailId: '{$all_product_pictures[i].enlarged}'{literal}}{/literal})" class="cl9">{$smarty.const.ENLARGE_PICTURE}</a> *}
		    {else} <img src="data/small/{$all_product_pictures[i].filename}" alt="{$product_info.name}"> {/if}
		    {/section}
		    {/if} </td>
		  {/if}

Менял первый, так как второй меняю и ничего не происходит.

Первый код заменил и выходит так.

{if $product_info.thumbnail}
		    {if $product_info.big_picture}
		    <div class="img_middle_big" id="product_image_big_photos"><div><div>
											    <a rel="prettyPhoto[pp_gal]" href="data/big/{$product_info.big_picture}" target="_blank" {if $smarty.section.i.index}style="display:none;"{/if}>
											    <img src="data/small/{$product_info.thumbnail}">
											    <b class="zoom"></b></a>
											   
											    {if $all_product_pictures}
											    {section name=i loop=$all_product_pictures}
											    <a rel="prettyPhoto[pp_gal]" href="data/big/{$all_product_pictures[i].enlarged}" target="_blank" style="display:none;">
											    <img src="data/medium/{$all_product_pictures[i].filename}">
											    <b class="zoom"></b></a>{/section}{/if}
											    </div></div></div>
<div class="photos" id="product_images_small_photos">
					    <div class="img_middle_small"><div>
<a href="data/big/{$product_info.big_picture}" target="_blank">
<img class="game_img_selected" src="data/small/{$product_info.thumbnail}" style="width:50px"></a>
					    </div></div>
					   
											    {section name=i loop=$all_product_pictures}
											    <div class="img_middle_small"><div>
<a href="data/big/{$all_product_pictures[i].enlarged}" target="_blank"><img class="" src="data/small/{$all_product_pictures[i].enlarged}" style="width:50px"></a></div></div>&nbsp{/section}{/if}
</div>
<div class="clearer"></div>
{/if}
{literal}
<script type="text/javascript">
$(function(){
$('#product_images_small_photos a').click(function(){
  var $a = $(this);
  var $sImg = $a.find('img');
  $('#product_images_small_photos img.game_img_selected').removeClass('game_img_selected');
  $sImg.addClass('game_img_selected');
  var index = $(this).index('#product_images_small_photos a')
  $('#product_image_big_photos a').hide();
  $('#product_image_big_photos a').eq(index).show();
  return false;
});
$('#product_image_big_photos a').hover(
  function(){$(this).children('b').addClass('hover');},
  function(){$(this).children('b').removeClass('hover');}
);
});
</script>
<script type="text/javascript">
$(function() {
$("#product_image_big_photos a[rel^='prettyPhoto']").prettyPhoto({
  animation_speed: 0,
  slideshow: false,
  social_tools: '',
  deeplinking: false,
  default_width: 1500,
  default_height: 938,
  allow_imgize: true
});
});
</script>
{/literal}</td>
{/if}

На сайте выглядит так:
Изображение

Что я не так сделал, запутался !!!!!!!
  • 0

#12 ramshaus

    Продвинутый пользователь

  • Download User
  • PipPipPip
  • 80 сообщений
Репутация: 15
Начинающий

Отправлено 11 June 2013 - 02:02 PM

По ходу у тебя со стилями css проблема, нужно будет редактировать.

В стандартном шаблоне имеется два кода вывода фотографий, это смотря с какой стороны ты хотел видеть вывод фотографий (устанавливается в настройках картинок).
А вторая причина ты наверное не во все (small, medium, big) загрузил картинки
  • 0

#13 l17l

    Продвинутый пользователь

  • Assistent vsupport.club
  • PipPipPip
  • 106 сообщений
Репутация: -5
Начинающий

Отправлено 11 June 2013 - 02:28 PM

вставил я правильно выходит так ?
а что с ними не так то, я подключил их как писали, это не сложно.
  • 0

#14 l17l

    Продвинутый пользователь

  • Assistent vsupport.club
  • PipPipPip
  • 106 сообщений
Репутация: -5
Начинающий

Отправлено 13 June 2013 - 02:47 AM

может проблема из за того что я ставил модуль ( ShopCMS генерация фотографий (v 3.1.1, 3.1.2, VIP) ) http://vsupport.club...h__1#entry17426
  • 0

#15 ramshaus

    Продвинутый пользователь

  • Download User
  • PipPipPip
  • 80 сообщений
Репутация: 15
Начинающий

Отправлено 13 June 2013 - 08:58 AM

ну значит так, сделал что бы и у вас на дефолтном шаблоне выводилось как у меня на картинке
находим код:
<div class="img_middle_big" id="product_image_big_photos"><div><div>
												<a rel="prettyPhoto[pp_gal]" href="data/big/{$product_info.big_picture}" target="_blank" {if $smarty.section.i.index}style="display:none;"{/if}>
												<img src="data/small/{$product_info.thumbnail}">
												<b class="zoom"></b></a>

меняем на этот:
<div class="img_middle_big" id="product_image_big_photos"><div><div>
												<a rel="prettyPhoto[pp_gal]" href="data/big/{$product_info.big_picture}" target="_blank">
												<img src="data/small/{$product_info.thumbnail}">
												<b class="zoom"></b></a>

в принцыпе нужно убрать всего одну страку {if $smarty.section.i.index}style="display:none;"{/if}

а в стилях найти и закоментировать data/ваш_шаблон/css/prettyPhoto.css
.photos {
/* margin: 0 380px 0 0; */
padding: 5px 0 20px;
}
  • 0

#16 l17l

    Продвинутый пользователь

  • Assistent vsupport.club
  • PipPipPip
  • 106 сообщений
Репутация: -5
Начинающий

Отправлено 14 June 2013 - 12:55 AM

в папке css style.css, зачем он? я его подключаю и так же отключаю и ничего не меняется.

У кого стоит живой поиск, и в head.tpl.html, работать данный модуль не будет, если убрать кусок скрипта то все ок.

кусок скрипта.
<script type="text/javascript">
$().ready(function() {
function liFormat (row, i, num) {
var result = "<table cellpadding='0' cellspacing='0'><tr valign='middle'><td align='center' width='80' rowspan='2'><img border = '0' height= '70' vspace='2' hspace='2' title='"
  +row[1]+"' src='"+row[3]+"'></td><td>"+row[1]+"</td></tr><tr><td>"+row[2]+"</td></tr></table>";
return result;
}
	  
$("#targetDiv").autocomplete("/devsearch.php", {
max: 30,
highlight: false,
scroll: true,
scrollHeight: 600,
width:250,
formatItem:liFormat
});
			   
$("#targetDiv").result(function () {
$('#formpoisk').submit();
});
});
</script>

  • 0

#17 hels

    Продвинутый пользователь

  • Пользователи
  • PipPipPip
  • 176 сообщений
Репутация: 3
Начинающий

Отправлено 07 July 2013 - 03:43 PM

все конечно хорошо, но кое-что не устраивает, нужно чтобы картинка увеличивалась при клике, а не менялась на место большой, а потом наживать чтобы увеличить, т.е. 1 клик и картинка должна быть увеличена, подскажет кто как такое сделать?
  • 0

#18 badisoft

    Продвинутый пользователь

  • Assistent vsupport.club
  • PipPipPip
  • 5075 сообщений
Репутация: 786
Мастер

Отправлено 07 July 2013 - 07:14 PM

подскажет кто как такое сделать?

Интернет. Спрашивать у парней с никами Яндекс и Гугль.
  • 0
http://cpu.badisoft.ru (тестовый сайт), http://badisoft.ru (модули)

#19 straniks

    Продвинутый пользователь

  • Download User
  • PipPipPip
  • 60 сообщений
Репутация: 0
Начинающий

Отправлено 08 February 2015 - 05:18 PM

http://www.sport-skl...rack_gx4.1.html Как я понял это новая версия ShopCMS?
  • 0

#20 badisoft

    Продвинутый пользователь

  • Assistent vsupport.club
  • PipPipPip
  • 5075 сообщений
Репутация: 786
Мастер

Отправлено 08 February 2015 - 10:07 PM

Как я понял это новая версия ShopCMS?

И как Вы это поняли?
Если отбросить телепатическое чтение номера версии в админке, то доступные (и описанные в теме по 3.1.3) признаки говорят, что это не 3.1.3.
  • 0
http://cpu.badisoft.ru (тестовый сайт), http://badisoft.ru (модули)