Added product's brand selection in the general tab.
This commit is contained in:
@@ -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())
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -71,6 +71,25 @@
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='brand_id'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
|
||||
{admin_form_field_label form=$form name='brand_id'}
|
||||
|
||||
<select id="{$label_attr.for}" {if $required}aria-required="true" required{/if} name="{$name}" class="form-control">
|
||||
<option value="0">{intl l="No brand"}</option>
|
||||
|
||||
{loop name="brand-list" type="brand" visible="*"}
|
||||
<option value="{$ID}" {if $BRAND_ID == $ID}selected="selected"{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
|
||||
{if ! empty($label_attr.help)}
|
||||
<span class="help-block">{$label_attr.help}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='visible'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l='Visibility'}</label>
|
||||
|
||||
Reference in New Issue
Block a user