Everything is a ToDo list.

Hi Everyone! Today’s topic might not be clear from the heading, so let me make it clear over here. This post is a bit different so brace your self to think a bit. In the field of programming, it is very important to understand the fundamentals and core concepts of programming. This field requires you to think differently. Most people find coding quite tough and the reason being the way they think about web-applications. Anyone can learn the syntax of a computer language, and print ‘Hello World’. ...

December 12, 2018 · 2 min · Harshvardhan Malpani

JavaScript debugging dev tools.

Errors can and will happen every time you write some new computer code. Programming code might contain syntax errors or logical errors. Many of these errors are difficult to diagnose. Often, when programming code contains errors, nothing will happen. There are no error messages, and you will get no indications where to search for errors. Searching for (and fixing) errors in programming code is called code debugging. And believe me, that’s not easy but the most valuable skill a developer could have. ...

December 4, 2018 · 2 min · Harshvardhan Malpani

How to remove links of a learndash course which has not started yet? without code changes

jQuery(document).ready(function($){ var nost=0; if($("body").hasClass("single-sfwd-courses")){ toba=''; $("#lessons_list a.notavailable").removeAttr("href"); $("#lessons_list a.notavailable").each(function(){ toba=$(this).parent().parent().attr("class"); toba = toba.replace("lesson post-",''); toba = toba.replace(" is_not_sample no-topics",''); toba = toba.replace(" is_not_sample has-topics",''); $('#learndash_topic_dots-'+toba+" a").removeAttr("href"); }); } });

August 9, 2018 · 1 min · Harshvardhan Malpani

Magento 2 how to show configurable options stock availability on product page

addtocart.phtml <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ // @codingStandardsIgnoreFile /** @var $block \Magento\Catalog\Block\Product\View */ ?> <?php $_product = $block->getProduct(); ?> <?php $buttonTitle = __('Add to Cart'); ?> <?php if ($_product->isSaleable()): ?> <div class="box-tocart"> <div class="fieldset"> <?php if ($block->shouldRenderQuantity()): $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $StockState = $objectManager->get('\Magento\CatalogInventory\Api\StockStateInterface');?> <div class="field qty"> <label class="label" for="qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></label> <div class="control"> <?php if($_product->getTypeId()=="simple") { ?> <select class="input-text qty" name="qty" id="qty" data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"> <?php $availableQty= $StockState->getStockQty($_product->getId(), $_product->getStore()->getWebsiteId()); for($repli=1;$repli<=$availableQty;$repli++) echo "<option value='$repli'>$repli</option>"; ?> </select> <?php } else { $usedProducts = $_product->getTypeInstance()->getUsedProducts($_product); $productStockd=$objectManager->get('Magento\CatalogInventory\Api\StockRegistryInterface'); $finalconfigqty=[]; foreach ($usedProducts as $child) {$childid=$child->getId(); $productStockObj = $productStockd->getStockItem($childid); $availableQty= round($productStockObj->getData('qty')); $finalconfigqty['c'.$childid]=$availableQty; } echo '<script> var fichoo='. json_encode($finalconfigqty). '</script>'; echo '<select class="input-text qty fichoo" name="qty" id="qty"><option value=1>1</option></select>'; ?> <!--input type="number" name="qty" id="qty" value="<?= $block->getProductDefaultQty() * 1 ?>" title="<?= __('Qty') ?>" class="input-text qty" data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" /--> <?php } ?> </div> </div> <?php endif; ?> <div class="actions"> <button type="submit" title="<?= /* @escapeNotVerified */ $buttonTitle ?>" class="action primary tocart" id="product-addtocart-button"> <span><?= /* @escapeNotVerified */ $buttonTitle ?></span> </button> <?= $block->getChildHtml('', true) ?> </div> </div> </div> <?php endif; ?> <?php if ($block->isRedirectToCartEnabled()) : ?> <script type="text/x-magento-init"> { "#product_addtocart_form": { "Magento_Catalog/product/view/validation": { "radioCheckboxClosest": ".nested" } } } </script> <?php else : ?> <script type="text/x-magento-init"> { "#product_addtocart_form": { "Magento_Catalog/js/validate-product": {} } } </script> <?php endif; ?> Another important file is Magento_ConfigurableProduct/web/js/configurable.js ...

February 16, 2018 · 9 min · Harshvardhan Malpani

How to manage Magento 2 product attribute values options using console

This is an update to my previous script which was used to add custom product attribute values using backend – Add values to product attribute Read the previous^ part to get introduction about how it works. you will have to use browser console (ctrl + shift +j in Google chrome) First of all initialize the array mimim with the final set of values you want to see in backend. The script then automatically removes the extra options first(values which are not in mimim but in present in backend), then it adds the remaining values from mimim (which are in mimim but not at backend) ...

November 22, 2017 · 1 min · Harshvardhan Malpani

Magento 2.1x – Add options in custom product attribute using backend

Go to the attribute edit page using magento 2 admin panel (Stores > Attributes > Product > Edit attribute) Use console – ctrl + shift + J Edit the js array mimim and then paste the following code in console. $jq=new jQuery.noConflict(); var mimim=["Black","Blue","Blue Black"]; $jq.each(mimim,function(a,b){ $jq("#add_new_option_button").click(); $jq("#manage-options-panel tbody tr:last-child td:nth-child(3) input").val(b); });

October 14, 2017 · 1 min · Harshvardhan Malpani

How to unlike all Facebook pages from your profile and Clean your newsfeed

Hello humans, I have tried to keep this tutorial simple and detailed. Please proceed with caution. The following tutorial and the procedure will unlike pages you have liked from your profile, Please be clear about that the fact that the code provided here is clean and does not intend to do any harm to your Facebook account. Note – This code uses jQuery library in its original form. So you do not need to be scared while using this “scary” looking code. ...

May 18, 2017 · 3 min · Harshvardhan Malpani