diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php index e90f6b463..fbf5303fa 100644 --- a/core/lib/Thelia/Core/Template/Loop/Product.php +++ b/core/lib/Thelia/Core/Template/Loop/Product.php @@ -460,6 +460,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL /** @var \Thelia\Core\Security\SecurityContext $securityContext */ $securityContext = $this->container->get('thelia.securityContext'); + /** @var \Thelia\Model\Product $product */ foreach ($loopResult->getResultDataCollection() as $product) { $loopResultRow = new LoopResultRow($product); @@ -510,7 +511,6 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL ->set("TAXED_PROMO_PRICE" , $taxedPromoPrice) ->set("IS_PROMO" , $product->getVirtualColumn('is_promo')) ->set("IS_NEW" , $product->getVirtualColumn('is_new')) - ; @@ -989,6 +989,12 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL return $loopResult; } + /** + * @param $loopResultRow + * @param \Thelia\Model\Product $product + * @param $default_category_id + * @return mixed + */ private function associateValues($loopResultRow, $product, $default_category_id) { $loopResultRow @@ -1010,7 +1016,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL ->set("TEMPLATE" , $product->getTemplateId()) ->set("DEFAULT_CATEGORY" , $default_category_id) ->set("TAX_RULE_ID" , $product->getTaxRuleId()) - + ->set("BRAND_ID" , $product->getBrandId()) ; diff --git a/core/lib/Thelia/Form/ProductModificationForm.php b/core/lib/Thelia/Form/ProductModificationForm.php index b3b362f8a..18f79c659 100644 --- a/core/lib/Thelia/Form/ProductModificationForm.php +++ b/core/lib/Thelia/Form/ProductModificationForm.php @@ -13,6 +13,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\GreaterThan; +use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; class ProductModificationForm extends ProductCreationForm @@ -33,6 +34,17 @@ class ProductModificationForm extends ProductCreationForm "label" => Translator::getInstance()->trans("Product template"), "label_attr" => array("for" => "product_template_field") )) + ->add("brand_id", "integer", [ + 'constraints' => [ new NotBlank() ], + 'required' => true, + 'label' => Translator::getInstance()->trans('Brand / Supplier'), + 'label_attr' => [ + 'for' => 'mode', + ], + 'attr' => [ + 'help' => Translator::getInstance()->trans("Select the product brand, or supplier."), + ] + ]) ; // Add standard description fields, excluding title and locale, which a re defined in parent class diff --git a/templates/backOffice/default/includes/product-general-tab.html b/templates/backOffice/default/includes/product-general-tab.html index eab5f1e44..6d26a9ed5 100644 --- a/templates/backOffice/default/includes/product-general-tab.html +++ b/templates/backOffice/default/includes/product-general-tab.html @@ -71,6 +71,25 @@ {/form_field} + {form_field form=$form field='brand_id'} +