Install a 4-wire inductive sensor instead of a 5-wire

We have to use 4-wire PNP inductive sensors, Because the previous 5-wire sensors are old and can not be ordered. These sensors restrict the movement of an slide gate. There is also a local switch to open and close the gate. By trial and error, we obtained the desired wiring for the sensors to operate in the PLC. Unfortunately, the local switch does not work with this wiring. I have a problem with this, because my field of study is mechanical engineering. I would be grateful if you could guide me.