addElement('hidden', 'productId'); $this->addElement( 'numeric', 'quantity', ['label' => 'Quantity:', 'required' => true, 'precision' => 0] ); $this->getElement('quantity')->addValidator('Int'); $greaterThan = new Zend_Validate_GreaterThan(0); $greaterThan->setMessage( 'Quantity must be greater than zero', Zend_Validate_GreaterThan::NOT_GREATER ); $this->getElement('quantity')->addValidator($greaterThan, false); return $this; } protected function _initButtons() { $this->addElement( 'submit', 'btnSubmit', [ 'label' => 'Add To Cart', 'attribs' => ['class' => 'btn btn-primary'], ] ); return $this; } }