$categoryid = $this->getRequest()->getParam('categoryid');
	$productid = $this->getRequest()->getParam('productid');
	
    $category = new Mage_Catalog_Model_Category();
    $category->load($categoryid);
    $collection = $category->getProductCollection();
    $collection->addAttributeToSelect('*');
     
    $_collectionSize=count($collection);
    //echo "Count :".$_collectionSize;
    $_columnCount = 4;
    $htmlvalue='';
	
	$ulhtml = '<ul class="productcollectionul">';
	$ulhtmlens = '</ul>';
	
    foreach ($collection as $_product) { 
    
      // echo $_product->getId();
	  $obj = Mage::getModel('catalog/product');
      $product = $obj->load($_product->getId());
	  
	  if($productid == $_product->getId()){
				$checked = 'checked="checked"';
					 
				 }else{
					 $checked = '';
				 }
	  
	  if($htmlvalue == ''){
		
	  $htmlvalue = '<li class="productlist" id="product'.$_product->getId().'"><span class="last-collapse-product"><input id="product' . $_product->getId() . '" type="radio" name="product_ids[]" value="' . $_product->getId() . '" onclick="productAjax(this.value);" '.$checked.' ><label for="product' . $_product->getId() . '" class="productlab' . $_product->getId() . '" >' . $product->getName() . '' . '</label></span></li>';
	  		
	  }else{

	  $htmlvalue = $htmlvalue . '<li class="productlist" id="product'.$_product->getId().'"><span class="last-collapse-product"><input id="product' . $_product->getId() . '" type="radio" name="product_ids[]" value="' . $_product->getId() . '" onclick="productAjax(this.value);" '.$checked.' ><label for="product' . $_product->getId() . '" class="productlab' . $_product->getId() . '">' . $product->getName() . '' . '</label></span></li>';
	    
	  }
 
	}
     
	 $htmlvalue = $ulhtml.$htmlvalue.$ulhtmlens;
          
     echo $htmlvalue;

 

Your Answer
Login
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.