How to jump/focus on the product that has been saved

Open to all! Ask other shopowners for help.
Post Reply
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

How to jump/focus on the product that has been saved

Post by tessthepup »

Not sure of the correct term 'jump' or 'focus' but is it possible that when saving a product after editing that the page can jump/focus/scroll to that product?

Just trying to save a bit of time when editing products and having to keep scrolling down the page to the next product to edit.


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: How to jump/focus on the product that has been saved

Post by ecartz »

Code: Select all

class hook_admin_catalog_scroll_to_active {

  public function listen_infoBox() {
   if (empty($GLOBALS['action']) || ('default' === $GLOBALS['action'])) {
     echo <<<'EOJS'
<script>
  document.getElementsByClassName('table-active')[0].scrollIntoView();
</script>
EOJS;
    }
  }

}
would probably mostly work.

https://stackoverflow.com/a/22292000/6660678
https://stackoverflow.com/q/21436550/6660678
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: How to jump/focus on the product that has been saved

Post by tessthepup »

@ecartz

It certainly did, thank you :D


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply