cancel
Showing results for 
Search instead for 
Did you mean: 

Product search by category script after update to 1.5.1

Product search by category script after update to 1.5.1

I have used same methods to reach in category. it's works in magento 1.4.3.

After update 1.5.1.  the mage don't work but i haven't any error.

parent category is displayed well but not after.

 

 

<?php  
 //obtenir categorie courante de magento
$catcourante = Mage::registry('current_category');
//  id
$collection = Mage::getModel('catalog/category')->getCategories($catcourante->getEntityId());
 ?>
<div class="page-title"><h1><?php echo $catcourante->getName(); ?> Pour Pc Portable</h1></div>
<center><div><p id="editors">

			<select id="category_list" onchange="request(this, 'softwaresSelect');">
				<option value="none">Selectionner La Marque test</option>
				  
<?php foreach($collection as $cat) {
   if($cat->getIsActive()) {
	$category = Mage::getModel('catalog/category')->load($cat->getEntityId());
 
         // collection de produits visibles avec un tatut actif
 
	$prodCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($category);
	Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($prodCollection);
	Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($prodCollection);
 
	?><!--sortie Html -->
	
      <option value = "<?php echo $category->getId();?>"><?php echo $category->getName() ?></option>
 
	<?php
	}
}
 
?>
    </select>	<p> <?php echo $category->
	<select id="softwaresSelect" style="visibility:hidden" onchange="request(this, 'prodSelect');"><option value="none">Selection</option></select><p>
   <select id="prodSelect" style="visibility:hidden" onchange="requestUrlCatSelected(this)" ></select> <p>
   <a id ="boutonsoumettre1" style="visibility:hidden" href=""><img src="http://www.diymicro.eu/lienimage/bouton_valider.jpg"></a>
			<!--<span id="loader" style="display: none;"><img src="images/loader.gif" alt="loading" /></span>-->
</p></div></center>

 

2 REPLIES 2

Re: Mage don't work after update to 1.5.1

Hi @microXT,

 

I know I won't provide the solution you want in the way you want, but maybe you should evaluate a major upgrade here.

First of all, version 1.5.x use a really old version of PHP (without support). This can be a major secutiry issue.

Also, the code example shows the use of getModel and getSingleton methods at phtml level. That's not a good appoach (isn't good at all).

 

Re: Mage don't work after update to 1.5.1

I know it's not good to do that. But i haven't other way.
I just want to list the products of a category on a page. By recursive search.

the parent category displays well in the select but not the sub category.