0
votes

I have created a new attribute with scope Global and input type Text field called "out_of_stock_delivery". This allows me to enter a custom text when the product is Out Of Stock and override the default one. The problem I have is that if I enter a text string from the backend it does not print anything. It only prints numbers or numbers followed by text!?. The code I have modified is the following:

    <?php If ($_product->getData('out_of_stock_delivery') == 0){?>
    <p class="availability out-of-stock"><?php echo $this-      
       >__('Availability:') ?> <span><?php echo $this->__('Out of stock')."  
        - Call us for availability." ?></span></p> 
    <?php }  
         else { ?>

         <p class="availability out-of-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('Out of stock')." - We deliver this product in ".$_product->getData('out_of_stock_delivery')." days." ?></span></p> 

    <?php }  ?>

Why $_product->getData('out_of_stock_delivery') can only echo a number if the input type is text? Any pointers much appreciated.

1

1 Answers

0
votes

I made a mistake in the If statement. I should have written:

($_product->getData('out_of_stock_delivery') == "") NOT ($_product->getData('out_of_stock_delivery') == 0)