How to Remove SID (SESSION_ID) from URL in Magento 2

First of all we have know about SID (SESSION_ID) in magento2:

The SID is a “session ID”. Magento uses this to track a user’s activity within the same Magento installation. Normally, Magento powers one website and one store from one installation (database).

Magento could power multiple websites with multiple stores from one installation though. The SID allows users to stay logged in while navigating across these websites/stores.

I think if you have the function enabled, the SID is sent when accessing catalog URLs so Magento can update the session with the user’s location/state for the current website/store.

If you’re not running a multi-website or multi-store environment, it’s safe to disable the SID on the frontend.

 

Below is the settings you need to change

Go to the Store > Configuration > General > Web > Session Validation Settings > Use SID on Storefront and set its value to No

 

How to get Magento low stock report

How to get Magento low stock report:

In magento admin panel Go to
System->Configuration->Inventoty->Product Stock Options

and set Notify for Quantity Below to the required value. Now when you generate low stock report all the products having the quantity below Notify for Quantity Below value wil be dispalyed.

How to hide Discount code in Magento 2

How to hide Discount code in Magento 2

Here is the info how you can get rid off Discount code from cart page and payment page. Add below css code and it will hide discount code from the pages.

For cart page :

.checkout-cart-index .cart-discount {display: none;}

For payment page :

.checkout-index-index .payment-option._collapsible.opc-payment-additional.discount-code {
display: none;
}

How to remove header links in Magento 2

How to remove header links in Magento 2

Please follow the below instructions :

Step 1 :- Go to app/design/frontend/VenderName/ThemeName/Magento_Theme/layout/default.xml

Step 2 :- Copy below Code

<referenceBlock name="wish-list-link" remove="true"/>
<referenceBlock name="catalog.compare.link" remove="true"/>

Step 3 :- Paste this code in default.xml before body tag () and save it.

It will remove the links from the header

How to remove compare link on Magento2 header

How to remove compare link on Magento2 header

To remove the compare link from the header in Magento 2, you can follow these steps: First, create a custom module if you haven’t already. Inside your module, create a di.xml file under app/code/[Vendor]/[Module]/etc/frontend/ and use the Magento\Catalog\Block\Product\Compare\Link block class to remove the compare link. You can achieve this by adding the following code to your di.xml file:

<type name="Magento\Catalog\Block\Product\Compare\Link">
<arguments>
<argument name="template" xsi:type="string">Magento_Catalog::empty.phtml</argument>
</arguments>
</type>
This code will effectively remove the compare link from the header by overriding its template with an empty file. After that, clear the Magento cache using the command php bin/magento cache:clean. This will ensure that the changes take effect, removing the compare link from your store’s header.

CSS Media Queries for iPads & iPhones

Sometimes we got very confusion while developing responsive work. When we apply the breakpoints for iPad and iPhone that does not works properly. As per my experience while searching on the Internet I found some useful information regarding the media queries. I applied those and that works fine for me. So today I am going to add the media queries here for the same.

iPad Media Queries

iPad Media Queries (All generations – including iPad mini)

 

iPad in portrait & landscape


@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) { /* STYLES GO HERE */}

iPad in landscape


@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) { /* STYLES GO HERE */}

iPad in portrait


@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) { /* STYLES GO HERE */ }

Retina iPad in landscape


@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 2) { /* STYLES GO HERE */}

Retina iPad in portrait


@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 2) { /* STYLES GO HERE */ }

iPad mini Media Queries

iPad mini in portrait & landscape


@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio: 1) { /* STYLES GO HERE */}

iPad mini in landscape


@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 1) { /* STYLES GO HERE */}

iPad mini in portrait


@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 1) { /* STYLES GO HERE */ }

iPad mini Resolution


Screen Width = 768px (CSS Pixels)
Screen Height = 1024px (CSS Pixels)

Screen Width = 768px (Actual Pixels)
Screen Height = 1024px (Actual Pixels)

Device-pixel-ratio: 1

iPhone Media Queries

iPhone 6 Media Queries

