How to call a function on change of window.checkoutConfig data so that refresh the content of checkout page Magento 2

in my checkout page when promo code is applied, I am updating a text using some calculation using knockoutjs

So, I am using window.checkoutConfig data in my js for some calculation. the function works well when called from HTML, but it doesn’t run on itself when window.checkoutConfig data is changed.

Magento_Checkout/web/template/summary/item/details.html

 <span class="tag-text">     <!-- ko if: getFinalSale($  parent)-->       <u class="product-tag underline-bold-text checkout-final-sale" data-bind="text: getFinalSale($  parent)"></u>     <!-- /ko --> </span> 

I have written above code in details.html

and my js is

Magento_Checkout/web/js/view/summary/item/details.js

knockout js

  define([    'uiComponent',    'ko',    'Magento_Checkout/js/model/totals'     ], function (Component, ko, totals) {    'use strict';     var finalSaleData = window.checkoutConfig.items;      return Component.extend({      defaults: {          template: 'Magento_Checkout/summary/item/details'      },     quoteItemData: quoteItemData,     finalSaleData: finalSaleData,      /**      * @param {Object} quoteItem      * @return {String}      */      getItems: function(item_id) {         var itemElement = null;         _.each(this.finalSaleData, function(element, index) {             if (element.item_id == item_id) {                 itemElement = element;             }         });         return itemElement;     },     getFinalSale: function (quoteItem) {         var item = this.getItems(quoteItem.item_id);         var tagText = '';          if((((item.price*item.qty) - item.discount_amount)/(item.base_old_price*item.qty))< 0.5){             var tagText = 'Final Sale';         }else{             if(item.base_old_price && item.price){                 // && item.price < item.price && item.base_old_price / item.price <= 0.5){                 if(((item.base_old_price - item.price)/item.base_old_price)>0.5){                     var tagText = 'Final Sale';                 }             }         }         return tagText;     },      }); }); 

I am using var finalSaleData = window.checkoutConfig.items in my function getFinalSale.

How to make getFinalSale function run every time when window.checkoutConfig.items data is changed without refreshing the page.

The problem is, this runs only when the page reloads.

How to make getFinalSale function run every time the user applies promo code without refreshing the page so that my HTML gets updated too.

Basically Final Sale text needs to be shown on the basis of that logic in js code in getFinalSale function.

How to achieve that.

Magento2 Invalid Form Key. Please refresh the page while creating configurable product

While creating the configuration products in magento2.2.2 I am facing the “Invalid Form Key. Please refresh the page” error. I have google regarding this error and I have found the solution to increase the value of max_input_vars PHP configurable variable. I have increased this value but the problem is not solved.

While creating the configurable product almost 40000 associated product is generated and now I have set the max_input_vars value to 3075000 but the problem is not solved.

Anyone please help me to fix this issue.

resultado de consulta sem refresh JS

Aloha, quando o cliente entrar na minha aplicação ele vai ver um form pra agendamento, tem alguma forma de passar as informações sem dar refresh? quando o cliente selecionar o dia, mostra o horário de funcionamento, depois de escolher o horário, só mostrar os funcionários com a agenda disponível.

FORM:

<form method="post" action="<?php echo pg.'/arquivos/registra_agendamento.php';?>"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> <div class="row"> <div class="col-md-4 grid-margin stretch-card">  <div class="card">   <div class="card-body">      <div class="charts-data">         <div class="form-group">            <label>Data:</label>            <input type="date" class="form-control form-control-sm" name="dia" data-inputmask="'alias': 'date'" />         </div>         <div class="form-group">            <label>Hora: </label>            <select class="form-control form-control-sm" name="hora">               <option value=""></option>               <?php                  $  query_hora = "SELECT * FROM funcionamento ORDER BY hora ASC";                  $  result_hora = mysqli_query($  conectar, $  query_hora);                  while ($  linhas_hora = mysqli_fetch_assoc($  result_hora)){                    $  hora = $  linhas_hora['hora'];                    echo "                      <option value='".$  hora."'>".$  hora.":00</option>                    ";                  }                  ?>                                  </select>         </div>         <?php            if(o input dia == $  hoje){            $  query_agenda = "SELECT * FROM agendamento WHERE dia='o input dia' AND hora='$  hora'";             $  result_agenda = mysqli_query($  conectar, $  query_agenda);             while ($  linhas_agenda = mysqli_fetch_assoc($  result_agenda)){             $  agendado = $  linhas_agenda['func'];              $  query_fun = "SELECT * FROM funcionarios WHERE nome!='$  agendado' AND nivel='3' AND estado='1' AND atend='1' ORDER BY nome ASC";             $  result_fun = mysqli_query($  conectar, $  query_fun);             while ($  linhas_fun = mysqli_fetch_assoc($  result_fun)){             $  fun_nome = $  linhas_fun['nome'];             $  img_fun = pg.'/images/funcionarios/'.$  linhas_fun['img'].'.jpg';                echo "                  <div class='d-flex align-items-center py-3 border-bottom'>                    <img class='img-sm rounded-circle' src='".$  img_fun."' alt='".$  fun_nome."'>                    <div class='ml-3'>                      <h5 class='mb-1 font-weight-bold'>".$  fun_nome."</h5>                    </div>                  </div>                ";              }}            }else{            $  query_agenda = "SELECT * FROM agendamento WHERE dia='$  dia' AND hora='$  hora'";             $  result_agenda = mysqli_query($  conectar, $  query_agenda);             while ($  linhas_agenda = mysqli_fetch_assoc($  result_agenda)){             $  agendado = $  linhas_agenda['func'];              $  query_fun = "SELECT * FROM funcionarios WHERE nome!='$  agendado' AND nivel='3' AND estado='1' ORDER BY nome ASC";             $  result_fun = mysqli_query($  conectar, $  query_fun);             while ($  linhas_fun = mysqli_fetch_assoc($  result_fun)){             $  fun_nome = $  linhas_fun['nome'];             $  img_fun = pg.'/images/funcionarios/'.$  linhas_fun['img'].'.jpg';             echo "                  <div class='d-flex align-items-center py-3 border-bottom'>                    <img class='img-sm rounded-circle' src='".$  img_fun."' alt='".$  fun_nome."'>                    <div class='ml-3'>                      <h5 class='mb-1 font-weight-bold'>".$  fun_nome."</h5>                    </div>                  </div>                ";              }}            }            ?>         <div class="form-group">            <input type="text" class="form-control form-control-sm" id="obs" name="obs" placeholder="Obs">         </div>         <div class="card-footer text-center">            <button type='submit' class="btn btn-dark btn-rounded btn-fw">Agendar</button></a>         </div>      </div>   </div> </div> </div> </div> </div> </form> 

Resultado sem Refresh

Estou tentando criar uma forma de agendamento para o meu projeto, como ainda estou estudando o calendário passei a pensar em outra forma, mais simples. Como eu posso criar um form usando php e js(pequeno aprendiz) que retorne as datas e horários disponíveis?

Página que o cliente acessa:

<div class="col-md-4 grid-margin stretch-card"> <div class="card">   <div class="card-body">      <div class="charts-data">         <div class="form-group">            <label>Funcionario: </label>            <select class="form-control form-control-sm" name="barbeiro">               <option value=""></option>               <!--  LISTA TODOS OS FUNCIONARIOS DISPONIVEIS -->               <?php                  $  query_fun = "SELECT * FROM funcionarios WHERE nivel='3' AND estado='1' ORDER BY nome ASC";                  $  result_fun = mysqli_query($  conectar, $  query_fun);                  while ($  linhas_fun = mysqli_fetch_assoc($  result_fun)){                  $  fun = $  linhas_fun['nome'];                  echo "                    <option value='".$  fun."'>".$  fun."</option>                  ";                  }                  ?>               <option value="fun1">fun1</option>               <option value="fun2">fun2</option>            </select>         </div>         <div class="form-group">            <label>Data:</label>            <!-- APÓS SELECIONAR O FUNCIONARIO AQUI DEVERIA LISTAR OS DIAS QUE O MESMO TEM HORARIO DISPONIVEL -->            <input type="date" class="form-control form-control-sm" name="data" data-inputmask="'alias': 'date'" />         </div>         <div class="form-group">            <label>Hora: </label>            <!-- APÓS SELECIONAR O DIA AQUI DEVERIA LISTAR OS HORÁRIOS DISPONÍVEIS                DENTRO DO HORÁRIO DE FUNCIONAMENTO DA LOJA               EX: 08:00, 09:00 ... 19:00, 20:00 -->            <select class="form-control form-control-sm" name="hora">               <option value=""></option>               <?php                  echo "                    <option value='".$  horadisponivel ."'>".$  horadisponivel ."</option>                  ";                  ?>               <option value="17:00">17:00</option>               <option value="18:00">18:00</option>            </select>         </div>         <div class="form-group">            <input type="text" class="form-control form-control-sm" id="obs" name="obs" placeholder="Obs">         </div>         <div class="card-footer text-center">            <a href="registra_agendamento.php"><button class="btn btn-dark btn-rounded btn-fw">Agendar</button></a>         </div>      </div>   </div> </div> </div> 

Ubuntu Studio 19.04 keeps resetting refresh rate

The default refresh rate ubuntu seems to use causes flickering on my screen. But setting it to 50 makes everything work perfectly. The problem is it keeps resetting the refresh rate after waking from sleep or restarting. This is stock ubuntu studio with an AMD card.

I’ve heard of this happening from a bug in compiz, but dpkg -l does not show it installed.

“Undo Changes” & “Refresh”

In a desktop application, where users are pulling and sometimes updating values on a “datagridview” (DGV) that is data-bound to a database, how should a designer distinguish between “undo changes” and “refresh page”?

We currently use both and they have very similar behavior – erase any values in the DGV and re-pull from the database to display what is stored.

The original idea was to handle two different situations:

  1. “UNDO”: I made some changes. After double checking, my changes are wrong and I would like to revert to what is stored on the database. This button prompts the user if they are sure they want to undo their changes.
  2. “REFRESH:” Something was updated on the server that was not pushed/updated from my view, and I would like to pull the most current information. This button does not prompt the user if they are sure of their action.

Essentially, our “refresh” button is just an “undo” button, but without the confirmation prompt.

Some of our users are relatively tech-challenged, or speak English as a second language. Our current impression is that removing one of the buttons, or combining their text into an “UNDO/REFRESH” button, might cause some confusion.

how to call function django views.py without refresh page?

I write a model that user can follow/unfollow each other, but when the user tap on the button to follow or unfollow after the process, the page will be refreshed. I need a way to handle that action without refreshing page and change the text in this page.

my model :

class Follower(models.Model):  follower = models.ForeignKey(User, related_name='followings', on_delete=models.CASCADE) following = models.ForeignKey(User, related_name='followers', on_delete=models.CASCADE)  class Meta:     unique_together = ('follower', 'following')  def __str__(self):     return u'%s follows %s' % (self.follower, self.following) 

my view :

def follow(request, own_user_id , follow_state): """ follow function that add user who follow other user own : user that have channel page """ own = CustomUser.objects.get(pk=own_user_id)  if follow_state == "followed":     action = request.user.followings.get(following=own)     action.delete()     return redirect(f'http://127.0.0.1:8000/{own.channel_name}') else:     action = Follower.objects.create(follower=request.user, following=own)     action.save()     return redirect(f'http://127.0.0.1:8000/{own.channel_name}') 

my template :

{% if request.user == user_own %}                     <a href="{% url 'update-page' user.channel_name %}"> <button class="btn btn-light btn-flw">profile setting </button></a>                 {% else %}                        <a href="{% url 'follow-unfollow' user_own.id follow_state%}">                            <button class="btn btn-light btn-flw">{{follow_state}}</button>                          </a>                 {% endif %} 

How to return to the same location on the screen after a table refresh

I have an ASP.Net MVC application. A view is composed of two partial views, a filter view and a results view. The filter view is used to set the status of the result items and call the controller method to get the results.

The results view renders the search results as a table of single element rows, each containing another table representing the result item. On each row there is a drop down allowing the user to change the status of that particular item. Thus, the user can scroll through the result items and change the status of any number of them. The user can then click on a button to update the changed items status. Following that the query is executed again and results are refreshed.

What is required here is for the results table to automatically be scrolled to the last item viewed so the user does not have to scroll there manually.