diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index aafaa85b7..ae6849a34 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -130,6 +130,7 @@
+ diff --git a/core/lib/Thelia/Form/ShippingZone/ShippingZoneAddArea.php b/core/lib/Thelia/Form/ShippingZone/ShippingZoneAddArea.php new file mode 100644 index 000000000..81dd422b6 --- /dev/null +++ b/core/lib/Thelia/Form/ShippingZone/ShippingZoneAddArea.php @@ -0,0 +1,87 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Form\ShippingZone; + +use Thelia\Core\Translation\Translator; +use Symfony\Component\Validator\Constraints\GreaterThan; +use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Form\BaseForm; + + +/** + * Class ShippingZoneAddArea + * @package Thelia\Form\ShippingZone + * @author Manuel Raynaud + */ +class ShippingZoneAddArea extends BaseForm +{ + + /** + * + * in this function you add all the fields you need for your Form. + * Form this you have to call add method on $this->formBuilder attribute : + * + * $this->formBuilder->add("name", "text") + * ->add("email", "email", array( + * "attr" => array( + * "class" => "field" + * ), + * "label" => "email", + * "constraints" => array( + * new \Symfony\Component\Validator\Constraints\NotBlank() + * ) + * ) + * ) + * ->add('age', 'integer'); + * + * @return null + */ + protected function buildForm() + { + $this->formBuilder + ->add('area_id', 'integer', array( + 'constraints' => array( + new NotBlank(), + new GreaterThan(array('value' => 0)) + ), + 'label_attr' => array('for' => 'shipping_area'), + 'label' => Translator::getInstance()->trans('Area') + )) + ->add('shipping_zone_id', 'integer', array( + 'constraints' => array( + new NotBlank(), + new GreaterThan(array('value' => 0)) + ) + )) + ; + } + + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return 'thelia_shippingzone_area'; + } +} \ No newline at end of file diff --git a/templates/admin/default/shipping-zones-edit.html b/templates/admin/default/shipping-zones-edit.html index a36cbccd9..524c14d12 100644 --- a/templates/admin/default/shipping-zones-edit.html +++ b/templates/admin/default/shipping-zones-edit.html @@ -26,12 +26,22 @@
- + {form name="thelia.shopping_zone_area"} - + {form_hidden_fields form=$form} + {form_field form=$form field='success_url'} + {* the url the user is redirected to on login success *} + {/form_field} + + {form_field form=$form field='shipping_zone_id'} + + {/form_field} + + {form_field form=$form field='area_id'} +
- {loop name="area.module.not_associated" type="area" without_zone=$shipping_zones_id} {/loop} @@ -40,9 +50,9 @@
- + {/form_field} - + {/form}