iPhone 6 in portrait & landscape


@media only screen
and (min-device-width : 375px)
and (max-device-width : 667px) { /* STYLES GO HERE */}

iPhone 6 in landscape


@media only screen
and (min-device-width : 375px)
and (max-device-width : 667px)
and (orientation : landscape) { /* STYLES GO HERE */}

iPhone 6 in portrait


@media only screen
and (min-device-width : 375px)
and (max-device-width : 667px)
and (orientation : portrait) { /* STYLES GO HERE */ }

How to Change Magento 2 Favicon

Today I will show you how you can change favicon on magento2 site. Follow the below steps :

1- go to Content -> Design -> Configuration
2- Click on HTML Head settings tab
3- Upload your favicon and save configuration.
4- Refresh the Cache

How to Add Google Translate in WordPress

Today I will show you how you can add google translator plugin on the wordpress site in easy steps. First of all you have install this plugin Google Language Translator

After activating the plugin go to Settings » Google Language Translator to configure the plugin.

Make sure that the plugin is activated. After that you need to select your website’s default language, and the languages you want to be available for translation. Once you are done simply save your plugin settings.

Now after then you have to use the widget code on the widget section to display the translator on the site (simply drag and drop).

If you want to do that custom then you need to copy the code as per below screenshot and paste in your template file.

Now you have done you website in multi language option….. Thanks!!

How to Export Magento Product Database

In this tutorial I will show you how you can export entire Magento product database.
Most people can find their way to the standard Export options under System -> Import/Export, but that often doesn’t produce the results they’re expecting. A better approach is to use the Dataflow – Profiles that Magento provides. These out-of-the-box export “profiles” take care of a lot of the configurations you will need to make if you use the standard Magento Export option. Depending on the data you wish to export there are options for customers, products and stock.
In this post, we are going to look specifically at the Export All Products option.

We are going to use Magento Data-Profiles to Export your entire product database:

1-Navigate to System -> Import/Export -> Data-Profiles

2- Select Export All Products:

3- Review your options in the Profile Wizard. You may wish to change the name of your export file under File Information -> File Name.

4. To define which product attributes you wish to export for each product, under Profile Wizard -> Data Format -> Export you can choose to export All Fields, or select specific product attributes you wish to export by selecting Only Mapped Fields and selecting your required attributes.

5. To define a specific range of products you wish to export under Profile Wizard -> Export Filters -> you can filter your products by name, sku, product type, attribute set, price, stock quantity, visibility or status. Save and Continue Edit, and we’re ready to export.

6. Now that the parameters for your export are set, choose the Run Profile tab and click the Run Profile in Popup button. Your export will start automatically in a pop up window.

7. Once your export is complete, you now need to retrieve it from your server via SFTP. If you are unsure of how to connect to your server, please contact your hosting provider or web support. We recommend Filezilla as a good FTP program you could use.

8. Once logged into ftp, you will find you exported csv file waiting for you inside the var/export folder. Download the file, and there you have it!

 

How to put Magento in Maintenance Mode only for Front end

In this tutorial we will show you how to put your Magento online store in maintenance mode only for front end site. The admin can access the site without any issue

To put a Magento site in maintenance mode, you need to create an empty maintenance.flag file and upload it to the root folder of your site.

When you will upload maintenance.flag file then your website will be down and will show the error message

Service temporarily unavailable.

So for this message will show for all types of users. Now we will come to point and restrict the above message only for front users. For this follow the below instructions :

You need to replace the below code in index.php file (keep in mind when you will upgrade the site site then you must revert this process).

if (file_exists($maintenanceFile)) {
include_once dirname(__FILE__) . ‘/errors/503.php’;
exit;
}

To this

if (file_exists($maintenanceFile) && strpos($_SERVER[‘REQUEST_URI’], ‘/admin/’) === false) {
include_once dirname(__FILE__) . ‘/errors/503.php’;
exit;
}

Please note the the code above is quick and dirty hack and I just check if /admin/ exists in url. If you have another url then you should replace with that.