Jump to content

[MEGOLDVA] Category sliderben termékek random megjelenítése


Zsolt55
 Share

Recommended Posts

Sziasztok!

A category slider nevezetű modulomban szeretném megoldani, hogy a termékek véletlenszerűen jelenjenek meg. Értelem szerűen minden frissítésnél más-más termékeket jelenítsen meg. Sajnos a php-hoz nem igazán értek ezért elkéne némi segítség.

 

Feltöltöm a php fájlt ha valaki esetleg tudna segíteni.

 

Előre is köszi mindenkinek!

categoryslider.php

 

Edited by Zsolt55 (see edit history)

Share this post


Link to post
Share on other sites

Nem tudunk segíteni, ha nem adsz shop verziószámot.

 

A category slider modul verziószáma is kellene, illetve nem ártana egy print screen a modulról, vagy ha van link (mert letölthető vagy megvehető) akkor az.

Share this post


Link to post
Share on other sites

Köszi a gyors választ!

 

Prestashop verzió 1.6.0.9
Jelenleg használt sablon warehouse
Category slider verzió:Category slider on Hompage v1.1

 

Ez egy fizetős sablonhoz tartozó modul.
 
Nem tudom pontosan miről kellene kép, de csináltam párat. Egyet a modul listából, egyet a config felületéről és egyet magáról a megjelenéséről.

post-1036398-0-89603400-1439850592_thumb.jpgpost-1036398-0-07909300-1439850594_thumb.jpg

Edited by Zsolt55 (see edit history)

Share this post


Link to post
Share on other sites


{if isset($categories) AND $categories}

{foreach from=$categories item=category}

 

<!-- MODULE Home category Products -->

<section id="categories-products_block_center_mod_{$category.id}" class="block products_block flexslider_carousel_block clearfix">

<h4><a href="{$link->getCategoryLink({$category.id})}">{$category.name}</a></h4>

{if isset($category.products) AND $category.products}

<script type="text/javascript"> createCategorySlider('#categoryslider_slider_{$category.id}'); </script>

{assign var='tmpCatSlider' value="categoryslider_slider_{$category.id}"}

{if isset($category.productimg)}

{include file="$tpl_dir./product-slider.tpl" products=$category.products productimg=$category.productimg id=$tmpCatSlider}

{else}

{include file="$tpl_dir./product-slider.tpl" products=$category.products id=$tmpCatSlider}

{/if}

{else}

<p>

{l s='No products' mod='categoryslider'}

</p>

{/if}

</section>

<!-- /MODULE Home category Products -->

{/foreach}

{/if}

Share this post


Link to post
Share on other sites


{if isset($products) && $products}

<div class="block_content">

{assign var='nbItemsPerLine' value=4}

{assign var='nbLi' value=$products|@count}

 

<div {if isset($id) && $id} id="{$id}"{/if} class="flexslider_carousel">

<ul class="slides">

{foreach from=$products item=product name=homeFeaturedProducts}

<li class="ajax_block_product {if $smarty.foreach.homeFeaturedProducts.first}first_item{elseif $smarty.foreach.homeFeaturedProducts.last}last_item{else}item{/if} {if $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 0}last_item_of_line{elseif $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 1} {/if} {if $smarty.foreach.homeFeaturedProducts.iteration > ($smarty.foreach.homeFeaturedProducts.total - ($smarty.foreach.homeFeaturedProducts.total % $nbItemsPerLine))}last_line{/if}">

<div class="product-container">

 

<div class="product-image-container">

{if (isset($product.quantity) && $product.quantity > 0) || (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}

{hook h='displayProductAttributesPL' productid=$product.id_product}

{/if}

<a class="product_img_link" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" >

{if isset($productimg[$product.id_product]) && !empty($productimg[$product.id_product])}

<img class="replace-2x img-responsive img_0 {if isset($productimg[$product.id_product].1) && !empty($productimg[$product.id_product].1)} img_1e{/if}" src="{$link->getImageLink($product.link_rewrite,$product.id_product|cat:"-"|cat:$productimg[$product.id_product].0.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} />

{if isset($productimg[$product.id_product].1) && !empty($productimg[$product.id_product].1)}

<img class="replace-2x img-responsive img_1" src="{$link->getImageLink($product.link_rewrite,$product.id_product|cat:"-"|cat:$productimg[$product.id_product].1.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} />

{/if} {else}

<img class="replace-2x img-responsive img_0" 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} />{/if}

{hook h='displayCountDown' product=$product}

</a>

<div class="product-flags">

{if (!$PS_CATALOG_MODE && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}

{if isset($product.online_only) && $product.online_only}

<span class="online-label {if isset($product.new) && $product.new == 1}online-label2{/if}">{l s='Online only'}</span>

{/if}

{/if}

{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}

{elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}

<span class="sale-label">{l s='Reduced price!'}</span>

{/if}

{if isset($product.new) && $product.new == 1}

<span class="new-label">{l s='New'}</span>

{/if}

{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}

<span class="sale-label">{l s='Sale!'}</span>

{/if}

</div>

<div class="functional-buttons functional-buttons-grid clearfix">

{if isset($quick_view) && $quick_view}

<div class="quickview col-xs-6">

<a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}" title="{l s='Quick view'}">

