1

I am having a little trouble calling a variable value in Magento.

I want to display a new message to the customer if a product's availability stock status is limited stock in the product page, right under the availability stock status.

So I think to myself here goes nothing:

/public_html/app/design/frontend/mytheme/default/template/catalog/product/view.phtml

<?php if ( $_product->getResource()->getAttribute('stoc')->getFrontend()->getValue($_product) = 'stoc limitat' : ?>
<?php echo '<div id="nota.produs"> Nota : Va rugam verificati telefonic disponibilitatea acestui produs.   </div>' ?>
<?php endif; ?>

Rolling up my sleeves happily, save, upload, refresh but the product page does not load anything right.

I get it, I'm not calling the value the right way, am I?

Thanks.

P.S. Sorry if this is a stupidly simple matter. (I'm not the brightest light bulb in the ceiling when it comes to Magento, or for that matter PHP all together)

4

1 回答 1

3

尝试这个:

<?php if ($_product->getAttributeText('stoc') == 'stoc limitat') : ?>
于 2013-02-06T13:04:57.767 回答