Bilal Malik
- Feb 8, 2020
- 1 min
How To Enable/Disable JS/CSS Minification/Merge In Production Mode – Magento 2
In production mode developer option are not available in Admin -> Store -> Configuration -> Advanced. We can use the below Magento commands to enable/disable the JS/CSS minify/merge Enable JS merge:
php bin/magento config:set dev/js/merge_files 1 Enable JS Bundling:
php bin/magento config:set dev/js/enable_js_bundling 1 Enable JS minify:
php bin/magento config:set dev/js/minify_files 1 Enable CSS merge:
php bin/magento config:set dev/css/merge_css_files 1 Enable CSS minif
403 views0 comments
Bilal Malik
- Feb 8, 2020
- 2 min
Deployment modes – Magento 2
There are three deployment mode is available in Magento 2. Default Developer Production How to check which mode is enabled? We check the currently enabled mode by running the below Magento command. php bin/magento deploy:mode:show Default Mode It is a Magento default mode, once we switched from default mode to other modes, we can’t come back to default mode again by command line. Developer Mode Better choice for development work Exception is visible in the browser XML files a
14 views0 comments
Bilal Malik
- Sep 28, 2019
- 1 min
What is the difference between frontname and id in routes.xml
We many see routes.xml file with the same name of frontname and id. what if it is both different? <?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route frontName="hello" id="world">
<module name="Bilal_HelloWorld"/>
</route>
</router>
</config> frontname is used in URL construction e.g) http://domain/hello/i
24 views0 comments
Bilal Malik
- Feb 19, 2019
- 1 min
Change product image placeholder based on product – Magento 2
We need to override the below two functions in vendor/magento/module-catalog/Helper/Image.php Below function change the placeholder image in the home page, category page, product page. public function getPlaceholder($placeholder = null)
{
$product = $this->getProduct();
if($product->getName() == "Test Name") // here your condition
{
// logic to retrieve new url
return $new_palceholder_url;
}
...............//remining magento core codes
} Below function change
0 views0 comments
Bilal Malik
- Oct 2, 2018
- 1 min
Available options while creating product attribute programmatically in Magento 2
These are the available options while creating product attribute programmatically in Magento 2. All of the attributes are self-explanatory so I’m not going to explain briefly. If you have any doubts on how to use, please feel free to ask in the comment section. 1) global
2) visible
3) searchable
4) filterable
5) comparable
6) visible_on_front
7) html_allowed_on_front
8) used_for_price_rules
9) filterable_in_search
10) used_in_product_listing
11) used_for_sort_by
12
1 view0 comments
Bilal Malik
- Sep 10, 2017
- 1 min
Setup script execution time – Magento 2
Magento setup scripts are used to create/alter table and insert/update data into table while installing /upgrading module. Install prefix scripts are executed while running “php bin/magento setup:upgrade”. Upgrade prefix scripts are executed while running “php bin/magento setup:upgrade”, it additionaly check right version to execute the logic. I hope, it helps. #magento2 #setupscript #upgradedata
4 views0 comments
Bilal Malik
- Sep 9, 2017
- 2 min
Insert data while upgrading module (UpgradeData) – setup script – Magento 2
This is a continuation of the previous tutorial, It helps to insert data into the database while upgrading the module in Magento 2. As per our previous tutorials, we summarize the below points InstallSchema.php script executed while running “bin/magento setup:upgrade” , we use this features to create table structure Create CRUD object using Model, ResourceModel and Collection for CRUD(Create Read Update Delete) operation Use above-created CRUD object to insert data into our c
4 views0 comments
Bilal Malik
- Aug 21, 2017
- 2 min
Upgrade schema while upgrade module (UpgradeSchema) – setup script – Magento 2
This is a continuation of the previous tutorial, It helps to alter table into the database while installing the module in Magento 2. As per our previous tutorials, we summarize the below points InstallSchema.php script executed while running “bin/magento setup:upgrade” , we use this features to create table structure Create CRUD object using Model, ResourceModel and Collection for CRUD(Create Read Update Delete) operation Use above-created CRUD object to insert data into our
5 views0 comments
Bilal Malik
- Aug 19, 2017
- 1 min
Insert data while instaling module (InstallData) – setup script – Magento 2
This is a continuation of the previous tutorial, It helps to insert data into the database while installing module in Magento 2. As per our previous tutorial, we summarize the below points InstallSchema.php script executed while running “bin/magento setup:upgrade” , we use this features to create table structure Create CRUD object using Model, ResourceModel and Collection for CRUD(Create Read Update Delete) operation Now we use the same CRUD object to insert data into our cus
4 views0 comments
Bilal Malik
- Aug 6, 2017
- 2 min
Create Read Update Delete (CRUD) – Magento 2
This tutorial is the continuation of create table tutorial, after creating table, we will create the Model for CRUD (Create Read Update Delete) operation. I will explain crud operation for the below table structure For CRUD operation you need to create three things. 1. Model In Model you need to initialize resource model app/code/Bilal/Cruddemo/Model/Cruddemo.php <?php
namespace Bilal\Cruddemo\Model;
use Magento\Framework\Model\AbstractModel;
class Cruddemo extends AbstractMo
71 views0 comments
Bilal Malik
- Aug 6, 2017
- 2 min
Create Tabel In Magento 2
Prerequisite for follow this tutorial [optional] I already created a boilerplate module, which makes easy to follow this tutorial. It is optional, you can follow with your own module too. Download module repository from bitbucket Extract downloaded folder Copy Bilal folder into your <magento-root>/app/code/ After run the below commands to enable module $ php bin/magento module:enable Bilal_Cruddemo
$ php bin/magento setup:upgrade Once you’ve run the above, you should be able
3 views0 comments
Bilal Malik
- Jul 19, 2017
- 1 min
Requirejs Magento 2
In this article, we will take a tour about how to use requirejs in Magento 2 with simple examples. What is requirejs? In Magento 2, almost all the javascript files are loaded by requirejs concept (lazy load). For example below snippet first load jquery then execute your code. requirejs(['jquery'], function(jQuery){
// Your code here
}); Prerequisite for follow this tutorial [optional] I already created a boilerplate module, which makes easy to follow this tutorial. It is op
5 views0 comments
Bilal Malik
- Jun 21, 2017
- 2 min
Configure Xdebug In Sublime Text Editor For Magento Project
This article describe the step by step process of configure xdebug in sublime text editor for magento project. 1. Install Sublime Text Editor If you already have sublime text editor please skip this step For Sublime-Text-2: sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text For Sublime-Text-3: sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer 2. Insta
16 views0 comments
{"items":["5eefa551748f780017bdcc24","5eefa55256e41900171eb8d4","5eefa5523cdd9b0017daf960","5eefa5522b969600179725f1","5eefa55226ccfe001775a146","5eefa5644796cc001726be16","5eefa564380ee90017f22ffa","5eefa565ba462300172aa1fc","5eefa565d960fa0018a009c2","5eefa56659b10d00171f0f80","5eefa566bb1b6600178c6d98","5eefa5674c1dda0018a027ef","5eefa5676f00400017a118c6","5eefa567ab02b100170fd587","5eefa5683cdd9b0017daf977","5eefa56826ccfe001775a160"],"styles":{"galleryType":"Columns","groupSize":1,"showArrows":true,"cubeImages":true,"cubeType":"fill","cubeRatio":1.3333333333333333,"isVertical":true,"gallerySize":30,"collageAmount":0,"collageDensity":0,"groupTypes":"1","oneRow":false,"imageMargin":32,"galleryMargin":0,"scatter":0,"rotatingScatter":"","chooseBestGroup":true,"smartCrop":false,"hasThumbnails":false,"enableScroll":true,"isGrid":true,"isSlider":false,"isColumns":false,"isSlideshow":false,"cropOnlyFill":false,"fixedColumns":1,"enableInfiniteScroll":true,"isRTL":false,"minItemSize":50,"rotatingGroupTypes":"","rotatingCropRatios":"","columnWidths":"","gallerySliderImageRatio":1.7777777777777777,"numberOfImagesPerRow":1,"numberOfImagesPerCol":1,"groupsPerStrip":0,"borderRadius":0,"boxShadow":0,"gridStyle":1,"mobilePanorama":false,"placeGroupsLtr":true,"viewMode":"preview","thumbnailSpacings":4,"galleryThumbnailsAlignment":"bottom","isMasonry":false,"isAutoSlideshow":false,"slideshowLoop":false,"autoSlideshowInterval":4,"bottomInfoHeight":0,"titlePlacement":"SHOW_ON_THE_RIGHT","galleryTextAlign":"center","scrollSnap":false,"itemClick":"nothing","fullscreen":true,"videoPlay":"hover","scrollAnimation":"NO_EFFECT","slideAnimation":"SCROLL","scrollDirection":0,"scrollDuration":400,"overlayAnimation":"FADE_IN","arrowsPosition":0,"arrowsSize":23,"watermarkOpacity":40,"watermarkSize":40,"useWatermark":true,"watermarkDock":{"top":"auto","left":"auto","right":0,"bottom":0,"transform":"translate3d(0,0,0)"},"loadMoreAmount":"all","defaultShowInfoExpand":1,"allowLinkExpand":true,"expandInfoPosition":0,"allowFullscreenExpand":true,"fullscreenLoop":false,"galleryAlignExpand":"left","addToCartBorderWidth":1,"addToCartButtonText":"","slideshowInfoSize":200,"playButtonForAutoSlideShow":false,"allowSlideshowCounter":false,"hoveringBehaviour":"NEVER_SHOW","thumbnailSize":120,"magicLayoutSeed":1,"imageHoverAnimation":"NO_EFFECT","imagePlacementAnimation":"NO_EFFECT","calculateTextBoxWidthMode":"PERCENT","textBoxHeight":0,"textBoxWidth":200,"textBoxWidthPercent":50,"textImageSpace":10,"textBoxBorderRadius":0,"textBoxBorderWidth":0,"loadMoreButtonText":"","loadMoreButtonBorderWidth":1,"loadMoreButtonBorderRadius":0,"imageInfoType":"ATTACHED_BACKGROUND","itemBorderWidth":1,"itemBorderRadius":0,"itemEnableShadow":false,"itemShadowBlur":20,"itemShadowDirection":135,"itemShadowSize":10,"imageLoadingMode":"BLUR","expandAnimation":"NO_EFFECT","imageQuality":90,"usmToggle":false,"usm_a":0,"usm_r":0,"usm_t":0,"videoSound":false,"videoSpeed":"1","videoLoop":true,"jsonStyleParams":"","gallerySizeType":"px","gallerySizePx":940,"allowTitle":true,"allowContextMenu":true,"textsHorizontalPadding":-30,"itemBorderColor":{"themeName":"color_12","value":"rgba(191,191,191,1)"},"showVideoPlayButton":true,"galleryLayout":2,"targetItemSize":940,"selectedLayout":"2|bottom|1|fill|true|0|true","layoutsVersion":2,"selectedLayoutV2":2,"isSlideshowFont":false,"externalInfoHeight":0,"externalInfoWidth":0.5},"container":{"width":940,"galleryWidth":972,"galleryHeight":0,"scrollBase":0,"height":null}}