Jump to content

Jak oznaczyć produkty Bestseller i Polecane na liście produktów


tenrico

Recommended Posts

..jak w temacie. Chodzi o to, żeby produkty Bestseller i Polecane (ze standardowych modułów) były oznaczone metkami tak jak Nowe produkty i produkty na promocji.

 

Co i gdzie zmodyfikować/dopisać ?

Link to comment
Share on other sites

tak - 1.6

Wlasnie grzebalem w tym pliku, ale nie bardzo mam pomysl jak to rozpisac. Przypuszczam, ze trzeba cos w jakims kontrolerze napisac i wyslac zmienna do TPL.

Polecane produkty to trzeba jakos sprawdzic czy produkt jest przypisany do kategorii glownej... ale nie wiem jak to zrobic.

Z bestsellerem gorzej, bo nie wiem jak to jest zapisywane.

 

Jakies pomysly, sugestie?

Link to comment
Share on other sites

  • 1 year later...
  • 9 months later...

dodaj ten kod do product-list.tpl
 

{assign var="bestseller" value=ProductSale::getNbrSales($product.id_product)}
{if $bestseller >= 1}
    <a class="bestseller-box" href="{$product.link|escape:'html':'UTF-8'}">
        <span class="bestseller-label">{l s='Bestseller'}</span>
    </a>
{/if}


musisz też dodać style dla klas bestseller-box i bestseller-label

jeżeli nie używasz multi-store to rozwiązanie powinno wystarczyć
 

  • Like 1
Link to comment
Share on other sites

Dodaj to gdzieś w okolicy ajax_block_product (zakładam, że masz podstawową wiedzę na temat html). U mnie jest to dokładnie w divie product-image-container.

{if ProductSale::getNbrSales($product.id_product) > 0}
<div class="bestsellerlist"></div>
{/if}

I już sobie jakoś to wystyluj w css. Co do polecanego czyli tego, że produkt jest w kategorii Główna wystarczy że użyjesz kodu.

Ja jako css użyłem pseudoelementów

.bestsellerlist {
position: absolute;
left: 5px;
bottom: 2px;
z-index: 3;
}

.bestsellerlist:after {
content: "Bestseller";
font: 700 11px Arial,Tahoma,Verdana;
color: #E84C3D;
}
{if $page_name != 'index' && in_array(2,Product::getProductCategories($product.id_product|intval))}

Logika zapytania tutaj

{/if}

Ogólnie kategoria główna ma id 2 więc sprawdzamy czy produkt jest przypisany do tej kategorii. Jeśli tak to dodaj tu coś co wyświetli polecane.

Edited by hakeryk2 (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...