If I use the navigation menu to arrive at a product "detail" page then it all shows up nicely. But if I use the search to arrive at a product "detail" page then the picture and title show up but no pricing or description show up. This, I now know, has to do with the search view not providing a category ID.
Here it is when you use the search feature to arrive at the page.
Here it is when you use the regular navigation to arrive at the page.
Here is the error message that I get on that page when I turn on error reporting
Fatal error: Call to a member function getId() on a non-object in /../../public_html/store/app/design/frontend/rwd/default/template/catalog/product/view/type/availability/default.phtml on line 38
The code throwing the error is
$currentCategory = Mage::registry('current_category');
on line 38 but I don't understand how to fix it so the code responds on search and product pages.
<!-- Stock Status -->
<div class="stock status">
<?php
$manageStock = $_product->getStockItem()->getManageStock();
$inventoryQuantity = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
$currentCategory = Mage::registry('current_category');
$curID = $currentCategory->getId();
$one = 71;
$two = 8;
$three = 4;
if ($manageStock == 1) // If 'Manage Stock' is set to YES
{
// If 'Qty' is less than or equal to zero
/*if(($inventoryQuantity <= 0) && ($curID == $one || $curID == $two || $curID == $three)) { ?> */
if(($inventoryQuantity <= 0) && (in_array($curID, array($one, $two, $three)))) { ?>
<div class="availability in-stock">
<span>
<?php echo $this->__('Availability dependent on shipping method.'); ?>
</span>
</div>
<?php }
// If 'Qty' is less than or equal to zero
if(($inventoryQuantity <= 0) && ($curID != $one && $curID != $two && $curID != $three)) { ?>
<div class="availability out-of-stock">
<span>
<?php echo $this->__('Out of Stock'); ?>
<?php echo $curID; ?>
</span>
</div>
<?php }
else if($inventoryQuantity > 0) { ?>
<div class="availability in-stock">
<span>
<?= (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()?><?php echo $this->__(' In Stock'); ?>
</span>
</div>
<?php }
}
?>
</div>
<!-- // Stock Status -->
Any thoughts? It's been driving me crazy!
Thanks in advance!