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

Custom Stock Display in template/catalog/product/view/type/simple.phtml
 
roco
Sr. Member
 
Total Posts:  191
Joined:  2008-03-18
 

Hello, I am trying to make a display rule on the template/catalog/product/view/type/simple.phtml product page that works like this:

If product is enabled and there is stock as measured by the Qty field (Saleable?)
  Echo

      If 
"Qty"  >  (custom attribute)
           Echo  
"Qty"
      
Else
           Echo   
'In Stock'
      
EndIf

    Else
      Echo 
'Custom Message'
EndIf

The mess I have made so far is:

<?php if($_product->isSaleable()): ?>
    
<class="availability">
    
<?php if ($_product->getQty() > $_product->getCustomAttribute()): ?>  
        <?php 
echo $this->getProduct()->getQty(); ?>
    <?php 
else: ?>
        <?php 
echo $this->__('In Stock'?>
    <?php 
endif; ?>
    
</p>
<?php else: ?>
    
<class="availability"><?php echo $this->__('Availability: Out of stock.'?></p>
<?php endif; ?>

<?php 
echo $this->getPriceHtml($_product?>

I am no good at php and am trying to figure out magento at the same time.  Could someone help me get this to work?

Thank You,
roco

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