[*] BO #PSFV-94 : Added AdminCarrierController
This commit is contained in:
@@ -1077,6 +1077,7 @@ class AdminControllerCore extends Controller
|
||||
$helper->table = $this->table;
|
||||
$helper->_orderBy = $this->_orderBy;
|
||||
$helper->_orderWay = $this->_orderWay;
|
||||
$helper->_listTotal = $this->_listTotal;
|
||||
$helper->shopLink = $this->shopLink;
|
||||
$helper->shopLinkType = $this->shopLinkType;
|
||||
$helper->identifier = $this->identifier;
|
||||
@@ -1088,15 +1089,19 @@ class AdminControllerCore extends Controller
|
||||
// For each action, try to add the corresponding skip elements list
|
||||
$helper->list_skip_actions = $this->list_skip_actions;
|
||||
$this->content .= $helper->generateList($this->_list, $this->fieldsDisplay);
|
||||
}
|
||||
else if ($this->display == 'options')
|
||||
{
|
||||
|
||||
// init options declaration
|
||||
$this->initOptions();
|
||||
|
||||
$helper = new HelperOptions();
|
||||
$this->content .= $helper->generateOptions();
|
||||
|
||||
if ($this->options)
|
||||
{
|
||||
$helper = new HelperOptions();
|
||||
$helper->id = $this->id;
|
||||
$helper->currentIndex = self::$currentIndex;
|
||||
$this->content .= $helper->generateOptions($this->options);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1758,7 +1763,13 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
protected function updateAssoShop($id_object = false)
|
||||
/**
|
||||
* Update the associations of shops
|
||||
*
|
||||
* @param int $id_object
|
||||
* @param int $new_id_object
|
||||
*/
|
||||
protected function updateAssoShop($id_object = false, $new_id_object = false)
|
||||
{
|
||||
if (!Shop::isFeatureActive())
|
||||
return;
|
||||
@@ -1782,9 +1793,10 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$type.($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
||||
|
||||
foreach ($assos as $asso)
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.$this->table.'_'.$type.' (`'.pSQL($this->identifier).'`, id_'.$type.')
|
||||
VALUES('.(int)$asso['id_object'].', '.(int)$asso['id_'.$type].')');
|
||||
VALUES('.($new_id_object ? $new_id_object : (int)$asso['id_object']).', '.(int)$asso['id_'.$type].')');
|
||||
}
|
||||
|
||||
protected function validateField($value, $field)
|
||||
@@ -1825,6 +1837,8 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
// init options declaration
|
||||
$this->initOptions();
|
||||
foreach ($this->options as $category => $category_data)
|
||||
{
|
||||
$fields = $category_data['fields'];
|
||||
|
||||
+13
-2
@@ -546,9 +546,7 @@ class CarrierCore extends ObjectModel
|
||||
if (Configuration::get('PS_CARRIER_DEFAULT_SORT') == Carrier::SORT_BY_PRICE)
|
||||
{
|
||||
foreach ($results_array as $r)
|
||||
{
|
||||
$prices[] = $r['price'];
|
||||
}
|
||||
array_multisort($prices, SORT_NUMERIC, $results_array);
|
||||
}
|
||||
|
||||
@@ -619,6 +617,19 @@ class CarrierCore extends ObjectModel
|
||||
AND `id_zone` = '.(int)$id_zone.' LIMIT 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specific group
|
||||
*
|
||||
* @return array Group
|
||||
*/
|
||||
public function getGroups()
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT id_group
|
||||
FROM '._DB_PREFIX_.'carrier_group
|
||||
WHERE id_carrier='.(int)$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean delivery prices (weight/price)
|
||||
*
|
||||
|
||||
@@ -31,7 +31,7 @@ class HelperListCore extends Helper
|
||||
protected $_list = array();
|
||||
|
||||
/** @var integer Number of results in list */
|
||||
protected $_listTotal = 0;
|
||||
public $_listTotal = 0;
|
||||
|
||||
/** @var array WHERE clause determined by filter fields */
|
||||
protected $_filter;
|
||||
@@ -95,7 +95,8 @@ class HelperListCore extends Helper
|
||||
'id_category' => 'id_category_to_move',
|
||||
'id_cms_category' => 'id_cms_category_to_move',
|
||||
'id_cms' => 'id_cms',
|
||||
'id_attribute' => 'id_attribute'
|
||||
'id_attribute' => 'id_attribute',
|
||||
'id_carrier' => 'id_carrier'
|
||||
);
|
||||
|
||||
// @var boolean ask for simple header : no filters, no paginations and no sorting
|
||||
|
||||
@@ -112,7 +112,7 @@ class HelperOptionsCore extends Helper
|
||||
|
||||
// Is at least one required field present?
|
||||
if (isset($field['required']) && $field['required'])
|
||||
$required_fields = true;
|
||||
$this->required = true;
|
||||
}
|
||||
// Assign the modifications back to parent array
|
||||
$option_list[$category] = $category_data;
|
||||
@@ -122,7 +122,7 @@ class HelperOptionsCore extends Helper
|
||||
'current' => $this->currentIndex,
|
||||
'option_list' => $option_list,
|
||||
'current_id_lang' => $this->context->language->id,
|
||||
'required_fields' => $required_fields,
|
||||
'required_fields' => $this->required,
|
||||
));
|
||||
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->tpl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user