View product in frontend from Magento admin

View product in frontend from Magento admin

When you are editing some product in Magento admin and want to check it out in frontend of your Magento project, how do you find this particular product? Do you search for it, navigate to it using product url key or just browse to it? Well, however you do it, I’m going to give you the easiest way to get to your desired product in the frontend – view product link.

Tadic_AVP screenshot

Here’s an extremely lightweight Magento extension which will provide you with a simple view product link next to a product name, in Magento admin. It will point to a product view page in the frontend of your Magento project. Simple and easy.

https://github.com/ivicatadic/Tadic_AVP
or for donwload
Tadic_AVP

All you have to do is copy the content of Tadic_AVP extension (app folder) to a root folder of your Magento project – and that’s it. I hope this simple extension will prove to be useful to you.
Thanks to Branko Ajzele for an idea.

Cheers

You made it all the way down here so you must have enjoyed this post! You may also like:

Adding gallery tab to a CMS page Antun Martinovic
Antun Martinovic, | 5

Adding gallery tab to a CMS page

Custom Product Option and its use-case in Magento Ivan Galambos
Ivan Galambos, | 25

Custom Product Option and its use-case in Magento

Selective attribute sorting Ivica Tadic
Ivica Tadic, | 9

Selective attribute sorting

24 comments

  1. If I want to check the frontend page of product that customers have ordered, will I be able to add view product link in sales order grid using your suggested extension?

  2. I also have to update the code to work with my Magento 1.9.2.4, with store params in url. Below, my working code with the store code ‘fr’. I presume you will have to change it regarding your store code configuration 🙂

    class Tadic_AVP_Block_Adminhtml_Catalog_Product_Edit extends Mage_Adminhtml_Block_Catalog_Product_Edit
    {
    
    	public function getHeader()
    	{
    		$header = parent::getHeader();
    
    		$product = $this->getProduct();
    		$productId = $product->getId();
    
    		if( $productId ){ 
    			$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($productId); 	
    
    			if( $parentIds ){ // check if product has a configurable parent	 	
    				$product = Mage::getModel('catalog/product')->load($parentIds[0]);
    				$productId = $product->getId();  // product to display will be the parent
    			}
    		}
    
    		if ( $productId ){
    
    			$code = 'fr';
    			$storeId = Mage::app()->getStore($code)->getId();
    
    			if ( $storeId ){
    			    $productUrl = Mage::getModel('catalog/product')->setStoreId($storeId)->load($productId)->getProductUrl();
    			    $header .= "&nbsp&nbsp<a href='$productUrl' target='_blank'>View</a>";
    			}
    		}
    
    		return $header;
    	}
    
    }

    Thank you for the plugin

  3. Plugin is still working on Magento 1.9 community. (with raul’s comment modifications)

    To make it works on my project, I had to modify the code. it could be interesting for others so let’s share it : I have a multi website with no “default” store, i need to rewrite ‘$url’ to make the redirection Ok, according to the actual admin store view.
    If you are editing the children of a configurable product, my code will display the configurable parent instead. (cause my children products are “not visible”).
    And, I skipped preview link, because it wasn’t working.

    $header = parent::getHeader();
    
    $product = $this->getProduct();
    $productId = $product->getId();
    
    if( $productId ){ 
    	$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($productId); 	
    
    	if( $parentIds ){ // check if product has a configurable parent	 	
    		$product = Mage::getModel('catalog/product')->load($parentIds[0]);
    		$productId = $product->getId();  // product to display will be the parent
    	}
    }
    
    if ( $productId ){
    	$storeId = Mage::app()->getRequest()->getParam('store');
    
    	if ( $storeId ){
    		$store = Mage::getModel('core/store')->load($storeId);
    		$siteUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
    	    $productUrl = $siteUrl . $product->getUrlPath(); 
    	    $header .= "&nbsp&nbsp<a href='$productUrl' target='_blank'>View</a>";
    	}
    }
    return $header;
  4. works for me…get addin. Love your site and blog. Really great of you to give back to the community!!!!

  5. i have created some simple products in the admin panel of my magento site..but i don’t know the exact procedure of displaying them in the frontend..

    ..can anyone help me out please..?

  6. I am using this on our store right now. I used Raul’s suggestion and it is working just great using the URL Path. Thanks for the great extension!

  7. I am pretty sure there should be a better way to do this, meanwhile…

    I’ve fixed it changing…

    $url = $this->getProduct()->getUrlInStore();

    with…

    $url = Mage::app()->getDefaultStoreView()->getBaseUrl().$this->getProduct()->getUrlPath();

    Regards

  8. Working with different stores & language codes (such as /en or /es) added to URLs seems to break this great extension…

    getUrlInStore() gets Admin url, instead of the appropiate Front url… any ideas to fix this?

  9. Works great. Only thing I had to change for use in Magento 1.3.4.2 was:

    $url = $this->getProduct()->getUrlInStore();

    $url = $this->getProduct()->getProductUrl();

  10. Simply the best. Can you extend this extension so that there is preview for following pages too:
    – Categories
    – CMS Pages
    – Homepage (link somewhere near logout)

    Keep up your good work!

  11. I think that it would we wonderful that you can see products “No visible individually” or add a new option in visibility or let user being capable to see not habilited products…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.