Merge branch 'ticket-10805' into develop
This commit is contained in:
commit
5edc9724a3
@ -245,6 +245,47 @@ class AdminProducts extends AdminTab
|
||||
Tools::redirectAdmin($currentIndex.(Tools::getValue('id_category') ? '&id_category='.Tools::getValue('id_category') : '').'&token='.($token ? $token : $this->token));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('clean_positionproduct')) {
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
if ($cookie->id_employee == 1) {
|
||||
$category_products = Db::getInstance()->ExecuteS('
|
||||
SELECT cp.`id_product`, cp.`position`, cp.`id_category`
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
WHERE cp.`id_category` = '.(int)$this->_category->id.'
|
||||
ORDER BY cp.`position` ASC
|
||||
');
|
||||
|
||||
// Position mise à 0
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'category_product`
|
||||
SET `position` = 0
|
||||
WHERE `id_category` = '.(int)$this->_category->id
|
||||
);
|
||||
|
||||
$pos = 0;
|
||||
foreach ($category_products as $key => $cat_product) {
|
||||
if(Validate::isLoadedObject($product = new Product((int)$cat_product['id_product']))){
|
||||
Db::getInstance()->Execute('
|
||||
UPDATE `'._DB_PREFIX_.'category_product`
|
||||
SET `position` = '. (int)($pos) .'
|
||||
WHERE `id_product` = '.(int)$cat_product['id_product'].'
|
||||
AND `id_category`='.(int)$this->_category->id
|
||||
);
|
||||
$pos++;
|
||||
} else {
|
||||
Db::getInstance()->Execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE `id_category` = '.(int)$this->_category->id.'
|
||||
AND `id_product` = '.(int)$cat_product['id_product'].'
|
||||
');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Tools::redirectAdmin($currentIndex.(Tools::getValue('id_category') ? '&id_category='.Tools::getValue('id_category') : '').'&token='.($token ? $token : $this->token));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('reorderproduct') || Tools::isSubmit('reordersubproduct')) {
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
@ -1939,6 +1980,10 @@ class AdminProducts extends AdminTab
|
||||
echo '<p><input type="submit" class="button" name="reordersub'.$this->table.'" value="'.$this->l('Order products').'" /></p>';
|
||||
echo '<p>'.$this->l('Order by product name').'</p>';
|
||||
}
|
||||
if((int)$this->_category->id_oarent !=1 && $cookie->id_employee==1){
|
||||
echo '<p><input type="submit" class="button" name="clean_position'.$this->table.'" value="'.$this->l('Order products').'" /></p>';
|
||||
echo '<p>'.$this->l('Re-Order by product position, clean all position of the category').'</p>';
|
||||
}
|
||||
|
||||
echo '</form>';
|
||||
if (isset($this->_includeTab) AND sizeof($this->_includeTab))
|
||||
@ -4497,6 +4542,12 @@ class AdminProducts extends AdminTab
|
||||
}
|
||||
|
||||
public function getFieldValue($obj, $data, $id_lang) {
|
||||
global $cookie;
|
||||
|
||||
// if ($id_lang == 0) {
|
||||
// $id_lang = (int)($cookie->id_lang);
|
||||
// }
|
||||
|
||||
$customs_data = Db::getInstance()->getRow('
|
||||
SELECT `nc8`, `id_country`
|
||||
FROM `'._DB_PREFIX_.'product_customs`
|
||||
|
@ -38,7 +38,7 @@ $(document).ready(function() {
|
||||
onDragClass: 'myDragClass',
|
||||
onDrop: function(table, row) {
|
||||
if (originalOrder != $.tableDnD.serialize()) {
|
||||
|
||||
var url_params = $.tableDnD.serialize();
|
||||
var way = (originalOrder.indexOf(row.id) < $.tableDnD.serialize().indexOf(row.id))? 1 : 0;
|
||||
var ids = row.id.split('_');
|
||||
var tableDrag = $('#' + table.id);
|
||||
@ -76,19 +76,25 @@ $(document).ready(function() {
|
||||
token: token
|
||||
};
|
||||
if (table.id == 'product') {
|
||||
// @Override Antadis - Passing product array in Post to prevent bug when too many products on list (url request too long)
|
||||
var post_params = url_params.replace(/&/g,"");
|
||||
post_params = post_params.split("product[]=");
|
||||
post_params.splice(0, 1);;
|
||||
params = {
|
||||
ajaxProductsPositions: true,
|
||||
id_category: ids[1],
|
||||
id_product: ids[2],
|
||||
way: way,
|
||||
token: token
|
||||
token: token,
|
||||
product : post_params
|
||||
};
|
||||
url_params = '';
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
async: false,
|
||||
url: 'ajax.php?' + $.tableDnD.serialize(),
|
||||
url: 'ajax.php?'+url_params,
|
||||
data: params,
|
||||
success: function(data) {
|
||||
if (come_from == 'AdminModulesPositions') {
|
||||
|
@ -212,6 +212,10 @@ class AdminBraderie extends AdminTab
|
||||
return false;
|
||||
});
|
||||
|
||||
// $("#formBraderie").submit(function(){
|
||||
// return false;
|
||||
// });
|
||||
|
||||
$("#add_button").click(function(event) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
@ -374,7 +378,7 @@ class AdminBraderie extends AdminTab
|
||||
<select class="chosen-select" id="category" name="category">
|
||||
<option value=""></option>
|
||||
</select>
|
||||
<input type="submit" class="button" id="show_current_category_button" value="'.$this->l('Voir cette catégorie').'" style="margin-left: 20px; display: none">
|
||||
<a href="?tab=AdminCatalog" class="button" id="show_current_category_button" style="margin-left: 20px; display: none">'.$this->l('Voir cette catégorie').'</a>
|
||||
</div>
|
||||
<div class="margin-form" id="quantity_input_group" style="display: none;">
|
||||
<label>'.$this->l('Quantité').' : </label>
|
||||
@ -389,8 +393,8 @@ class AdminBraderie extends AdminTab
|
||||
<textarea class="other_textarea" cols="49" rows="3" id="input_comment" name="input_comment"></textarea>
|
||||
</div>
|
||||
<div class="margin-form button-container" id="button_input_group" style="display: none;">
|
||||
<!--input type="submit" class="button" name="adminbraderie" value="'.$this->l('Ajouter').'" style="margin-left: 200px;" id="add_button"-->
|
||||
<input type="submit" class="button" id="check_button" value="'.$this->l('Vérifier').'" style="margin-left: 200px;">
|
||||
<input type="submit" class="button" name="adminbraderie" value="'.$this->l('Ajouter').'" style="margin-left: 200px;" id="add_button">
|
||||
<input type="submit" class="button" id="check_button" value="'.$this->l('Vérifier').'">
|
||||
</div>
|
||||
<input type="hidden" name="product" id="hidden_product_id">
|
||||
<input type="hidden" name="attribute" id="hidden_attribute_id">
|
||||
|
@ -282,7 +282,7 @@ function addToSellout()
|
||||
|
||||
Image::duplicateProductImages($id_product_old, $product->id, $combinationImages);
|
||||
}
|
||||
return Tools::displayError('Le produit ajoute dans la braderie');
|
||||
return Tools::displayError('Le produit a été ajouté à la braderie');
|
||||
}
|
||||
|
||||
function pSQLArray($data)
|
||||
|
Loading…
Reference in New Issue
Block a user