{l s='Quick view'}

</a>

</div>

{/if}

{hook h='displayProductListFunctionalButtons' product=$product}

{if isset($comparator_max_item) && $comparator_max_item}

<div class="compare col-xs-3">

<a class="add_to_compare" href="{$product.link|escape:'html':'UTF-8'}" data-id-product="{$product.id_product}" title="{l s='Add to Compare'}">{l s='Add to Compare'}</a>

</div>

{/if}

</div>

{if ($id!='crossseling_products_slider') AND ($id!='crossseling_popup_products_slider') }

{if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}

{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}

<span class="availability availability-slidein">

{if ($product.allow_oosp || $product.quantity > 0)}

<link href="http://schema.org/InStock" />

{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}

<span class="out-of-stock available-dif">

<link href="http://schema.org/LimitedAvailability" />{l s='Product available with different options'}

</span>

{else}

<span class="out-of-stock">

<link />{l s='Out of stock'}

</span>

{/if}

</span>

{/if}

{/if}

 

{else}<span>

<link href="http://schema.org/InStock" />

</span>{/if}

{if isset($product.color_list)}

<div class="color-list-container">{$product.color_list} </div>

{/if}

</div><!-- .product-image-container> -->

{hook h="displayProductDeliveryTime" product=$product}

{hook h="displayProductPriceBlock" product=$product type="weight"}

<h5 class="product-name-container">

{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'}" >

{$product.name|truncate:60:'...'|escape:'html':'UTF-8'}

</a>

</h5>

{if isset($product.reference)}<span class="product-reference">{$product.reference}</span>{/if}

{if (!$PS_CATALOG_MODE && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}

<div class="content_price">

{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}

<span class="price product-price">

{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}

</span>

 

{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}

{hook h="displayProductPriceBlock" product=$product type="old_price"}

<span class="old-price product-price">

{displayWtPrice p=$product.price_without_reduction}

</span>

{if $product.specific_prices.reduction_type == 'percentage'}

<span class="price-percent-reduction small">-{$product.specific_prices.reduction * 100}%</span>

{/if}

{if $product.specific_prices.reduction_type == 'amount'}

<span class="price-percent-reduction small">-{convertPrice price=$product.specific_prices.reduction}</span>

{/if}

{/if}

{hook h="displayProductPriceBlock" product=$product type="price"}

{hook h="displayProductPriceBlock" product=$product type="unit_price"}

{/if}

</div>

{elseif $PS_CATALOG_MODE}

{else}<div class="content_price"> </div>

{/if}

{hook h='displayProductListReviews' product=$product}

 

{if isset($warehouse_vars.yotpo_stars) && $warehouse_vars.yotpo_stars == 1}

<div class="yotpo bottomLine"

data-appkey="{$yotpoAppkey}"

data-domain="{$yotpoDomain}"

data-product-id="{$product.id_product}"

data-product-models=""

data-name="{$product.name|escape:'htmlall':'UTF-8'}"

data-url="{$product.link|escape:'htmlall':'UTF-8'}"

data-image-url="{$link->getImageLink($product.link_rewrite, $product.id_image, '')}"

data-bread-crumbs="">

</div>

{/if}

 

{if ($id!='crossseling_products_slider') AND ($id!='crossseling_popup_products_slider') AND ($id!='manufacturer_products_slider') AND ($id!='accessories_slider') AND ($id!='category_products_slider') }

<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.customizable != 2 && !$PS_CATALOG_MODE}

{if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)}

{capture}add=1&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}{/capture}

<a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity > 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}">

<span>{l s='Add to cart'}</span>

</a>

{else}

<a class="button lnk_view btn" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}">

<span>{if (isset($product.customization_required) && $product.customization_required)}{l s='Customize'}{else}{l s='More'}{/if}</span>

</a>

{/if}

{else}

<a class="button lnk_view btn" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}">

<span>{if (isset($product.customization_required) && $product.customization_required)}{l s='Customize'}{else}{l s='More'}{/if}</span>

</a>

{/if}

 

</div>

{/if}

</div><!-- .product-container> -->

 

 

</li>

{/foreach}

</ul>

</div>

</div>

 

{/if}

Share this post


Link to post
Share on other sites

Ebbe a .tpl fájlba (melyet most utoljára betettél) próbáld meg beépíteni ezt:

{$products|shuffle}

Én a 4. sor "{assign var='nbLi' value=$products|@count}" után tenném be. Valahogy így:

{if isset($products) && $products}
	<div class="block_content">
		{assign var='nbItemsPerLine' value=4}
		{assign var='nbLi' value=$products|@count}
		
		{$products|shuffle}
 
		<div {if isset($id) && $id} id="{$id}"{/if}  class="flexslider_carousel">
...

Ha van gyorsítótárad (cache) akkor azt ürítsd ki, és/vagy kapcsold ki a gyorsítótárazást az adminban.

  • Like 1

Share this post


Link to post
Share on other sites

  • 2 weeks later...

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More