Mage::getModel('catalog/category')->loadByAttribute('name', $val)->getUrl();

The above code won't work correctly in my PHP code when I have multiple categories & sub-categories with the same displayed name Eg. Ford > 2400 and Hyundai > 2400. It provides an incorrect URL for one of the categories under the same name (2400).

How can I resolve this? How else can I load my category attribute for it to be accurate to it's URL value?

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.