Reputation: 1746
I have few custom urls in magento url rewrite management. I need to check whether a particular target path exists in the url rewrite management. For example, if my target path is "XXXX/YYYY/XYZ", how would I check that this target path is present in the url rewrite management?
Upvotes: 0
Views: 3408
Reputation: 12727
By using the Mage_Core_Model_Url_Rewrite
model, e.g. like this:
$oUrlRewriteCollection = Mage::getModel('core/url_rewrite')
->getCollection()
// ->addStoreFilter($iStoreId)
->addFieldToFilter('target_path', 'XXXX/YYYY/XYZ');
if (count($oUrlRewriteCollection) > 0) {
// target path does exist
}
Upvotes: 5