How can i get product thumbnail image, sku, name, details, if enter sku on custom page

I need products thumbnail image, SKU, name, details, if the customer enters sku on custom page.


Please use this code:

$_sku = 'xyz';
                $_catalog = Mage::getModel('catalog/product');
                $_productId = $_catalog->getIdBySku($_sku);
                $_product = Mage::getModel('catalog/product')->load($_productId);
                // get Product's name
                echo $_product->getName();
                //get product's short description
                echo $_product->getShortDescription();
                //get Product's Long Description
                echo $_product->getDescription();
                //get Product's Regular Price
                echo $_product->getPrice();
                //get Product's Special price
                echo $_product->getSpecialPrice();
                //get Product's Url
                echo $_product->getProductUrl();
                //get Product's image Url
                echo $_product->getImageUrl();

I am assuming that the customer is entering the sku of product and that sku you are getting in post value. so for getting more details of product from the sku you can use the following code :

$sku = 'abc'; // The sku entered by customer
$productCollection = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);

Now you will have product object through which you can get your data for example

$thumbnail = $productCollection->getThumbnailUrl();
$name = $productCollection->getName();

and similarly other relevent details of product.

Hope it works for you !!

Similar questions

Show thumbnail image and delete image in custom module admin form
I'm trying to display thumbnail image in my custom admin module edit form like this Right now I'm using this addfield. I looked at lib/Varien/Data/Form/Element/Image.php and found this code which uses images url there. But I'm not storing images in media folder for this module. I'm uploading images from the controller in ram_images folder. Also, i ...
Product SKU requirements. What characters are restricted from a product SKU and can there be spaces in the middle of the SKU?
For product SKU's can there be spaces in the middle of the SKU? Are there any character restrictions that can not be used for a SKU ?
How can I change more images thumbnail image placement on product page?
I want to show more views images thumbnail in the left of the main image. Anyone please suggest me how can I do that.
Magento product import using magmi Base Image, Small image and Thumbnail fields not selected
I have imported products, categories and images successfully using Magmi but Base Image, Small Image and Thumbnail attributes of the image are not getting selected.
Place holder image instead of thumbnail product image in magento 2.1.9
I have installed Magento 2.1.9 and import product via csv. After import I tried: clear Cache Static-content generate Reindex Setup upgrade catalog Image resize remove all /var/* content compile also Still showing a thumbnail place holder image in frontend and admin. The Product Page "Images And Videos" is showing the image Correctly. Suggest me, ho...
Magento 2 Change Minicart Product Image from thumbnail to regular image
After editing the minicart for a couple of days now i've noticed that the images are smaller versions of the images that you would see on the product pages. This means as i'm upscaling them to fit a larger container they are losing quality. The file containing the image reference is within Magento_Catalog/web/template/product/image_with_borders.htm...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.