Get Simple product details of configurable products like ID, SKU, Product Name
If you want to get Simple product details of configurable product like simple product Id, sku, product name etc. you can get using my simple module.
Before using this module you need to add simple script for getting simple product id from configurable product. Check my previous post Get Simple product of configurable product.
In that script you just need to change following ajax code instead of alert box.
Note: You must need to add jQuery library in your page if library is not already added before using ajax code.
jQuery.ajax({
type: "POST",
url: "<?php echo $this->getBaseUrl()?>productdetails/index/optiondetails/",
data:"id="+currentSimpleProductId,
success: function(msg)
{
alert(msg);
//var data = JSON.parse(msg);
//alert(data.id);
}
});
Download Source
Before using this module you need to add simple script for getting simple product id from configurable product. Check my previous post Get Simple product of configurable product.
In that script you just need to change following ajax code instead of alert box.
Note: You must need to add jQuery library in your page if library is not already added before using ajax code.
jQuery.ajax({
type: "POST",
url: "<?php echo $this->getBaseUrl()?>productdetails/index/optiondetails/",
data:"id="+currentSimpleProductId,
success: function(msg)
{
alert(msg);
//var data = JSON.parse(msg);
//alert(data.id);
}
});
Download Source
Please support us, Like us on Facebook.
Subscribe to:
Post Comments (Atom)
Does not seem to work in 1.8.1 Have tried as the tutorial suggests. Showing the product ID only works but not when I replace the "alert("Selected product is: "+currentSimpleProductId)" for the ajax.
ReplyDeleteThis is working in magento 1.8.1 as well. Please like our facebook page for more help. www.facebook.com/developersarea
DeleteHi! Thanks for this module! Really helps! But I have some question, how can i display the associated simple product attribute/detail to the product page, instead of showing it into an alert box? Lets say, i want to show "per pack" attribute beside the price.
ReplyDeleteYes you can do this as, create one blank div and than replace you alert box with...
DeletejQuery("#DIVID").html(msg);
Thanks,
Hi,
ReplyDeleteI am attempting to display a simple products upsell list on a configurable product, your code may just do the job but I am struggling with the implementation, where would I use the code? I guess upsell.php or abstract.php seems pretty complicated :/
Will it work in magento 1.9.0.0 version?
ReplyDeleteYes it will work in Magento 1.9 as well.
DeleteYes its working fine in 1.9. Thanks for your sharing your module.
DeleteI replaced the alert message with supplied code and added jquery (https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js) but now my drop down boxes are empty. I am using Magento 1.9.1. Please help! Thank you
ReplyDeleteCan you please show me your link?
DeleteThanks
i try to retrieve price and want to replace the magento default price of this associated products with that price
ReplyDeletei retrieve product price and want to replace the default associated product price with this price
ReplyDeleteYou are getting product price in alert message?
Deleteyes.But i want to replace this price in the position of default price
ReplyDeleteYou can use jQuery to replace default price with new price. That is what you want?
DeleteYes.I want to display the corresponding prices when selecting each simple products
ReplyDeleteUse jQuery method to replace default product price with new one in place of alert.
DeletejQuery("#defaultpriceID").html(newprice);
DeleteHi, the script works with the alert box but not when I substitute the alert box eith the ajax, then the 'alert msg' dialog box gets not displayed at all. I really need to have simple details on view.phtml so I guess using ajax is the first step to achieve this (I'm using magento 1.9.2.4 by the way). Can you help me?
ReplyDeleteHello,
DeleteIf alert box is working for you, then you simply need to replace alert box code with above ajax code nothing else.
Should you have any questions, please let me know.
Thanks,
Btw i got it working but i have to click twice on the same option to get the values ? How i can correct this ?
ReplyDeleteI precise i have two attributes. Color and Size
DeleteWhich file i can put below code :
ReplyDeletejQuery.ajax({
type: "POST",
url: "getBaseUrl()?>productdetails/index/optiondetails/",
data:"id="+currentSimpleProductId,
success: function(msg)
{
alert(msg);
//var data = JSON.parse(msg);
//alert(data.id);
}
});
Hi,
ReplyDeletejust tried your scripts in Magento 1.9.1 ..
Fist part worked fine - get the alert with the ID of the selected simple product. Then I replaced thea alert line with the jQuery code ... nothing happened.
I just want to display the sku of the simple product. How can I get the sku out of the id? ...
Thank you very much!!!
Hi, i've tried your scritp and the module, the script for the ID works great on Magento 1.9 but when i try to use it with this module i can get the message. The url getBaseUrl()?>productdetails/index/optiondetails/ gets a 404 not found. I've copied with FTP module file in app/code/local and etc/module
ReplyDeleteThank you!
Has anyone got this to work with 1.9.3.3?
ReplyDeleteHi there!!
ReplyDeleteSimple alert with product id is working but after pasting code it is showing error in ajax request and also when get url copy and pasted in another tab it is showing 404 error. Please help me out as my project is stuck just because of this one thing!!
Quick reply will be appreciated!!
Hello,
DeletePlease show me your code. Better to email me on hkpatel201@gmail.com
Thanks,
Hi,
ReplyDeletei have a problem to get the value of a custom attribute. its code is 'base_price_amount'.
$product->getBasePriceAmount(); returns 'null'
how can i access custom attributes?
thanks for your answer.
hi,
ReplyDeletei have a problem with a custom attribute. its code is 'base_price_amount'.
$product->getBasePriceAmount(); returns 'NULL'
how to access a custom attribute?!
thanks for your answer