_categoryId = $categoryId; } /** * @return null */ public function getCategoryId() { return $this->_categoryId; } protected function _initElements() { $categoriesObj = new App_ECommerce_Product_Category_Admin_Obj(array('primaryKey' => $this->getCategoryId())); $this->addElement('hidden', 'categoryId'); $dataObj = new App_ECommerce_Product_Admin_Obj(); $config = $dataObj->getConfig(); $this->addElement('text', 'sku', array( 'label' => 'SKU', 'required' => true, )); $element = $this->getElement('sku'); $element->addValidator($dataObj->getSkuValidator($this->_getData('id'), $this->_getData('sku'))); $this->addElement('text', 'title', array('label' => 'Title', 'required' => true)); $this->addElement('select', 'colorId', array( 'label' => 'Color', 'required' => true, 'multiOptions' => $categoriesObj->getColors4Select(), )); $this->addElement('select', 'shapeId', array( 'label' => 'Shape', 'required' => true, 'multiOptions' => $categoriesObj->getShapes4Select(), )); $this->addElement('select', 'sizeId', array( 'label' => 'Size', 'required' => true, 'multiOptions' => $categoriesObj->getSignSize4Select('*', 'productCategoryId = ' . $this->getCategoryId()), )); $this->addElement('checkbox', 'showAdditionalFields', array( 'label' => 'Show Additional Info fields', 'decoration' => 'simple' )); $this->addElement('text', 'additionalInfoLabel', array( 'label' => 'Additional Info label', 'description' => 'If the field is left empty, "(enter information)" label will be shown.' )); $this->addElement('checkbox', 'show', array('label' => 'Show on user end', 'decoration' => 'simple')); $this->addElement('checkbox', 'applyTax', array( 'label' => 'Apply tax to this product', 'decoration' => 'simple' )); $this->addElement('numeric', 'price', array('label' => 'Price ($)', 'negative' => false, 'required' => true)); $this->getElement('price')->addValidator('GreaterThan', false, array(0)); $this->getElement('price')->getValidator('GreaterThan')->setMessage( 'Price must be greater than zero', Zend_Validate_GreaterThan::NOT_GREATER ); $this->addElement('numeric', 'weight', array('label' => 'Weight (lbs)', 'negative' => false, 'required' => false)); $this->getElement('weight')->addValidator('GreaterThan', false, array(0)); $this->getElement('weight')->getValidator('GreaterThan')->setMessage( 'Weight must be greater than zero', Zend_Validate_GreaterThan::NOT_GREATER ); $this->addElement( 'extendedImage', 'image', array( 'label' => 'Image', 'resize' => $config->image->width . 'x' . $config->image->height . $config->image->resizeMethodAlias, ) ); return $this; } public function render(Zend_View_Interface $view = null) { $doc = $this->getDoc(); $doc->addScript('js/app/ECommerce/product/product-admin-form.js'); $doc->addInitObject('app.ProductForm', []); return parent::render($view); } }