Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design
Showing posts with label Simple Product SKU. Show all posts
Showing posts with label Simple Product SKU. Show all posts

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.

Magento Simple product details of configurable products

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

Get Configurable Product SKU and Its Simple Product SKU in Cart Page Magento

Put this code at templet/checkout/cart/item/default.phtml after this line "$_item = $this->getItem();"

<?php
echo $temp = $_item->getProductId();
echo "<br/>";
$_product = Mage::getModel('catalog/product')->load($temp);
echo "Config. Product :";
echo $_product->getSku();
echo "<br/>";

echo "Simple Product :";
echo $_item->getSku();
?>


 

Copyright @ 2017 HKBlog.