Jump to content

Модуль tptnprodcarousel


Recommended Posts

Всем привет! Проблема с модулем tptnprodcarousel, необходимо сделать ссылки на категории, которые заключены в <h4></h4>. Пробовал разные способы, пока ничего не помогает.

<a href="{$link->getCategoryLink($category->id_category, $category->link_rewrite)|escape:'html':'UTF-8'}" class="lnk_more">{$category.name|truncate:35:'...'|escape:html:'UTF-8'}</a>
Link to comment
Share on other sites

Нет не подходит

 

Полный модуль без правок http://mebel-alpha.ru/tptnprodcarousel.zip

 

В оригинале модуль выводит название категории без ссылок на них

{include file="$tpl_dir./category-count.tpl"}

{if isset($categories) && !empty($categories)}
{foreach from=$categories item=category}
<section class="tptncarousel clearfix">

{if isset($category)}
<h4>
<a href="{$link->getCategoryLink($category->id_category, $category->link_rewrite)|escape:'html':'UTF-8'}" class="lnk_more">{$category.name|truncate:35:'...'|escape:html:'UTF-8'}</a>
</h4>
{/if}


	{if isset($category.products) AND $category.products}
		<div class="prodcrsl">
		{foreach from=$category.products item=product}
		<div class="ajax_block_product item" itemscope itemtype="https://schema.org/Product">
			<div class="product-image-container">
				<div class="first-image">
						<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} itemprop="image" />

				</div>
				<div class="second-image">
					<a href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}">
						<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default', $product.id_product)|escape:'html':'UTF-8'}" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />
					</a>
				</div>
				{if isset($product.new) && $product.new == 1}<span class="new-box">{l s='New' mod='tptnprodcarousel'}</span>{/if}
				{if isset($product.reduction) && $product.reduction}<span class="sale-box">{l s='Sale!' mod='tptnprodcarousel'}</span>{/if}
				<div class="functional-buttons clearfix">
					<div class="button-container">
					{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
						{if ($product.allow_oosp || $product.quantity > 0)}
							{if isset($static_token)}
								<a class="ajax_add_to_cart_button simptip" data-tooltip="{l s='Add to cart' mod='tptnprodcarousel'}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart' mod='tptnprodcarousel'}" data-id-product="{$product.id_product|intval}"><i class="fa fa-shopping-cart"></i></a>
							{else}
								<a class="ajax_add_to_cart_button simptip" data-tooltip="{l s='Add to cart' mod='tptnprodcarousel'}" href="{$link->getPageLink('cart',false, NULL, 'add=1&id_product={$product.id_product|intval}', false)|escape:'html':'UTF-8'}" rel="nofollow" data-id-product="{$product.id_product|intval}"><i class="fa fa-shopping-cart"></i></a>
							{/if}
						{else}
							<span class="ajax_add_to_cart_button disabled"><i class="fa fa-shopping-cart"></i></span>
						{/if}
					{/if}
					</div>
					<div class="quickview">
						<a class="quick-view simptip" data-tooltip="{l s='Quick view' mod='tptnprodcarousel'}" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}"><i class="fa fa-expand"></i></a>
					</div>
				</div>
			</div>		
			<h5 class="product_name" itemprop="name">
				{if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}
				<a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" >
					{$product.name|truncate:30:'...'|escape:'html':'UTF-8'}
				</a>
			</h5>
			{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
			<div class="content_price" itemprop="offers" itemscope itemtype="https://schema.org/Offer">
				{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
					<span itemprop="price" class="price product-price">
						{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
					</span>
					<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
					{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
						<span class="old-price product-price">
							{displayWtPrice p=$product.price_without_reduction}
						</span>
					{/if}
				{/if}
			</div>
			{/if}
		</div>
		{/foreach}
		</div>
	{else}
	<p>
		{l s='Нет продуктов' mod='tptnprodcarousel'}
	</p>
	{/if}
</section>
{/foreach}
{/if}

Оригинал кода

{if isset($categories) AND $categories}
{foreach from=$categories item=category}
<section class="tptncarousel clearfix">
	<h4>
		{if $category.id == 2}
			{l s='Featured products' mod='tptnprodcarousel'}
		{else}
			{$category.name}
		{/if}
	</h4>
	{if isset($category.products) AND $category.products}
		<div class="prodcrsl">
		{foreach from=$category.products item=product}
		<div class="ajax_block_product item" itemscope itemtype="https://schema.org/Product">
			<div class="product-image-container">
				<div class="first-image">
					<a class="product_img_link" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">
						<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} itemprop="image" />
					</a>
				</div>
				<div class="second-image">
					<a href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}">
						<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default', $product.id_product)|escape:'html':'UTF-8'}" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />
					</a>
				</div>
				{if isset($product.new) && $product.new == 1}<span class="new-box">{l s='New' mod='tptnprodcarousel'}</span>{/if}
				{if isset($product.reduction) && $product.reduction}<span class="sale-box">{l s='Sale!' mod='tptnprodcarousel'}</span>{/if}
				<div class="functional-buttons clearfix">
					<div class="button-container">
					{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
						{if ($product.allow_oosp || $product.quantity > 0)}
							{if isset($static_token)}
								<a class="ajax_add_to_cart_button simptip" data-tooltip="{l s='Add to cart' mod='tptnprodcarousel'}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart' mod='tptnprodcarousel'}" data-id-product="{$product.id_product|intval}"><i class="fa fa-shopping-cart"></i></a>
							{else}
								<a class="ajax_add_to_cart_button simptip" data-tooltip="{l s='Add to cart' mod='tptnprodcarousel'}" href="{$link->getPageLink('cart',false, NULL, 'add=1&id_product={$product.id_product|intval}', false)|escape:'html':'UTF-8'}" rel="nofollow" data-id-product="{$product.id_product|intval}"><i class="fa fa-shopping-cart"></i></a>
							{/if}
						{else}
							<span class="ajax_add_to_cart_button disabled"><i class="fa fa-shopping-cart"></i></span>
						{/if}
					{/if}
					</div>
					<div class="quickview">
						<a class="quick-view simptip" data-tooltip="{l s='Quick view' mod='tptnprodcarousel'}" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}"><i class="fa fa-expand"></i></a>
					</div>
				</div>
			</div>		
			<h5 class="product_name" itemprop="name">
				{if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}
				<a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" >
					{$product.name|truncate:30:'...'|escape:'html':'UTF-8'}
				</a>
			</h5>
			{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
			<div class="content_price" itemprop="offers" itemscope itemtype="https://schema.org/Offer">
				{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
					<span itemprop="price" class="price product-price">
						{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
					</span>
					<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
					{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
						<span class="old-price product-price">
							{displayWtPrice p=$product.price_without_reduction}
						</span>
					{/if}
				{/if}
			</div>
			{/if}
		</div>
		{/foreach}
		</div>
	{else}
	<p>
		{l s='No Products' mod='tptnprodcarousel'}
	</p>
	{/if}
</section>
{/foreach}
{/if}
Edited by Fidgeter (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...