change magento2 addtocart style

Go to

  • C:\xampp7\htdocs\m1\pub\static\frontend\Magento\luma\en_US\css\styles-m.css
  • change style using the class .tocart
  • then run the deploy static-content:deploy command

 

Advertisements

Yii2 set session active for 1 day

Go to root folder “\config\web.php” add the below code inside “‘components[]'” section.

‘session’ => [
‘class’ => ‘yii\web\Session’,
‘cookieParams’ => [‘lifetime’ => 1 * 24 *60 * 60]
],

yii tabs

Use this class “yii\bootstrap\Tabs” in the view file before using the tab

echo Tabs::widget([
‘items’ => [
[
‘label’ => ‘One’,
‘content’ => ‘Anim pariatur cliche…’,
‘active’ => true
],
[
‘label’ => ‘Two’,
‘content’ => ‘Anim pariatur cliche…’,
‘headerOptions’ => […],
‘options’ => [‘id’ => ‘myveryownID’],
],
[
‘label’ => ‘Example’,
‘url’ => ‘http://www.example.com’,
],
[
‘label’ => ‘Dropdown’,
‘items’ => [
[
‘label’ => ‘DropdownA’,
‘content’ => ‘DropdownA, Anim pariatur cliche…’,
],
[
‘label’ => ‘DropdownB’,
‘content’ => ‘DropdownB, Anim pariatur cliche…’,
],
[
‘label’ => ‘External Link’,
‘url’ => ‘http://www.example.com’,
],
],
],
],
]);

Check user idle time and destroy session in php

In document ready we need to call a setinterval function and inside that function check the variable with the timeout value and destroy the session.

Code :

var idleMax = 1;// Logout after 1 minutes of IDLE
var idleTime = 0;

function timerIncrement() {
idleTime = idleTime + 1;
if (idleTime > idleMax) {
alert(“session expired”);
location.href =”logout.php”;
}
}
$(document).ready(function ($) {

var idleInterval = setInterval(“timerIncrement()”, 60000);
$(this).mousemove(function (e) {
console.log(‘mousemove’);
idleTime = 0;
});
$(this).keypress(function (e) {
console.log(”);
idleTime = 0;
});

});