Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Need to loop through the grid view to collect a particular category id’s and check whether in stock or not. 
 
nishpatel
Jr. Member
 
Total Posts:  3
Joined:  2011-03-11
 

Hi guys, I have got some PHP script which basically checks:

Whether if a product is in stock and belongs to category id 38 then show the clearance banner.

OR

If the product is not in stock and it belongs to category id 38 then show the sold banner.

The code I have created is below, I appreciate my PHP knowledge is not great which is why I need some help. I have got the script to work on my homepage and my product view page.

This is for the domain: Broadwood International and the category is clearance page which is
Broadwood International Clearance Page

The homepage has some clearance items below which is the correct status and the product view page works correctly too.

<?php 
$categories 
$_product->getCategoryIds(); 
$clearance_category 38
$in_stock $_product->stock_item->is_in_stock == 0;
    
    if ((
$in_stock) && (in_array($clearance_category$categories))) {
        $clearancetag
='<div class="clearance-tag-page">'.'<img src="../skin/frontend/default/theme332/images/_broadwood/sold-banner.png" alt="Sold Banner" />'.'</div>';
}
    
else if(in_array($clearance_category$categories)) {
        $clearancetag
='<div class="clearance-tag-page">'.'<img src="../skin/frontend/default/theme332/images/_broadwood/clearance-banner.png" alt="Clearance Banner" />'.'</div>';

?>

Any help would be much appreciated thank you.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top