List Product Collection into template file in Magento 2Magento Configurable Product Export, Multiple Super Attribute Error FixMagento catalog Product ListMagento2: How to update the product price programaticallyMagento 2 Fatal error: Uncaught Error: Cannot instantiate interface on catalog/product pages and widgetsMagento 2: Plugin class does not existHaving trouble exporting products from Magento 2.x. Fatal error: Uncaught Error: Call to a member function getName()Edit product list templateI have created one field using product form field for my price i want save my field value at product creation time from backend magento2Magento 2 get custom attribute of a single product inside a pluginCall to a member function getId() on null - module-catalog/Helper/Product.php
How can Kazakhstan perform MITM attacks on all HTTPS traffic?
Why did modems have speakers?
Are symplectomorphisms of Weil–Petersson symplectic form induced from surface diffeomorphisms?
"It is what it is" in French
How to write a sincerely religious protagonist without preaching or affirming or judging their worldview?
Can GPL and BSD licensed applications be used for government work?
Invert Some Switches on a Switchboard
Why must API keys be kept private?
In a script how can I signal who's winning the argument?
Raw curve25519 public key points
What happens when two cards both modify what I'm allowed to do?
Idioms: Should it be " the internet is a seemingly infinite well of information" or "the internet is a seemingly infinite wealth of information"
How can the artificial womb be made affordable for the common people?
Is there a way to shorten this while condition?
Why do people say "I am broke" instead of "I am broken"?
Other than a swing wing, what types of variable geometry have flown?
Film where a boy turns into a princess
Why can't a country print its own money to spend it only abroad?
Impact of throwing away fruit waste on a peak > 3200 m above a glacier
How important is a good quality camera for good photography?
Is the apartment I want to rent a scam?
Extrapolation v. Interpolation
Why is DC so, so, so Democratic?
Why is chess failing to attract big name sponsors?
List Product Collection into template file in Magento 2
Magento Configurable Product Export, Multiple Super Attribute Error FixMagento catalog Product ListMagento2: How to update the product price programaticallyMagento 2 Fatal error: Uncaught Error: Cannot instantiate interface on catalog/product pages and widgetsMagento 2: Plugin class does not existHaving trouble exporting products from Magento 2.x. Fatal error: Uncaught Error: Call to a member function getName()Edit product list templateI have created one field using product form field for my price i want save my field value at product creation time from backend magento2Magento 2 get custom attribute of a single product inside a pluginCall to a member function getId() on null - module-catalog/Helper/Product.php
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am loading the Product Collection by calling the ajax request.
Here is my code of template file.
$('#modifyRecentAddSkus1').on('click',function()
var skus = $('#skus1').val();
skus = skus.replace(/,s*$/, '');
var res = skus.split(",");
$.ajax(
url: 'test1.php?skus='+skus,
type: "POST",
success : function(result)
$('#originalRecentHtml1 .product-thumbset').html(result);
);
);
Where #sku1 html is like below.
<input id="skus1" value="20057959, 20058000, 20057925, 20057967, 20057977, 20057974" type="hidden"> <!-- Here is the comma separated skus -->
Then this is the code of my test1.php file.
if(isset($_REQUEST['skus']))
$recentSkuArr = explode(',',$_REQUEST['skus']);
$html = '';
$currencySymbol = '£';
$html .= '<div class="products wrapper grid products-grid">
<ol class="products list items product-items">';
$i = 0;
foreach($recentSkuArr as $recentSku)
if($recentSku !='')
$qty = 0;
$productId = $objectManager->get('MagentoCatalogModelProduct')->getIdBySku(trim($recentSku));
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId);
$product_title = $product->getName(); //Get Product Name
$StockState = $objectManager->get('MagentoCatalogInventoryApiStockStateInterface');
$qty = $StockState->getStockQty($productId, $product->getStore()->getWebsiteId());
$prodUrl = $product->getProductUrl();
$helperImport = $objectManager->get('MagentoCatalogHelperImage');
$priceHelper = $objectManager->create('MagentoFrameworkPricingHelperData');
$helperImport = $objectManager->get('MagentoCatalogHelperImage');
$imageUrl = $helperImport->init($product, 'product_page_image_small')
->setImageFile($product->getSmallImage()) // image,small_image,thumbnail
->resize(380)
->getUrl();
$imageUrl = str_replace('pub/','',$imageUrl);
$price = $priceHelper->currency($product->getFinalPrice(), true, false);
$productSku = $product->getSku();
//you can also use load($id) if you know product id
$listBlock = $objectManager->get('MagentoCatalogBlockProductListProduct');
$formKey = $objectManager->create('MagentoFrameworkDataFormFormKey')->getFormKey();
$addToCartUrl = $listBlock->getAddToCartUrl($product);
$product = $objectManager->create("MagentoCatalogModelProduct")->loadByAttribute('sku', $productSku);
$reviewFactory = $objectManager->create('MagentoReviewModelReview');
$storeManager = $objectManager->create('MagentoStoreModelStoreManagerInterface');
$storeId = $storeManager->getStore()->getStoreId();
$reviewFactory->getEntitySummary($product, $storeId);
$ratingSummary = $product->getRatingSummary()->getRatingSummary();
$reviewCount = $product->getRatingSummary()->getReviewsCount();
$getBaseUrl = $storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB);
$ratingSummary = isset($ratingSummary) ? "<div class='rating-result' title='".$ratingSummary."%'>
<span style="width:'".$ratingSummary."%"><span>'".$ratingSummary."%'</span></span>
</div>" : '';
$reviewCount = isset($reviewCount) ? $reviewCount." <span>Review</span>" : '';
$reviewlink = isset($reviewCount) ? $prodUrl."#reviews" : '';
if(!empty($ratingSummary))
$ratingText = ":Rating";
else
$ratingText = "";
if($qty > 0)
$html .= '<li class="item product product-item">
<div class="product-item-info" data-container="product-grid">
<a href="'.$prodUrl.'" class="product photo product-item-photo" tabindex="-1">
<span class="product-image-container" style="width:240px;">
<span class="product-image-wrapper" style="padding-bottom: 125%;">
<img class="product-image-photo" src="'.$imageUrl.'" width="240" height="300" alt="Tye Missa Euge Bone CD"></span>
</span>
</a>
<div class="product details product-item-details">
<div class="product-reviews-summary short">
<div class="rating-summary">
<span class="label"><span>'.$ratingText.'</span></span>
'.$ratingSummary.'
</div>
<div class="reviews-actions">
<a class="action view" href="'.$reviewlink.'">'.$reviewCount.'</a>
</div>
</div>
<strong class="product name product-item-name">
<a class="product-item-link" href="'.$prodUrl.'">
'.$product_title.'</a>
</strong>
<div class="price-box price-final_price" data-role="priceBox" data-product-id="5641">
<span class="price-container price-final_price tax weee">
<span id="product-price-'.$productId.' data-price-amount='.$price.' data-price-type="finalPrice" class="price-wrapper ">
<span class="price">'.$price.'</span> </span>
</span>
</div>
<form action="'.$getBaseUrl.'vendor/index/Productadd/" method="post">
<input type="hidden" name="productId" value='.$productId.'>
<button type="submit" title="Add to Basket" class="action tocart primary">
<span>Add to Cart</span>
</button>
</form>
</div>
</div>
</li>';
$i++;
$html .= '</ol> </div>';
echo $html;
From above code I am getting the HTML as response, then I am attaching the content to the div.
The above code works fine for all simple products,but my question here is How to load the html for configurable products over here.
Where all color and size attributes should show with price changing when selection is made.
Can anyone help me to achieve this functionality please. Thanks!!
magento2 configurable-product product-collection product-list
add a comment |
I am loading the Product Collection by calling the ajax request.
Here is my code of template file.
$('#modifyRecentAddSkus1').on('click',function()
var skus = $('#skus1').val();
skus = skus.replace(/,s*$/, '');
var res = skus.split(",");
$.ajax(
url: 'test1.php?skus='+skus,
type: "POST",
success : function(result)
$('#originalRecentHtml1 .product-thumbset').html(result);
);
);
Where #sku1 html is like below.
<input id="skus1" value="20057959, 20058000, 20057925, 20057967, 20057977, 20057974" type="hidden"> <!-- Here is the comma separated skus -->
Then this is the code of my test1.php file.
if(isset($_REQUEST['skus']))
$recentSkuArr = explode(',',$_REQUEST['skus']);
$html = '';
$currencySymbol = '£';
$html .= '<div class="products wrapper grid products-grid">
<ol class="products list items product-items">';
$i = 0;
foreach($recentSkuArr as $recentSku)
if($recentSku !='')
$qty = 0;
$productId = $objectManager->get('MagentoCatalogModelProduct')->getIdBySku(trim($recentSku));
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId);
$product_title = $product->getName(); //Get Product Name
$StockState = $objectManager->get('MagentoCatalogInventoryApiStockStateInterface');
$qty = $StockState->getStockQty($productId, $product->getStore()->getWebsiteId());
$prodUrl = $product->getProductUrl();
$helperImport = $objectManager->get('MagentoCatalogHelperImage');
$priceHelper = $objectManager->create('MagentoFrameworkPricingHelperData');
$helperImport = $objectManager->get('MagentoCatalogHelperImage');
$imageUrl = $helperImport->init($product, 'product_page_image_small')
->setImageFile($product->getSmallImage()) // image,small_image,thumbnail
->resize(380)
->getUrl();
$imageUrl = str_replace('pub/','',$imageUrl);
$price = $priceHelper->currency($product->getFinalPrice(), true, false);
$productSku = $product->getSku();
//you can also use load($id) if you know product id
$listBlock = $objectManager->get('MagentoCatalogBlockProductListProduct');
$formKey = $objectManager->create('MagentoFrameworkDataFormFormKey')->getFormKey();
$addToCartUrl = $listBlock->getAddToCartUrl($product);
$product = $objectManager->create("MagentoCatalogModelProduct")->loadByAttribute('sku', $productSku);
$reviewFactory = $objectManager->create('MagentoReviewModelReview');
$storeManager = $objectManager->create('MagentoStoreModelStoreManagerInterface');
$storeId = $storeManager->getStore()->getStoreId();
$reviewFactory->getEntitySummary($product, $storeId);
$ratingSummary = $product->getRatingSummary()->getRatingSummary();
$reviewCount = $product->getRatingSummary()->getReviewsCount();
$getBaseUrl = $storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB);
$ratingSummary = isset($ratingSummary) ? "<div class='rating-result' title='".$ratingSummary."%'>
<span style="width:'".$ratingSummary."%"><span>'".$ratingSummary."%'</span></span>
</div>" : '';
$reviewCount = isset($reviewCount) ? $reviewCount." <span>Review</span>" : '';
$reviewlink = isset($reviewCount) ? $prodUrl."#reviews" : '';
if(!empty($ratingSummary))
$ratingText = ":Rating";
else
$ratingText = "";
if($qty > 0)
$html .= '<li class="item product product-item">
<div class="product-item-info" data-container="product-grid">
<a href="'.$prodUrl.'" class="product photo product-item-photo" tabindex="-1">
<span class="product-image-container" style="width:240px;">
<span class="product-image-wrapper" style="padding-bottom: 125%;">
<img class="product-image-photo" src="'.$imageUrl.'" width="240" height="300" alt="Tye Missa Euge Bone CD"></span>
</span>
</a>
<div class="product details product-item-details">
<div class="product-reviews-summary short">
<div class="rating-summary">
<span class="label"><span>'.$ratingText.'</span></span>
'.$ratingSummary.'
</div>
<div class="reviews-actions">
<a class="action view" href="'.$reviewlink.'">'.$reviewCount.'</a>
</div>
</div>
<strong class="product name product-item-name">
<a class="product-item-link" href="'.$prodUrl.'">
'.$product_title.'</a>
</strong>
<div class="price-box price-final_price" data-role="priceBox" data-product-id="5641">
<span class="price-container price-final_price tax weee">
<span id="product-price-'.$productId.' data-price-amount='.$price.' data-price-type="finalPrice" class="price-wrapper ">
<span class="price">'.$price.'</span> </span>
</span>
</div>
<form action="'.$getBaseUrl.'vendor/index/Productadd/" method="post">
<input type="hidden" name="productId" value='.$productId.'>
<button type="submit" title="Add to Basket" class="action tocart primary">
<span>Add to Cart</span>
</button>
</form>
</div>
</div>
</li>';
$i++;
$html .= '</ol> </div>';
echo $html;
From above code I am getting the HTML as response, then I am attaching the content to the div.
The above code works fine for all simple products,but my question here is How to load the html for configurable products over here.
Where all color and size attributes should show with price changing when selection is made.
Can anyone help me to achieve this functionality please. Thanks!!
magento2 configurable-product product-collection product-list
You can use product layout, load that block set your product and call toHtml and pass that data into your ajax response. But in that you need to some customization for your JS file which changes the swatches and prices, you need to add them on your layout file
– Ashish Ranade
Jul 17 at 3:40
@AshishRanade, can u please update me code for that.
– Manjunath
Jul 17 at 5:51
add a comment |
I am loading the Product Collection by calling the ajax request.
Here is my code of template file.
$('#modifyRecentAddSkus1').on('click',function()
var skus = $('#skus1').val();
skus = skus.replace(/,s*$/, '');
var res = skus.split(",");
$.ajax(
url: 'test1.php?skus='+skus,
type: "POST",
success : function(result)
$('#originalRecentHtml1 .product-thumbset').html(result);
);
);
Where #sku1 html is like below.
<input id="skus1" value="20057959, 20058000, 20057925, 20057967, 20057977, 20057974" type="hidden"> <!-- Here is the comma separated skus -->
Then this is the code of my test1.php file.
if(isset($_REQUEST['skus']))
$recentSkuArr = explode(',',$_REQUEST['skus']);
$html = '';
$currencySymbol = '£';
$html .= '<div class="products wrapper grid products-grid">
<ol class="products list items product-items">';
$i = 0;
foreach($recentSkuArr as $recentSku)
if($recentSku !='')
$qty = 0;
$productId = $objectManager->get('MagentoCatalogModelProduct')->getIdBySku(trim($recentSku));
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId);
$product_title = $product->getName(); //Get Product Name
$StockState = $objectManager->get('MagentoCatalogInventoryApiStockStateInterface');
$qty = $StockState->getStockQty($productId, $product->getStore()->getWebsiteId());
$prodUrl = $product->getProductUrl();
$helperImport = $objectManager->get('MagentoCatalogHelperImage');
$priceHelper = $objectManager->create('MagentoFrameworkPricingHelperData');
$helperImport = $objectManager->get('MagentoCatalogHelperImage');
$imageUrl = $helperImport->init($product, 'product_page_image_small')
->setImageFile($product->getSmallImage()) // image,small_image,thumbnail
->resize(380)
->getUrl();
$imageUrl = str_replace('pub/','',$imageUrl);
$price = $priceHelper->currency($product->getFinalPrice(), true, false);
$productSku = $product->getSku();
//you can also use load($id) if you know product id
$listBlock = $objectManager->get('MagentoCatalogBlockProductListProduct');
$formKey = $objectManager->create('MagentoFrameworkDataFormFormKey')->getFormKey();
$addToCartUrl = $listBlock->getAddToCartUrl($product);
$product = $objectManager->create("MagentoCatalogModelProduct")->loadByAttribute('sku', $productSku);
$reviewFactory = $objectManager->create('MagentoReviewModelReview');
$storeManager = $objectManager->create('MagentoStoreModelStoreManagerInterface');
$storeId = $storeManager->getStore()->getStoreId();
$reviewFactory->getEntitySummary($product, $storeId);
$ratingSummary = $product->getRatingSummary()->getRatingSummary();
$reviewCount = $product->getRatingSummary()->getReviewsCount();
$getBaseUrl = $storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB);
$ratingSummary = isset($ratingSummary) ? "<div class='rating-result' title='".$ratingSummary."%'>
<span style="width:'".$ratingSummary."%"><span>'".$ratingSummary."%'</span></span>
</div>" : '';
$reviewCount = isset($reviewCount) ? $reviewCount." <span>Review</span>" : '';
$reviewlink = isset($reviewCount) ? $prodUrl."#reviews" : '';
if(!empty($ratingSummary))
$ratingText = ":Rating";
else
$ratingText = "";
if($qty > 0)
$html .= '<li class="item product product-item">
<div class="product-item-info" data-container="product-grid">
<a href="'.$prodUrl.'" class="product photo product-item-photo" tabindex="-1">
<span class="product-image-container" style="width:240px;">
<span class="product-image-wrapper" style="padding-bottom: 125%;">
<img class="product-image-photo" src="'.$imageUrl.'" width="240" height="300" alt="Tye Missa Euge Bone CD"></span>
</span>
</a>
<div class="product details product-item-details">
<div class="product-reviews-summary short">
<div class="rating-summary">
<span class="label"><span>'.$ratingText.'</span></span>
'.$ratingSummary.'
</div>
<div class="reviews-actions">
<a class="action view" href="'.$reviewlink.'">'.$reviewCount.'</a>
</div>
</div>
<strong class="product name product-item-name">
<a class="product-item-link" href="'.$prodUrl.'">
'.$product_title.'</a>
</strong>
<div class="price-box price-final_price" data-role="priceBox" data-product-id="5641">
<span class="price-container price-final_price tax weee">
<span id="product-price-'.$productId.' data-price-amount='.$price.' data-price-type="finalPrice" class="price-wrapper ">
<span class="price">'.$price.'</span> </span>
</span>
</div>
<form action="'.$getBaseUrl.'vendor/index/Productadd/" method="post">
<input type="hidden" name="productId" value='.$productId.'>
<button type="submit" title="Add to Basket" class="action tocart primary">
<span>Add to Cart</span>
</button>
</form>
</div>
</div>
</li>';
$i++;
$html .= '</ol> </div>';
echo $html;
From above code I am getting the HTML as response, then I am attaching the content to the div.
The above code works fine for all simple products,but my question here is How to load the html for configurable products over here.
Where all color and size attributes should show with price changing when selection is made.
Can anyone help me to achieve this functionality please. Thanks!!
magento2 configurable-product product-collection product-list
I am loading the Product Collection by calling the ajax request.
Here is my code of template file.
$('#modifyRecentAddSkus1').on('click',function()
var skus = $('#skus1').val();
skus = skus.replace(/,s*$/, '');
var res = skus.split(",");
$.ajax(
url: 'test1.php?skus='+skus,
type: "POST",
success : function(result)
$('#originalRecentHtml1 .product-thumbset').html(result);
);
);
Where #sku1 html is like below.
<input id="skus1" value="20057959, 20058000, 20057925, 20057967, 20057977, 20057974" type="hidden"> <!-- Here is the comma separated skus -->
Then this is the code of my test1.php file.
if(isset($_REQUEST['skus']))
$recentSkuArr = explode(',',$_REQUEST['skus']);
$html = '';
$currencySymbol = '£';
$html .= '<div class="products wrapper grid products-grid">
<ol class="products list items product-items">';
$i = 0;
foreach($recentSkuArr as $recentSku)
if($recentSku !='')
$qty = 0;
$productId = $objectManager->get('MagentoCatalogModelProduct')->getIdBySku(trim($recentSku));
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->create('MagentoCatalogModelProduct')->load($productId);
$product_title = $product->getName(); //Get Product Name
$StockState = $objectManager->get('MagentoCatalogInventoryApiStockStateInterface');
$qty = $StockState->getStockQty($productId, $product->getStore()->getWebsiteId());
$prodUrl = $product->getProductUrl();
$helperImport = $objectManager->get('MagentoCatalogHelperImage');
$priceHelper = $objectManager->create('MagentoFrameworkPricingHelperData');
$helperImport = $objectManager->get('MagentoCatalogHelperImage');
$imageUrl = $helperImport->init($product, 'product_page_image_small')
->setImageFile($product->getSmallImage()) // image,small_image,thumbnail
->resize(380)
->getUrl();
$imageUrl = str_replace('pub/','',$imageUrl);
$price = $priceHelper->currency($product->getFinalPrice(), true, false);
$productSku = $product->getSku();
//you can also use load($id) if you know product id
$listBlock = $objectManager->get('MagentoCatalogBlockProductListProduct');
$formKey = $objectManager->create('MagentoFrameworkDataFormFormKey')->getFormKey();
$addToCartUrl = $listBlock->getAddToCartUrl($product);
$product = $objectManager->create("MagentoCatalogModelProduct")->loadByAttribute('sku', $productSku);
$reviewFactory = $objectManager->create('MagentoReviewModelReview');
$storeManager = $objectManager->create('MagentoStoreModelStoreManagerInterface');
$storeId = $storeManager->getStore()->getStoreId();
$reviewFactory->getEntitySummary($product, $storeId);
$ratingSummary = $product->getRatingSummary()->getRatingSummary();
$reviewCount = $product->getRatingSummary()->getReviewsCount();
$getBaseUrl = $storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_WEB);
$ratingSummary = isset($ratingSummary) ? "<div class='rating-result' title='".$ratingSummary."%'>
<span style="width:'".$ratingSummary."%"><span>'".$ratingSummary."%'</span></span>
</div>" : '';
$reviewCount = isset($reviewCount) ? $reviewCount." <span>Review</span>" : '';
$reviewlink = isset($reviewCount) ? $prodUrl."#reviews" : '';
if(!empty($ratingSummary))
$ratingText = ":Rating";
else
$ratingText = "";
if($qty > 0)
$html .= '<li class="item product product-item">
<div class="product-item-info" data-container="product-grid">
<a href="'.$prodUrl.'" class="product photo product-item-photo" tabindex="-1">
<span class="product-image-container" style="width:240px;">
<span class="product-image-wrapper" style="padding-bottom: 125%;">
<img class="product-image-photo" src="'.$imageUrl.'" width="240" height="300" alt="Tye Missa Euge Bone CD"></span>
</span>
</a>
<div class="product details product-item-details">
<div class="product-reviews-summary short">
<div class="rating-summary">
<span class="label"><span>'.$ratingText.'</span></span>
'.$ratingSummary.'
</div>
<div class="reviews-actions">
<a class="action view" href="'.$reviewlink.'">'.$reviewCount.'</a>
</div>
</div>
<strong class="product name product-item-name">
<a class="product-item-link" href="'.$prodUrl.'">
'.$product_title.'</a>
</strong>
<div class="price-box price-final_price" data-role="priceBox" data-product-id="5641">
<span class="price-container price-final_price tax weee">
<span id="product-price-'.$productId.' data-price-amount='.$price.' data-price-type="finalPrice" class="price-wrapper ">
<span class="price">'.$price.'</span> </span>
</span>
</div>
<form action="'.$getBaseUrl.'vendor/index/Productadd/" method="post">
<input type="hidden" name="productId" value='.$productId.'>
<button type="submit" title="Add to Basket" class="action tocart primary">
<span>Add to Cart</span>
</button>
</form>
</div>
</div>
</li>';
$i++;
$html .= '</ol> </div>';
echo $html;
From above code I am getting the HTML as response, then I am attaching the content to the div.
The above code works fine for all simple products,but my question here is How to load the html for configurable products over here.
Where all color and size attributes should show with price changing when selection is made.
Can anyone help me to achieve this functionality please. Thanks!!
magento2 configurable-product product-collection product-list
magento2 configurable-product product-collection product-list
edited Jul 16 at 11:19
Manjunath
asked Jul 15 at 7:04
ManjunathManjunath
656 bronze badges
656 bronze badges
You can use product layout, load that block set your product and call toHtml and pass that data into your ajax response. But in that you need to some customization for your JS file which changes the swatches and prices, you need to add them on your layout file
– Ashish Ranade
Jul 17 at 3:40
@AshishRanade, can u please update me code for that.
– Manjunath
Jul 17 at 5:51
add a comment |
You can use product layout, load that block set your product and call toHtml and pass that data into your ajax response. But in that you need to some customization for your JS file which changes the swatches and prices, you need to add them on your layout file
– Ashish Ranade
Jul 17 at 3:40
@AshishRanade, can u please update me code for that.
– Manjunath
Jul 17 at 5:51
You can use product layout, load that block set your product and call toHtml and pass that data into your ajax response. But in that you need to some customization for your JS file which changes the swatches and prices, you need to add them on your layout file
– Ashish Ranade
Jul 17 at 3:40
You can use product layout, load that block set your product and call toHtml and pass that data into your ajax response. But in that you need to some customization for your JS file which changes the swatches and prices, you need to add them on your layout file
– Ashish Ranade
Jul 17 at 3:40
@AshishRanade, can u please update me code for that.
– Manjunath
Jul 17 at 5:51
@AshishRanade, can u please update me code for that.
– Manjunath
Jul 17 at 5:51
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282058%2flist-product-collection-into-template-file-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282058%2flist-product-collection-into-template-file-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can use product layout, load that block set your product and call toHtml and pass that data into your ajax response. But in that you need to some customization for your JS file which changes the swatches and prices, you need to add them on your layout file
– Ashish Ranade
Jul 17 at 3:40
@AshishRanade, can u please update me code for that.
– Manjunath
Jul 17 at 5:51