I have old code that displays a pdf from the media folder. It shows if there is a file named for it. But now for the customer to enter a NEW pdf I created an attribute called pdf_download where they can paste in the file path in the admin and it appears on the page. Currently both pdfs show when a new one is entered. I wrote a small snippet at the bottom creating $specsheet. Ultimately I would like for the script to hide the old code if the admin field is populated. When I impliment the small part at the bottom it kills my attribute from rendering. What am I missing?
<?php
$_helper = Mage::helper('productattachments');
$attachments = $_helper->getAttachmentsForProduct($this->getParentBlock()->getProduct()->getId());
?>
<?php if (!empty($attachments)): ?>
<div class="ac-attachments">
<?php $header_attachment = Mage::getStoreConfig('attachments_module_configuration/settings_group/show_attachment_label'); ?>
<?php if ($header_attachment != ''): ?>
<h2><?php echo $header_attachment; ?></h2>
<?php endif; ?>
<ul>
<?php foreach($attachments as $attachment): ?>
<li>
<?php if ($_helper->isIconEnabled($attachment->getFilename()) && $_helper->getFileTypeIcon($attachment->getFilename()) !== NULL): ?>
<img src="<?php echo $_helper->getFileTypeIcon($attachment->getFilename()); ?>" />
<?php endif; ?>
<a href="<?php echo Mage::getUrl('productattachments/index/downloadfile', array('name' => $attachment->getFilename(), 'att_id' => $attachment->getProductattachments_id())); ?>">
<?php echo $attachment->getTitle(); ?>
<?php if ($_helper->isShowSizeEnabled()): ?>
<?php $file_size = $_helper->getFileSize($attachment->getFilename()); ?>
<?php if ($file_size != ''): ?>
(<?php echo $file_size; ?>)
<?php endif; ?>
<?php endif; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php $specsheet = trim($_product->getPdfDownload());
if (empty($specsheet)) {
echo $attachment
}
?>
$_product
defined?