I have the following PHP code in Magento which so far takes the first sentence of the description and makes it the meta description.
<?php if (Mage::registry('current_product')) : ?>
<?php if (strip_tags(str_replace("<br />",", ",substr(Mage::registry('current_product')->getDescription(), 0, strpos(Mage::registry('current_product')->getDescription(), '.')+1)))=="") : ?>
<?php echo '<meta name="description" content="'.htmlspecialchars($this->getDescription()).'" />' ?>
<?php else: ?>
<?php echo '<meta name="description" content="'.strip_tags(str_replace("<br />",", ",substr(Mage::registry('current_product')->getDescription(), 0, strpos(Mage::registry('current_product')->getDescription(), '.')+1))).'" />' ?>
<?php endif; ?>
<?php else: ?>
<?php echo '<meta name="description" content="'.htmlspecialchars($this->getDescription()).'" />' ?>
<?php endif; ?>
I'm trying to do two things, modify it so that it only runs if the product is missing a manually set meta description, and make it pull the first 2 sentences instead of the first 1.
Impossible?