Merge branch 'ticket-AssociateProducts' into develop

This commit is contained in:
Marion Muszynski 2016-10-05 18:12:19 +02:00
commit ead50a26c4
3 changed files with 25 additions and 3 deletions

View File

@ -3554,7 +3554,7 @@ class AdminProducts extends AdminTab
$image_obj = new Image((int)$img['id_image']); $image_obj = new Image((int)$img['id_image']);
$accesorie_img_path = (isset($image_obj)?$image_obj->getExistingImgPath():''); $accesorie_img_path = (isset($image_obj)?$image_obj->getExistingImgPath():'');
} }
echo '<div>'.(!empty($accesorie_img_path)?'<img src="'._THEME_PROD_DIR_.$accesorie_img_path.'-small.jpg" /> ':'').htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8').(!empty($accessory['reference']) ? ' ('.$accessory['reference'].')' : '').' <span onclick="delAccessory('.$accessory['id_product'].');" style="cursor: pointer;"><img src="../img/admin/delete.gif" class="middle" alt="" /></span></div><br />'; echo '<div class="item_accessory">'.(!empty($accesorie_img_path)?'<img src="'._THEME_PROD_DIR_.$accesorie_img_path.'-small.jpg" /> ':'').'<p>'.htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8').(!empty($accessory['reference']) ? ' ('.$accessory['reference'].')' : '').' <span onclick="delAccessory('.$accessory['id_product'].');" style="cursor: pointer;"><img src="../img/admin/delete.gif" class="middle" alt="" /></span></p></div>';
} }
echo '</div> echo '</div>
<input type="hidden" name="inputAccessories" id="inputAccessories" value="'; <input type="hidden" name="inputAccessories" id="inputAccessories" value="';

View File

@ -111,4 +111,26 @@ input[type="file"], textarea, select {
.categories-treeview{ .categories-treeview{
background-color:rgba(86,84,133,0.3)!important; background-color:rgba(86,84,133,0.3)!important;
}
#divAccessories{
box-sizing: border-box;
margin-bottom: 10px;
}
.item_accessory {
float: left;
width: 30%;
text-align: center;
margin-right: 5px;
margin-top: 5px;
background: #fff;
padding: 5px;
}
.item_accessory p {
color: #565485!important;
}
#divAccessories:after{
content: '';
display: block;
clear: both;
} }

View File

@ -334,7 +334,7 @@ function addAccessory(event, data, formatted)
var $imgAccessories = $('#imgAccessories'); var $imgAccessories = $('#imgAccessories');
/* delete product from select + add product line to the div, input_name, input_ids elements */ /* delete product from select + add product line to the div, input_name, input_ids elements */
$divAccessories.html($divAccessories.html() + '<img src="/img/p/'+productImg+'-small.jpg" /> ' + productName + ' <span onclick="delAccessory(' + productId + ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span><br />'); $divAccessories.html($divAccessories.html() + '<div class="item_accessory"><img src="/img/p/'+productImg+'-small.jpg" /> <p>' + productName + ' <span onclick="delAccessory(' + productId + ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span></p></div>');
$nameAccessories.val($nameAccessories.val() + productName + '¤'); $nameAccessories.val($nameAccessories.val() + productName + '¤');
$inputAccessories.val($inputAccessories.val() + productId + '-'); $inputAccessories.val($inputAccessories.val() + productId + '-');
$imgAccessories.val($imgAccessories.val() + productImg + ','); $imgAccessories.val($imgAccessories.val() + productImg + ',');
@ -377,7 +377,7 @@ function delAccessory(id)
input.value += inputCut[i] + '-'; input.value += inputCut[i] + '-';
name.value += nameCut[i] + '¤'; name.value += nameCut[i] + '¤';
img.value += imgCut[i] + ';'; img.value += imgCut[i] + ';';
div.innerHTML += '<img src="/img/p/'+imgCut[i]+'-small.jpg" /> '+nameCut[i] + ' <span onclick="delAccessory(' + inputCut[i] + ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span><br />'; div.innerHTML += '<div class="item_accessory"><img src="/img/p/'+imgCut[i]+'-small.jpg" /> <p>'+nameCut[i] + ' <span onclick="delAccessory(' + inputCut[i] + ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span></p></div>';
} }
else else
$('#selectAccessories').append('<option selected="selected" value="' + inputCut[i] + '-' + nameCut[i] + '">' + inputCut[i] + ' - ' + nameCut[i] + '</option>'); $('#selectAccessories').append('<option selected="selected" value="' + inputCut[i] + '-' + nameCut[i] + '">' + inputCut[i] + ' - ' + nameCut[i] + '</option>');