Serching Product by Attribute from Product page.

Sometimes people to want to  display product attribute in product page. then they want to link this attribute. if someone click on that link then all product of that attribute will display as a search result. for example a movie disc selling site. or a book shop. has many artist list or actor list.  then you can easily filter them by attribute artist and actor. and this code will help you.


<?php
$catingArtist = $_product->getArtist();

?>
<?php if(!empty($catingArtist)) {
$catingArtistArr = explode(',',$catingArtist);
$tagUrl = $this->getUrl('catalogsearch/advanced/result');
$tagUrl .='?artist=';
?>

<?php if(count($catingArtistArr)>0) : ?>
<span style="padding:0px 2px 0px 2px;"><?php  echo $this->__('Cast:-') ?></span>
<?php foreach($catingArtistArr as $val) : ?>
<a href="<?php echo $tagUrl.$val?>" title="<?php echo $val; ?>" name="<?php echo $val; ?>" style="padding:0px 3px 0px 3px;"><?php echo $val; ?> </a>
<p title="<?php echo $val; ?>" name="<?php echo $val; ?>" style="padding:0px 3px 0px 3px;"><?php echo $val; ?> </p><span style="padding:0px 2px 0px 2px;"><?php echo $this->__('(Actor)') ?></span>
<?php endforeach; ?>
<?php endif; ?>

<?php } ?>

for more info visit mage-people

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: