Frage

I have a large amount of products, about half do not have a proper description. To address this I've created an if statement that will display the product name one way and if the condition is not met then it will display it another.

Example:

<?php if ($_product->getproduct_updated()) : ?>
<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?><?php echo $this->__(' ') ?>(<?php echo $_product->getData('mpn')?>)
<?php else: ?>
<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
<?php else: ?>

Now, I'd like to go a step further with the above rule and set it so that if the product_updated attribute is yes AND is in certain categories, then display:

<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?><?php echo $this->__(' ') ?>(<?php echo $_product->getData('mpn')?>)<?php echo $this->__(' ') ?><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?>

I've done some searching and found some code and have tried for over an hour to get it to work:

<?php $categoryIds = $_product->getCategoryIds();?>
        <?php if ($_product->getproduct_updated()) && (count(array_intersect($categoryIds, array(2,71,101)))): ?>

How can I use 2 conditions in an if statement condition 1: yes/no condition 2: in categories 2,71,101 ?

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top