View product in frontend from Magento admin

Featured Image

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


About Ivica Tadic

Partner

Certified Magento developer whose mission is to provide everything necessary to get the job done. Working with our client at Kuwait.

Read more posts by Ivica / Visit Ivica's profile

22 comments

  1. any one tell me how to work with rest api magneto 2.x using java.how to get the products

  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. We have coded an own Product Preview extension for Magento. Futhermore you can preview CMS Pages too. You don’t have to activate the products and cms pages, so your customers and google can’t see them. For all Seos, you see the real product url in frontend, like google and your customers did.

    Try it.

  6. 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..?

  7. 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!

  8. 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

  9. 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?

  10. 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();

  11. 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!

  12. 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>.