// BugFix assign var carrier_list on dmin product
This commit is contained in:
1 parent
3c1fa76032
commit
3bfd9ad4ca
1 file changed
+34
-1
@@ -1182,6 +1182,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$this->copyFromPost($object, $this->table);
|
$this->copyFromPost($object, $this->table);
|
||||||
if ($object->update())
|
if ($object->update())
|
||||||
{
|
{
|
||||||
|
$this->addCarriers();
|
||||||
if ($id_reason = (int)Tools::getValue('id_mvt_reason') && Tools::getValue('mvt_quantity') > 0 && $id_reason > 0)
|
if ($id_reason = (int)Tools::getValue('id_mvt_reason') && Tools::getValue('mvt_quantity') > 0 && $id_reason > 0)
|
||||||
{
|
{
|
||||||
if (!$object->addStockMvt(Tools::getValue('mvt_quantity'), $id_reason, null, null, $this->context->employee->id))
|
if (!$object->addStockMvt(Tools::getValue('mvt_quantity'), $id_reason, null, null, $this->context->employee->id))
|
||||||
@@ -1245,6 +1246,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$this->copyFromPost($object, $this->table);
|
$this->copyFromPost($object, $this->table);
|
||||||
if ($object->add())
|
if ($object->add())
|
||||||
{
|
{
|
||||||
|
$this->addCarriers();
|
||||||
$this->updateAssoShop((int)$object->id);
|
$this->updateAssoShop((int)$object->id);
|
||||||
$this->updateAccessories($object);
|
$this->updateAccessories($object);
|
||||||
if (!$this->updatePackItems($object))
|
if (!$this->updatePackItems($object))
|
||||||
@@ -2473,6 +2475,8 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$data->assign('feature_shop_active', Shop::isFeatureActive());
|
$data->assign('feature_shop_active', Shop::isFeatureActive());
|
||||||
// @todo : uses the helperform
|
// @todo : uses the helperform
|
||||||
$data->assign('displayAssoShop', $this->displayAssoShop());
|
$data->assign('displayAssoShop', $this->displayAssoShop());
|
||||||
|
$data->assign('carrier_list', $this->getCarrierList());
|
||||||
|
|
||||||
|
|
||||||
$product_props = array();
|
$product_props = array();
|
||||||
// global informations
|
// global informations
|
||||||
@@ -2752,7 +2756,36 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$this->tpl_form_vars['product'] = $product;
|
$this->tpl_form_vars['product'] = $product;
|
||||||
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
|
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getCarrierList()
|
||||||
|
{
|
||||||
|
$carrier_list = Carrier::getCarriers($this->context->language->id);
|
||||||
|
if ($product = $this->loadObject(true))
|
||||||
|
{
|
||||||
|
$carrier_selected_list = $product->getCarriers();
|
||||||
|
foreach ($carrier_list as &$carrier)
|
||||||
|
foreach ($carrier_selected_list as $carrier_selected)
|
||||||
|
if ($carrier_selected['id_reference'] == $carrier['id_reference'])
|
||||||
|
{
|
||||||
|
$carrier['selected'] = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $carrier_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addCarriers()
|
||||||
|
{
|
||||||
|
if (Tools::getValue('carriers'))
|
||||||
|
{
|
||||||
|
if (Validate::isLoadedObject($product = new Product((int)(Tools::getValue('id_product')))))
|
||||||
|
{
|
||||||
|
if (Tools::getValue('carriers'))
|
||||||
|
$product->setCarriers(Tools::getValue('carriers'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function initFormImages($obj, $token = null)
|
public function initFormImages($obj, $token = null)
|
||||||
{
|
{
|
||||||
$this->addJs('admin-dnd');
|
$this->addJs('admin-dnd');
|
||||||
|
|||||||
Reference in new issue
Block a user