Magento:类别中的productdetailpage

What I want is a product detailspage built in a category layout.

I did this to achieve the most: Created a category with the following custom layout update:

<reference name="content">
    <remove name="product_list"/>
    <remove name="category.products"/>
    <block before="-" type="catalog/product" name="home.new" alias="product" template="catalog/product/specials.phtml">
        <action method="setProductsCount">
            <count>9</count>
        </action>
    </block>
</reference>

Then this specials.phtml contains this code:

<?php

Mage::getSingleton('core/session', array('name' => 'frontend'));
$_productCollection = Mage::getResourceModel('catalogsearch/advanced_collection')
    ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
    ->addMinimalPrice()
    ->addStoreFilter();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($_productCollection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($_productCollection);

// vandaag en morgen
$todayDate = date('m/d/y');
$tomorrow = mktime(0, 0, 0, date('m'), date('d'), date('y'));
$tomorrowDate = date('m/d/y', $tomorrow);

// gisteren en een maand geleden
$monthstamp = mktime(-672);
$monthago = date('m/d/y', $monthstamp);
$stampyest = mktime(-24);
$yesterday = date('m/d/y', $stampyest);

$_productCollection->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $todayDate))
    ->addAttributeToFilter('special_to_date', array('or'=> array(
        0 => array('date' => true, 'from' => $tomorrowDate),
        1 => array('is' => new Zend_Db_Expr('null')))
), 'left');

$_productCollection->addAttributeToFilter('dagaanbieding_from', array('date' => true, 'to' => $yesterday))
    ->addAttributeToFilter('dagaanbieding_to', array('or'=> array(
    0 => array('date' => true, 'from' => $monthago),
    1 => array('is' => new Zend_Db_Expr('null')))
), 'left');


echo '<div class="listing-type-grid catalog-listing">';
$_collectionSize = $_productCollection->count();
$i=0; foreach($_productCollection as $_product):
if($i++%3==0) 
echo '<ol class="grid-row">';

echo '<li class="item">';
echo '<p class="product-image">';
echo '<a href="'.$_product->getProductUrl().'" title="'.$this->htmlEscape($this->getImageLabel($_product, 'small_image')).'">';
echo '<img src="'.$this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135).'" width="135" height="135" alt="'.$this->htmlEscape($this->getImageLabel($_product, 'small_image')).'" title="'.$this->htmlEscape($this->getImageLabel($_product, 'small_image')).'" /></a></p>';
echo '<h5><a href="'.$this->getProductUrl().'" title="'.$this->htmlEscape($_product->getName()).'">'.$this->htmlEscape($_product->getName()).'</h5>';


echo $this->getPriceHtml($_product, true) ?>
</li>


<?php if($i%3==0 || $i==$_collectionSize): ?>
</ol>
<?php endif; ?>
<?php endforeach ?>
</div>

My question:

If I want to implent the productdetails page in here, I have some info not available in the $_product array.

I need to have productsoptions info also for example. How to get this info? Need I make a change somewhere else, also?

Thanks, would be great if you can help me. It is a Magento 1.9 webshop.

UPDATE A QUICK HACK:

You can edit your xml, to contain all the blocks that are presented in In catalog.xml under catalog_product_view handle, refernace name= content, like this

  <block before="-" type="catalog/product" name="home.new" alias="product" template="catalog/product/specials.phtml">
<block type="catalog/product_view_options" />
......
//alot more blocks
</block>

Then in your code you can do this:

foreach($_productCollection as $_product):
Mage::register('current_product', $_product);
echo $this->getOptions();
// rest of your code...

Now you will have all the methods you need. and you will be able to directly call $this->getOptions

END OF UPDATE

SO the information you are seeking is going to be defined in some of the blocks that the standard product view is using. For example product options are taken from getOptions method in /Mage/Catalog/Block/Product/View/Options.php. So to get the options of the product, you must have an instane of the block :

You can do this via the xml:

    <block before="-" type="catalog/product" name="home.new" alias="product" template="catalog/product/specials.phtml">
 <block type="catalog/product_view_options" name="product.info.options" as="product_options" template="catalog/product/view/options.phtml"> </block>
</block>

now you will be able to call the method $this->getOptions(); The problem here is you will not be able to completely reuse those methods, because as you can see in the methods defined in Options.php, most of them expect to have the Mage::registry('current_product') defined. So you may need to do some re-factoring before being able to use the methods or you can just see how is this method getting the options and just steal the idea.

So basically you must see which methods do you need. Than you must find in which block do they exist. Then if needed you must tweak the code. You can also create your own block , that will basically collect all the methods from the other blocks( by copy pasting and very slight re-factoring, i would personally do just that because that way i wont have to override any magento core files) .

In catalog.xml under catalog_product_view handle, refernace name= content, you can see all the blocks that are being used in the standard product details page. All the information you need is defined in those blocks.

Sorry if its too confusing, basically this can be implemented in alot of ways. However the core thing that you will 100% need to do is to find the methods that are providing you with the information.