public function initForm() { $form = new FormEngine\Elements\Form(array('name' => 'language', 'action' => '', 'method' => 'post')); $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA')))); $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'comment' => _('TXT_EXAMPLE') . ': en_EN', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\Unique(_('ERR_NAME_ALREADY_EXISTS'), 'language', 'name', null, array('column' => 'idlanguage', 'values' => (int) $this->registry->core->getParam())))))); $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'translation', 'label' => _('TXT_TRANSLATION'), 'comment' => _('TXT_EXAMPLE') . ': TXT_ENGLISH', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_TRANSLATION')))))); if ($this->registry->core->getParam() == '') { $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'copylanguage', 'label' => _('TXT_COPY_FROM_LANGUAGE'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('language')->getLanguageALLToSelect()), 'default' => 0))); } $requiredData->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'translations', 'label' => 'Plik z tłumaczeniem', 'file_source' => 'upload/', 'file_types' => array('xml')))); $currencies = App::getModel('currencieslist')->getCurrencyForSelect(); $currencyData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'currency_data', 'label' => _('TXT_CURRENCY_DATA')))); $currencyData->AddChild(new FormEngine\Elements\Select(array('name' => 'currencyid', 'label' => _('TXT_DEFAULT_LANGUAGE_CURRENCY'), 'options' => FormEngine\Option::Make($currencies)))); $flagPane = $form->addChild(new FormEngine\Elements\Fieldset(array('name' => 'flag_pane', 'label' => _('TXT_LANGUAGE_FLAG')))); $flagPane->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'flag', 'label' => _('TXT_LANGUAGE_FLAG'), 'file_source' => 'design/_images_common/icons/languages/', 'file_types' => array('png')))); $layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES')))); $layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'), 'default' => Helper::getViewIdsDefault()))); $Data = Event::dispatch($this, 'admin.language.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData)); if (!empty($Data)) { $form->Populate($Data); } $form->AddFilter(new FormEngine\Filters\NoCode()); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); return $form; }
public function initForm() { $set = App::getModel('attributegroup')->getSugestVariant((int) $this->registry->core->getParam()); $availablity = $this->registry->core->getDefaultValueToSelect() + App::getModel('availablity')->getAvailablityToSelect(); $form = new FormEngine\Elements\Form(array('name' => 'product', 'action' => '', 'method' => 'post')); $basicPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'basic_pane', 'label' => _('TXT_BASIC_INFORMATION')))); $basicLanguageData = $basicPane->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA')))); $seoname = $basicLanguageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_PRODUCT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PRODUCT_NAME')), new FormEngine\Rules\LanguageUnique(_('ERR_NAME_ALREADY_EXISTS'), 'producttranslation', 'name', null, array('column' => 'productid', 'values' => (int) $this->registry->core->getParam())))))); $basicLanguageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'seo', 'label' => _('TXT_PRODUCT_SEO'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PRODUCT_SEO')), new FormEngine\Rules\Format(_('ERR_ALPHANUMERIC_INVALID'), '/^[A-Za-z0-9-_\\",\'\\s]+$/'), new FormEngine\Rules\LanguageUnique('Wybierz inny adres URL, podany już istnieje', 'producttranslation', 'seo', null, array('column' => 'productid', 'values' => (int) $this->registry->core->getParam())))))); $basicPane->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'enable', 'label' => _('TXT_ENABLE_PRODUCT'), 'default' => '0'))); $basicPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'ean', 'label' => _('TXT_EAN')))); $basicPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'delivelercode', 'label' => _('TXT_DELIVELERCODE')))); $producerid = $basicPane->AddChild(new FormEngine\Elements\Select(array('name' => 'producerid', 'label' => _('TXT_PRODUCER'), 'addable' => true, 'onAdd' => 'xajax_AddProducer', 'add_item_prompt' => 'Podaj nazwę producenta', 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('producer')->getProducerToSelect())))); $basicPane->AddChild(new FormEngine\Elements\Select(array('name' => 'delivererid', 'label' => _('TXT_DELIVERER'), 'addable' => true, 'onAdd' => 'xajax_AddDeliverer', 'add_item_prompt' => 'Podaj nazwę dostawcy', 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('deliverer')->getDelivererToSelect())))); $metaData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'meta_data', 'label' => _('TXT_META_INFORMATION')))); $metaData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">W przypadku braku informacji META system wygeneruje je automatycznie. W każdej chwili możesz je zmienić edytując dane poniżej.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $languageData = $metaData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA')))); $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'keywordtitle', 'label' => _('TXT_KEYWORD_TITLE')))); $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyworddescription', 'label' => _('TXT_KEYWORD_DESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 1000', 'max_length' => 1000))); $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword', 'label' => _('TXT_KEYWORDS'), 'comment' => _('TXT_KEYWORDS_HELP')))); $stockPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'stock_pane', 'label' => _('TXT_SHIPPING_STOCK_SETTINGS')))); if ((int) $set > 0) { $stockPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p><strong style="color: red;">UWAGA:</strong>Ten produkt posiada warianty produktu. Jego stan magazynowy zostanie określony automatycznie na podstawie sumy stanów magazynowych wszystkich wariantów. Przejdź do zakładki Warianty produktu aby edytować stany.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $stockPane->AddChild(new FormEngine\Elements\Constant(array('name' => 'stock', 'label' => _('TXT_STOCK'), 'suffix' => _('TXT_QTY'), 'default' => 0))); $stockPane->AddChild(new FormEngine\Elements\Hidden(array('name' => 'stock', 'label' => _('TXT_STOCK'), 'default' => 0))); } else { $stockPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'stock', 'label' => _('TXT_STOCK'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STOCK')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'suffix' => _('TXT_QTY'), 'default' => 0))); } $stockPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Śledzenie stanu magazynowego spowoduje, że stan magazynowy będzie się zmieniał automatycznie w przypadku zamówień. Produkty z włączonym śledzeniem i ilością 0 nie będą mogły być zamówione przez klientów.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $stockPane->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'trackstock', 'label' => _('TXT_TRACKSTOCK')))); $disableatstockenabled = $stockPane->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'disableatstockenabled', 'label' => _('TXT_DISABLEATSTOCK_ENABLE'), 'default' => '0'))); $stockPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'disableatstock', 'label' => _('TXT_DISABLEATSTOCK'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $disableatstockenabled, new FormEngine\Conditions\Equals('1'))), 'default' => '0'))); $stockPane->AddChild(new FormEngine\Elements\Select(array('name' => 'availablityid', 'label' => _('TXT_AVAILABLITY'), 'options' => FormEngine\Option::Make($availablity)))); $categoryPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'category_pane', 'label' => _('TXT_CATEGORY')))); $categoryPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz kategorie w jakich ma pojawić się produkt. Kategoriami możesz zarządzać na stronie <a href="' . $this->registry->router->generate('admin', true, array('controller' => 'category')) . '" target="_blank">Katalog » Kategorie</a>.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $category = $categoryPane->AddChild(new FormEngine\Elements\Tree(array('name' => 'category', 'label' => _('TXT_CATEGORY'), 'choosable' => false, 'selectable' => true, 'sortable' => false, 'clickable' => false, 'items' => App::getModel('view')->getChildCategories(), 'load_children' => array(App::getModel('view'), 'getChildCategories')))); $pricePane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'price_pane', 'label' => _('TXT_PRICE')))); $vat = $pricePane->AddChild(new FormEngine\Elements\Select(array('name' => 'vatid', 'label' => _('TXT_VAT'), 'options' => FormEngine\Option::Make(App::getModel('vat')->getVATAll()), 'addable' => true, 'onAdd' => 'xajax_AddVat', 'add_item_prompt' => 'Podaj wartość stawki VAT'))); $currencies = App::getModel('currencieslist')->getCurrencyForSelect(); $sellcurrency = $pricePane->AddChild(new FormEngine\Elements\Select(array('name' => 'sellcurrencyid', 'label' => _('TXT_SELL_CURRENCY'), 'options' => FormEngine\Option::Make($currencies), 'default' => Session::getActiveShopCurrencyId()))); $buycurrency = $pricePane->AddChild(new FormEngine\Elements\Select(array('name' => 'buycurrencyid', 'label' => _('TXT_BUY_CURRENCY'), 'options' => FormEngine\Option::Make($currencies), 'default' => Session::getActiveShopCurrencyId()))); $pricePane->AddChild(new FormEngine\Elements\Price(array('name' => 'buyprice', 'label' => _('TXT_BUYPRICE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_BUYPRICE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'filters' => array(new FormEngine\Filters\CommaToDotChanger()), 'vat_field' => $vat))); $standardPrice = $pricePane->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'standard_price', 'label' => _('TXT_STANDARD_SELLPRICE'), 'class' => 'priceGroup'))); $price = $standardPrice->AddChild(new FormEngine\Elements\Price(array('name' => 'sellprice', 'label' => _('TXT_SELLPRICE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SELLPRICE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'vat_field' => $vat))); $enablePromotion = $standardPrice->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'promotion', 'label' => _('TXT_ENABLE_PROMOTION'), 'default' => '0'))); $standardPrice->AddChild(new FormEngine\Elements\Price(array('name' => 'discountprice', 'label' => _('TXT_DISCOUNTPRICE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SELLPRICE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'vat_field' => $vat, 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $enablePromotion, new FormEngine\Conditions\Equals(1)))))); $standardPrice->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionstart', 'label' => _('TXT_START_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $enablePromotion, new FormEngine\Conditions\Equals(1)))))); $standardPrice->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionend', 'label' => _('TXT_END_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $enablePromotion, new FormEngine\Conditions\Equals(1)))))); $pricePane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center"><strong>Ceny dla grup klientów</strong><br />Jeżeli chcesz aby dana grupa klientów posiadała inne ceny, uzupełnij wybrane sekcje poniżej.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $clientGroups = App::getModel('clientgroup/clientgroup')->getClientGroupAll(); foreach ($clientGroups as $clientGroup) { $group = $pricePane->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'field_' . $clientGroup['id'], 'label' => $clientGroup['name'], 'class' => 'priceGroup'))); $groups[$clientGroup['id']] = $group->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'groupid_' . $clientGroup['id'], 'label' => _('TXT_ENABLE_GROUP_PRICE'), 'default' => '0'))); $group->AddChild(new FormEngine\Elements\Price(array('name' => 'sellprice_' . $clientGroup['id'], 'label' => _('TXT_SELLPRICE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SELLPRICE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'vat_field' => $vat, 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $groups[$clientGroup['id']], new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals(1))))))); $promotion[$clientGroup['id']] = $group->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'promotion_' . $clientGroup['id'], 'label' => _('TXT_ENABLE_CLIENTGROUP_PROMOTION'), 'default' => '0'))); $group->AddChild(new FormEngine\Elements\Price(array('name' => 'discountprice_' . $clientGroup['id'], 'label' => _('TXT_DISCOUNTPRICE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SELLPRICE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'vat_field' => $vat, 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $promotion[$clientGroup['id']], new FormEngine\Conditions\Equals(1)))))); $group->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionstart_' . $clientGroup['id'], 'label' => _('TXT_START_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $promotion[$clientGroup['id']], new FormEngine\Conditions\Equals(1)))))); $group->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionend_' . $clientGroup['id'], 'label' => _('TXT_END_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $promotion[$clientGroup['id']], new FormEngine\Conditions\Equals(1)))))); } $weightPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'weight_pane', 'label' => _('TXT_WEIGHT_DATA')))); $weightPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'weight', 'label' => _('TXT_WEIGHT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_WEIGHT')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'suffix' => 'kg', 'filters' => array(new FormEngine\Filters\CommaToDotChanger()), 'default' => 0))); $weightPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'width', 'label' => _('TXT_WIDTH'), 'suffix' => 'cm', 'filters' => array(new FormEngine\Filters\CommaToDotChanger())))); $weightPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'height', 'label' => _('TXT_HEIGHT'), 'suffix' => 'cm', 'filters' => array(new FormEngine\Filters\CommaToDotChanger())))); $weightPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'deepth', 'label' => _('TXT_DEEPTH'), 'suffix' => 'cm', 'filters' => array(new FormEngine\Filters\CommaToDotChanger())))); $weightPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz miarę produktu w jakiej sprzedawany jest produkt. Jednostkami możesz zarządzać na stronie <a href="' . $this->registry->router->generate('admin', true, array('controller' => 'unitmeasure')) . '" target="_blank">Katalog » Jednostka miary</a>. Jeżeli chcesz tylko dodać nową opcję, użyj ikony dodawania obok listy wyboru.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $weightPane->AddChild(new FormEngine\Elements\Select(array('name' => 'unit', 'label' => _('TXT_UNIT_MEASURE'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('unitmeasure')->getUnitMeasureToSelect()), 'addable' => true, 'onAdd' => 'xajax_AddUnitMeasure', 'add_item_prompt' => 'Podaj nazwę jednostki miary', 'default' => 0))); $weightPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wpisz ilość sztuk w opakowaniu. Podczas dodawania produktu do koszyka ilość zostanie zaokrąglona do pełnych opakowań</p>'))); $weightPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'packagesize', 'label' => _('TXT_PACKAGE_SIZE'), 'comment' => _('TXT_PACKAGE_SIZE_HELP'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PACKAGE_SIZE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'filters' => array(new FormEngine\Filters\CommaToDotChanger()), 'default' => 1))); $descriptionPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'description_pane', 'label' => _('TXT_DESCRIPTION')))); $descriptionLanguageData = $descriptionPane->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA')))); $descriptionLanguageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'shortdescription', 'label' => _('TXT_SHORTDESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 1000', 'max_length' => 1000, 'rows' => 20))); $descriptionLanguageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'description', 'label' => _('TXT_DESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 5000', 'max_length' => 5000, 'rows' => 30))); $descriptionLanguageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'longdescription', 'label' => _('TXT_ADDITIONAL_INFO'), 'rows' => 30))); $photosPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'photos_pane', 'label' => _('TXT_PHOTOS')))); $photosPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz zdjęcia dla produktu z biblioteki lub wgraj je z dysku komputera. Zdjęcie oznaczone jako główne będzie wyświetlane w listach produktów oraz w karcie produktu jako pierwsze.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $photosPane->AddChild(new FormEngine\Elements\Image(array('name' => 'photo', 'label' => _('TXT_PHOTOS'), 'repeat_min' => 0, 'repeat_max' => FormEngine\FE::INFINITE, 'upload_url' => App::getURLAdressWithAdminPane() . 'files/add', 'main_id' => isset($this->populateData['photos_pane']['mainphotoid']) ? $this->populateData['photos_pane']['mainphotoid'] : ''))); $filePane = $form->addChild(new FormEngine\Elements\Fieldset(array('name' => 'files_pane', 'label' => _('TXT_FILES')))); $filePane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz pliki z biblioteki, które chcesz przypisać do tego produktu.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $filePane->AddChild(new FormEngine\Elements\Downloader(array('name' => 'file', 'label' => _('TXT_FILES'), 'repeat_min' => 0, 'repeat_max' => FormEngine\FE::INFINITE, 'upload_url' => App::getURLAdressWithAdminPane() . 'virtualproduct/add'))); $warrantyPane = $form->addChild(new FormEngine\Elements\Fieldset(array('name' => 'warranty_pane', 'label' => _('TXT_WARRANTY')))); $warrantyPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz pliki z biblioteki, które chcesz przypisać do tego produktu.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $warrantyPane->AddChild(new FormEngine\Elements\Downloader(array('name' => 'warranty', 'label' => _('TXT_WARRANTY'), 'repeat_min' => 0, 'repeat_max' => FormEngine\FE::INFINITE, 'upload_url' => App::getURLAdressWithAdminPane() . 'virtualproduct/add'))); $upsellProducts = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'upsell_products', 'label' => _('TXT_UPSELL')))); $upsellProducts->AddChild(new FormEngine\Elements\ProductSelectRelated(array('name' => 'upsell', 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE, 'exclude' => array((int) $this->registry->core->getParam())))); $similarProducts = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'similar_products', 'label' => _('TXT_SIMILAR_PRODUCT_LIST')))); $similarProducts->AddChild(new FormEngine\Elements\ProductSelectRelated(array('name' => 'similar', 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE, 'exclude' => array((int) $this->registry->core->getParam())))); $crosssellProducts = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'crosssell_products', 'label' => _('TXT_CROSSSELL')))); $crosssellProducts->AddChild(new FormEngine\Elements\ProductSelectRelated(array('name' => 'crosssell', 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE, 'exclude' => array((int) $this->registry->core->getParam())))); $statusProductPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'statusproduct_pane', 'label' => _('TXT_PRODUCT_STATUS')))); $statusProductPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Statusy produktów są używane do wyświetlania specjalnych oznaczeń na listach i kartach produktów.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $statusProductPane->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'productstatuses', 'label' => _('TXT_PRODUCT_STATUS'), 'addable' => true, 'onAdd' => 'xajax_AddProductStatus', 'add_item_prompt' => 'Podaj nazwę statusu', 'options' => FormEngine\Option::Make(App::getModel('productstatus')->getProductstatusAll(false))))); $idnew = $statusProductPane->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'newactive', 'label' => _('TXT_PRODUCT_IS_NEW')))); $newData = $statusProductPane->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'new_data', 'label' => _('TXT_NEW_DATA'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $idnew, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1'))))))); $newData->AddChild(new FormEngine\Elements\Date(array('name' => 'startnew', 'label' => _('TXT_START_DATE')))); $newData->AddChild(new FormEngine\Elements\Date(array('name' => 'endnew', 'label' => _('TXT_END_DATE')))); $groups = App::getModel('attributegroup/attributegroup')->getGroupsForCategory(0); if (!empty($groups)) { $variantsPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'variants_pane', 'label' => _('TXT_PRODUCT_VARIANTS')))); $variantsPane->AddChild(new FormEngine\Elements\ProductVariantsEditor(array('name' => 'variants', 'label' => _('TXT_PRODUCT_VARIANTS'), 'category' => $category, 'price' => $price, 'set' => $set, 'vat_field' => $vat, 'availablity' => $availablity, 'photos' => App::getModel('product')->productSelectedPhotos((int) $this->registry->core->getParam()), 'allow_generate' => App::getModel('order')->checkProductWithAttributes((int) $this->registry->core->getParam())))); } $Data = Event::dispatch($this, 'admin.product.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData)); if (!empty($Data)) { $form->Populate($Data); } $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); return $form; }