Using Magento 1.7.0.2 CE, I would like to try to find a way to make XML layout changes to the Product View page, depending on if the product was searched in-site or found from the category view. Reason being, the custom vertical navigation on the left bar I made for our site uses the "current_category" key in the Magento registry to display correctly.
If there is no category set, it displays our 7 major base categories. If a category is set, it displays only the sub-categories of that base category (~34 sub-cats, expands with active sub-category). So naturally, I would like to even out my sidebar space when the vertical navigation bar is small.
If a product is browsed through a category, the registry keeps the "current_category" key, so my vertical navigation fills the left bar quite well on its own. If it is searched, the navigation bar approaches about 30% of the height when compared with the right bar.
My ideal solution would be a layout update to local.xml, but I'm not sure if there is anything already built in place with Magento to do so.
So my final question is in two parts: Is there a way within Magento's XML Layout to determine if the "catalog_product_view" page was loaded via category or search?
If not: What would be the most efficient way to code in moving a couple blocks from the right bar to the left from the product view page, depending on if the product was searched or browsed?
One possible solution (for the last bit): Would anyone know how to code in a new layout tag? I was thinking of instead of just "catalog_product_view", creating "catalog_product_view_browsed" and "catalog_product_view_searched" that are applied over the default product view.
Edit: I have it working and my answer has been posted below. :)