Pages

Tuesday, December 17, 2013

Magento : Filter Kategori pada View.phtml

Berikut adalah code untuk memfilter kategori pada view.phtml.

Misalkan anda punya 3 kategori dengan urutan :
Kategori A -> id = 1
Ketagori B -> id = 2
Kategori C -> id = 3

pada kategori A anda ingin memasukkan ‘link 1′, pada kategori B ‘link 2′ dan kategori C ‘link 3′ :

$categoryId =  Mage::getModel('catalog/layer')->getCurrentCategory()->getId(); //untuk mendapatkan kategori yg aktif pada produk
 
if ($categoryId=='1'){
echo 'link 1';
} elseif ($categoryId=='2'){
echo 'link 2';
} else {
echo 'link 3';
}
Semoga membantu :D

Sumber : Magento : Filter Kategori pada View.phtml

1 comment:

  1. KING CASINO, LLC GIVES A $100 FREE BET
    KING https://septcasino.com/review/merit-casino/ CASINO, jancasino.com LLC GIVES A $100 herzamanindir.com/ FREE BET to try. Visit us today and receive a $100 filmfileeurope.com FREE 바카라 사이트 BET! Sign up at our new site!

    ReplyDelete