0

I am using Magento 1.9.

I will get a url from the request. I have to find product/category id from the url.

I have tried these :-

  1. Magento - Load product by url
  2. Magento 1 get product or category id by url string

But I am getting empty result.

Result:-

Array
(
    [store_id] => 1
    [url_rewrite_id] => 
)

I have tried it like this :-

$url = '/product-name1728202.html'/'category-name';

(The first one is a product url and the second one is a category url and I will get any one of them).

$oRewrite = Mage::getModel('core/url_rewrite')
                ->setStoreId(Mage::app()->getStore()->getId())
                ->loadByRequestPath($url);

I am getting the result I mentioned above regardless I have either product or category url. What do I do. I am not finding any other solution for this. Please help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.