<?php
/**
 * Avalanche for Magento 1.8+
 * Designed by Fast Division (http://fastdivision.com)
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file license.txt.
 * It is also available through the world-wide-web at this URL:
 * http://fastdivision.com/legal/license.txt
 *
 * @author     Fast Division
 * @version    1.5.0
 * @copyright  Copyright 2013 Fast Division
 * @license    http://fastdivision.com/legal/license.txt
 */
?>

<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>

<div id="extended-features" class="white-box">
	<div class="white-box-inner">
		<?php if($_additional = $this->getAdditionalData()): 
			$i = 1;
		?>	
		<dl class="attribute-list clearfix">
			<?php foreach ($_additional as $_data): ?>
				<dt <?php echo ($i == 1) ? "class='first'" : "" ?>><?php echo $this->escapeHtml($this->__($_data['label'])) ?>:</dt>
				<dd <?php echo ($i == 1) ? "class='first'" : "" ?><?php if($this->__($_data['label']) == "Brand") { ?>class='brand'<?php } ?>><?php echo str_replace('<br />', '', nl2br(htmlspecialchars_decode($_helper->productAttribute($_product, $_data['value'], $_data['code'])))) ?></dd>
			<?php 
				$i++;
				endforeach; 
			?>
		</dl>
		<span class="identifier">
			<span class="type">
				<span class="value-title" title="SKU"></span>
			</span>
			<span class="value">
				<span class="value-title" title="<?php echo $this->escapeHtml($_product->getSku()) ?>"></span>
			</span>
		</span>
		<?php else: ?>
			<br>
		<?php endif;?>

		<?php
			// Get category microformat data if available
			$productCategories = $_product->getCategoryCollection();
			foreach($productCategories as $category):
				$categoryForce = Mage::getModel('catalog/category')->load($category->getEntityId());
				$microformatCategory = $categoryForce->getMicroformatCategory();
			endforeach;

			if(!empty($microformatCategory)):
		?>
			<span class="category"><span class="value-title" title="<?php echo $microformatCategory ?>"></span></span>
		<?php endif; ?>
		
		<?php echo $this->getChildHtml('addto') ?>

		<?php if(Mage::getStoreConfig('avalanche_social/general/button_location') == 'add-to-box'): ?>
		    <?php echo $this->getChildHtml('social-buttons') ?>
		<?php endif; ?>
	</div>
</div>

<?php if(Mage::getStoreConfig('avalanche_social/general/button_location') == 'social-media-box'): ?>
    <?php echo $this->getChildHtml('social-buttons') ?>
<?php endif; ?>