public function cmdDeleteProductClass()
    {
        $id = $this->getParam(0);

        $result = null;

        if (isset($id)) {

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

            $result = $this->product_class->delete($id);

        } else if ($this->getParam('all')) {

            $deleted = $count = 0;
            foreach ($this->product_class->getList() as $item) {
                $count++;
                $deleted += (int) $this->product_class->delete($item['product_class_id']);
            }

            $result = $count && $count == $deleted;

        } else {
            $this->errorAndExit($this->text('Invalid command'));
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
public function cmdDeleteProductClass()
    {
        $id = $this->getParam(0);

        $result = null;

        if (isset($id)) {

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

            $result = $this->product_class->delete($id);

        } else if ($this->getParam('all')) {

            $deleted = $count = 0;
            foreach ($this->product_class->getList() as $item) {
                $count++;
                $deleted += (int) $this->product_class->delete($item['product_class_id']);
            }

            $result = $count && $count == $deleted;

        } else {
            $this->errorAndExit($this->text('Invalid command'));
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
public function cmdDeleteProductClass ( ) { $ id = $ this -> getParam ( 0 ) ; $ result = null ; if ( isset ( $ id ) ) { if ( empty ( $ id ) || ! is_numeric ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ result = $ this -> product_class -> delete ( $ id ) ; } else if ( $ this -> getParam ( 'all' ) ) { $ deleted = $ count = 0 ; foreach ( $ this -> product_class -> getList ( ) as $ item ) { $ count ++ ; $ deleted += ( int ) $ this -> product_class -> delete ( $ item [ 'product_class_id' ] ) ; } $ result = $ count && $ count == $ deleted ; } else { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( empty ( $ result ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> output ( ) ; }
Callback for "product-class-delete" command
Callback for product - class - delete command