Change Magento 1.9 Availability message depends on qty
-
15-04-2021 - |
سؤال
I would like to change the Availability message in product page depends on qty. So far I tried a couple of methods but no change at all. One of them is :
<?php if($product_page_type == 'sticky_left_right' || $product_page_type == 'wide_grid'): ?>
<?php if (($_product->isAvailable()) && (id($_product->getQty() <= 0))): ?>
<p class="availability in-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('In stock') ?></span></p>
<?php elseif (($_product->isAvailable()) && (id($_product->getQty() == 0))): ?>
<p class="availability in-stock"><?php echo $this->__('Availability:') ?> <span><?php echo "hello" ?></span></p>
<?php else: ?>
<p class="availability out-of-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
<?php if($sku = $_product->getSku()): ?>
<p class="sku"><?php echo $this->__('SKU:') ?> <span><?php echo $sku; ?></span></p>
<?php endif; ?>
<?php if ($this->canEmailToFriend()): ?>
<p class="email-friend"><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend') ?></a></p>
<?php endif; ?>
But changing qty of product not change at all in front end.
What I am doing wrong?
المحلول
The problem was that I was editing the wrong file. The correct file is in the base /catalog/product/view/type/default.phtml.
لا تنتمي إلى magento.stackexchange