Reputation: 1458
I'm working on an ajax auto suggest script and have encountered an issue where the product URL's being outputted are false (meaning that they point to the product but the category path is not mentioned).
This particular code snippet would get the job done (found on the magento forum) but am encountering an error in the following location
$_categories = $_product->getCategoryIds();
$_category = Mage::getModel('catalog/category')->load($_categories[0]);
$url = $this->getUrl($_category->getUrlPath()).basename($_product->getProductUrl());
I am actually inside a class which is extending from Mage_Core_Controller_Front_Action
. Could anyone tell me what should come in place of $this
in order for me to get the proper URL?
Upvotes: 1
Views: 3193