Magento - view links to links and add to compare links on custom pages
I have a custom page as my magento master page. This content is hardcoded into the default CMS page (which indicates if the CMS page is not allowed on the CMS admin pages).
I have a list of products showing there (pulled from bestseller / highest rated, etc.). However, reference links and comparison links do not appear on this page. The product list is displayed using the same code as the default template / catalog / product / list.phtml and everything else works except for these two things.
It seems that both of the following code snippets have no effect on pages other than the default category list page:
<?php $_compareUrl=$this->getAddToCompareUrl($_product); ?>
&
<?php echo $this->getReviewsUrl() ?>
I guess there is something else that needs to be called in order for them to work, but cannot figure out what it is. Everything else from the product collection is available.
I am loading a collection of products using the following code:
$_productCollection = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
->addAttributeToFilter('visibility', $visibility)
$_productCollection->load();
Any ideas?
a source to share
OK, so after a while I found that you can use the following to get the comparison url:
<?php $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product) ?>
<span class="addto">
<a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a>
</span>
Still not sure about urls, but I did an acceptable workaround for this, so I'm going to mark this as an answer.
If anyone comes up with an answer though, please keep posting it!
a source to share