protected function setStatusStore($status)
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');

        if (!isset($id) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = false;

        if (isset($id)) {

            if (!is_numeric($id)) {
                $this->errorAndExit($this->text('Invalid argument'));
            }

            $result = $this->store->update($id, array('status' => $status));

        } else if (!empty($all)) {

            $updated = $count = 0;
            foreach ((array) $this->store->getList() as $store) {
                $count++;
                $updated += (int) $this->store->update($store['store_id'], array('status' => $status));
            }

            $result = $count && $count == $updated;
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }
    }
protected function setStatusStore($status)
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');

        if (!isset($id) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = false;

        if (isset($id)) {

            if (!is_numeric($id)) {
                $this->errorAndExit($this->text('Invalid argument'));
            }

            $result = $this->store->update($id, array('status' => $status));

        } else if (!empty($all)) {

            $updated = $count = 0;
            foreach ((array) $this->store->getList() as $store) {
                $count++;
                $updated += (int) $this->store->update($store['store_id'], array('status' => $status));
            }

            $result = $count && $count == $updated;
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }
    }
protected function setStatusStore ( $ status ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( ! isset ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = false ; if ( isset ( $ id ) ) { if ( ! is_numeric ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ result = $ this -> store -> update ( $ id , array ( 'status' => $ status ) ) ; } else if ( ! empty ( $ all ) ) { $ updated = $ count = 0 ; foreach ( ( array ) $ this -> store -> getList ( ) as $ store ) { $ count ++ ; $ updated += ( int ) $ this -> store -> update ( $ store [ 'store_id' ] , array ( 'status' => $ status ) ) ; } $ result = $ count && $ count == $ updated ; } if ( empty ( $ result ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } }
Sets status for one or several stores
@param bool $status
Sets status for one or several stores