Dynamicke snippety + Filtre
- Chipso
- Člen | 28
Dobry den,
mam problem, kde mam filter + dynamicke snippety a vyzera to nejak takto:
<?php
{snippet eshops}
<div class="col l2 m4 s12" n:foreach="$eshops as $eshop">
{snippet eshop-{$eshop->getUuid()}}
<div class="product_item hoverable obchod_zoznam">
<a n:class="ajax, $eshop->hasLiked($user) ? 'product_like-liked' : 'product_like'" n:href="like! $eshop->getUuid()"></a>
<a n:href="Detail: $eshop->getSlug()"><img class="product_image responsive-img" src="{$eshop->getLogo() ? '/uploads/' . $eshop->getLogo()->getPath() : '/assets/images/product.jpg'}" alt="product"></a>
<div class="product_name product_name_row center-align" style="float:none;">
{$eshop->getName()}
</div>
<div class="product_desc_eshop product_desc_small center-align">
{$eshop->getShortDescByLocale($presenter->locale)|truncate:20}
</div>
<div class="product_desc_eshop product_desc_small center-align">
Podporíte <b>{$eshop->getDonationPercentage() ? round($eshop->getDonationPercentage(),1) . '%' : $eshop->getDonationValue()*$currencyValue . ' ' .$currencySymbol}</b> z nákupu
</div>
<a href="{$presenter->getSupportedLink($eshop->getUuid())}" target="_blank" class="custom_button_dark hoverable ajax">
Chcem podporiť
</a>
</div>
{/snippet}
</div>
{/snippet}
?>
Dnu v eshope je HadnleLike signal, ktory funguje spravne, ked pouzivam
<?php
$this->redrawControl('eshops');
?>
problem ale nastava vtedy, ked idem filtrovat tieto elementy cez:
<?php
<ul class="category" n:snippet="categories">
<li class="category_item">
<a class="category_link ajax" n:href="category! NULL" title="All">
<div n:class="'category_image', 'category_image_all', $activeCategory == NULL ? 'active'"></div>
<div class="category_title">{_category.eshop.all}</div>
</a>
</li>
<li n:foreach="$categories as $category" class="category_item">
<a class="category_link ajax" n:href="category! $category->getUuid()" title="{$category->getName()}">
<div n:class="'category_image', 'category_image_'.$category->getLogo(), $activeCategory == $category->getUuid() ? 'active'"></div>
<div class="category_title">{_$category->getAlias()}</div>
</a>
</li>
</ul>
?>
Ked pride signal na filter, teda ked kliknem na filtraciu podla kategorii, odosle sa signal, v requeste mi prijde spravne, v response mi prijde
<?php
snippets: {snippet--eshop-c86f2d00-ef8c-4e03-942f-b42143b46573: "content"}
?>
ale s contentom snippetu to nic neurobi, teda filtre mi nefunguju – pokial ale odstranim dynamicke filtre, teda {snippet-$eshop->getUuid()}, tak vsetko funguje normalne.
Vie mi niekto pomoct, preco sa to sprava tak, ako sa to sprava ?
PS: Problem mi nastane vtedy, ked mam vyfiltrovane kategorie, dam like (a po tom nastavujem do $this->template->eshops vsetky dostupne eshopy – cize sa mi znova zobrazia vsetky eshopy po like – to iste aj pri strankovani, dam nacitat viac, chcem dat Like na jeden element, a znova mi nacita vsetky eshopy, pretoze v presenteri ich nastavujem do $this->template->eshops)
- Chipso
- Člen | 28
Landsman napsal(a):
snippetArea a se ti chovala stejne?
Uplne rovnako, neviem co s tym, vyskusal som uz vsetko dostupne na forach / dokumentaciach, Ked filtrujem / requestujem Filter na kategorie, tak aj vidim, ze v response requestu su spravne data a teda
<?php
{snippets: { snippet-1, snippet-2, snippet-3}
?>
a ich data, ale neupdatuje sa mi to ajaxovo – resp. nevykresluje sa to.