Jump to content

Force a page reload after frontend editing


Juergen
 Share

Recommended Posts

The new frontend editing feature in PW 3 is great, but if a value of field will be changed only the changed value will be visible on the frontend. All other texts will be the same.

It is often that other values depending on such a field should also change depending on the value of that field.

Example:

You have a select field where you can change the status of a product (available, sold out). If you change the status a hint text depending on the status should be displayed on the page or not.

F.e. Select sold out ->This product is sold out at the moment.

       Select available -> dont show a text

For now you have to refresh the page manually to show or hide the depending text on the page. This is often disturbing for customers. It would be great if I have the possiblity to refresh the page automatically if something was edited on the frontend and the save button was clicked.

Link to comment
Share on other sites

Don't have any experince with the new Frontendediting function in PW3 but you could go the ajax route to load content or force a page reload...

$(document).on("click", ".trigger_css_class", function(){
    location.reload(true);
});

just as example...hope this helps a little.

regards mr-fan

  • Like 1
Link to comment
Share on other sites

Quite good idea, but in this case it prevents the storage of the changed value because the reload enters before the new value will be stored.

$(document).on("click", ".ui-button", function(){
    location.reload(true);
});

ui-button is the button class of the save button in the modal window.

A timeout would be a possible solution, but I dont know how long it will take to store the value.

For the moment I have added a timeout for 1 second

$(document).on("click", ".ui-button", function(){
  setTimeout(function() {
    location.reload(true);
   }, 1000);
});

During the test it seems ok. Maybe there is a better solution.

  • Like 1
Link to comment
Share on other sites

For shure there is a better solution since i'm not that experienced ajax guy....but the simple jquery hacking a bit guy..;)

It should just taken as a hint in the right direction.

Maybe someone who is more into the details of the new frontendedit of PW3?

Best regards mr-fan

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...