1

Is there any methods to know which type of page i have with an url ?

I would like to know with a page .html if it s a product page , a category page , cms page or home ? And i would like to know also what is the productid, the categoryid, or the cms page id associate to the html url :)

Thanks a lot by advance

Thomas

1

check product page and category page

   if(Mage::registry('current_product')){
        $product = Mage::registry('current_product');
        $id = $product->getId();
   }

   if(Mage::registry('current_category')){
      $category = Mage::registry('current_category');  
      $category->getId(); 
   }
  • @KeyurShah bro it was yesterday ,I enjoyed a lot with friends – Murtuza Zabuawala Jan 15 '18 at 14:31
  • Thanks Murtuza but i can t do that , indeed i will just send by ajax the url. So there is no current_.... :( – thomas poidevin Jan 15 '18 at 14:31
  • @thomaspoidevin can able to get Handlers ?? via this code var_dump(Mage::app()->getLayout()->getUpdate()->getHandles()); – Murtuza Zabuawala Jan 15 '18 at 14:34

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.