// Added number of features + norm
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12899 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -655,11 +655,8 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
|||||||
$query->where('a.id_attribute_group ='.(int)$item['id_attribute_group']);
|
$query->where('a.id_attribute_group ='.(int)$item['id_attribute_group']);
|
||||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
||||||
$item['count_values'] = (int)$res;
|
$item['count_values'] = (int)$res;
|
||||||
|
unset($query);
|
||||||
unset($res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,13 +205,13 @@ class AdminFeaturesControllerCore extends AdminController
|
|||||||
'href' => '#',
|
'href' => '#',
|
||||||
'desc' => $this->l('Save')
|
'desc' => $this->l('Save')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->toolbar_btn['save-and-stay'] = array(
|
$this->toolbar_btn['save-and-stay'] = array(
|
||||||
'short' => 'SaveAndStay',
|
'short' => 'SaveAndStay',
|
||||||
'href' => '#',
|
'href' => '#',
|
||||||
'desc' => $this->l('Save and stay'),
|
'desc' => $this->l('Save and stay'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Default cancel button - like old back link
|
// Default cancel button - like old back link
|
||||||
$back = Tools::safeOutput(Tools::getValue('back', ''));
|
$back = Tools::safeOutput(Tools::getValue('back', ''));
|
||||||
if (empty($back))
|
if (empty($back))
|
||||||
@@ -237,7 +237,7 @@ class AdminFeaturesControllerCore extends AdminController
|
|||||||
$this->table = 'feature_value';
|
$this->table = 'feature_value';
|
||||||
$this->className = 'FeatureValue';
|
$this->className = 'FeatureValue';
|
||||||
$this->identifier = 'id_feature_value';
|
$this->identifier = 'id_feature_value';
|
||||||
|
|
||||||
$this->fields_form[0]['form'] = array(
|
$this->fields_form[0]['form'] = array(
|
||||||
'legend' => array(
|
'legend' => array(
|
||||||
'title' => $this->l('Feature value'),
|
'title' => $this->l('Feature value'),
|
||||||
@@ -385,7 +385,7 @@ class AdminFeaturesControllerCore extends AdminController
|
|||||||
$this->table = 'feature_value';
|
$this->table = 'feature_value';
|
||||||
$this->className = 'FeatureValue';
|
$this->className = 'FeatureValue';
|
||||||
$this->identifier = 'id_feature_value';
|
$this->identifier = 'id_feature_value';
|
||||||
|
|
||||||
$id = (int)Tools::getValue('id_feature_value');
|
$id = (int)Tools::getValue('id_feature_value');
|
||||||
$feature_value = new FeatureValue($id);
|
$feature_value = new FeatureValue($id);
|
||||||
$feature_value->value = array();
|
$feature_value->value = array();
|
||||||
@@ -474,7 +474,7 @@ class AdminFeaturesControllerCore extends AdminController
|
|||||||
parent::postProcess();
|
parent::postProcess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override processAdd to change SaveAndStay button action
|
* Override processAdd to change SaveAndStay button action
|
||||||
* @see classes/AdminControllerCore::processAdd()
|
* @see classes/AdminControllerCore::processAdd()
|
||||||
@@ -482,11 +482,11 @@ class AdminFeaturesControllerCore extends AdminController
|
|||||||
public function processAdd($token)
|
public function processAdd($token)
|
||||||
{
|
{
|
||||||
parent::processAdd($token);
|
parent::processAdd($token);
|
||||||
|
|
||||||
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors))
|
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors))
|
||||||
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$token;
|
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$token;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override processUpdate to change SaveAndStay button action
|
* Override processUpdate to change SaveAndStay button action
|
||||||
* @see classes/AdminControllerCore::processUpdate()
|
* @see classes/AdminControllerCore::processUpdate()
|
||||||
@@ -494,11 +494,11 @@ class AdminFeaturesControllerCore extends AdminController
|
|||||||
public function processUpdate($token)
|
public function processUpdate($token)
|
||||||
{
|
{
|
||||||
parent::processUpdate($token);
|
parent::processUpdate($token);
|
||||||
|
|
||||||
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors))
|
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors))
|
||||||
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$token;
|
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$token;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the right method for creating or updating object
|
* Call the right method for creating or updating object
|
||||||
*
|
*
|
||||||
@@ -513,4 +513,31 @@ class AdminFeaturesControllerCore extends AdminController
|
|||||||
else
|
else
|
||||||
return $this->processUpdate($token);
|
return $this->processUpdate($token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdminController::getList() override
|
||||||
|
* @see AdminController::getList()
|
||||||
|
*/
|
||||||
|
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||||
|
{
|
||||||
|
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||||
|
|
||||||
|
if ($this->table == 'feature')
|
||||||
|
{
|
||||||
|
$nb_items = count($this->_list);
|
||||||
|
for ($i = 0; $i < $nb_items; ++$i)
|
||||||
|
{
|
||||||
|
$item = &$this->_list[$i];
|
||||||
|
|
||||||
|
$query = new DbQuery();
|
||||||
|
$query->select('COUNT(id_feature_value) as count_values');
|
||||||
|
$query->from('feature_value', 'fv');
|
||||||
|
$query->where('fv.id_feature ='.(int)$item['id_feature']);
|
||||||
|
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
||||||
|
$item['value'] = (int)$res;
|
||||||
|
unset($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user