CMXX - Categories and catalog enhancements

This commit is contained in:
“VeLiTi”
2025-01-31 17:03:31 +01:00
parent a669b2fadf
commit 754359f6b6
10 changed files with 234 additions and 37 deletions

View File

@@ -229,8 +229,8 @@ $view .= '</form>';
$view .= '
<div class="content-block">
<h2 class="responsive-width-100">'.($products_attributes_group_items ?? 'Groupitems').' <button class="btn2" onClick="addNewRow()" > + </button></h2>
<h2 class="responsive-width-100">'.($products_attributes_group_items ?? 'Groupitems').' <button class="btn2" onClick="addNewRow()" > + </button> <input form="update" class="btn2" type="submit" name="update" value="Save" class="btn"></h2>
<form action="" id="update" method="post"></form>
<form action="" id="new" method="post"></form>
@@ -243,6 +243,7 @@ $view .= '
<th>'.($products_attributes_item_quantity ?? 'quantity').'</th>
<th>'.($products_attributes_item_position ?? 'position').'</th>
<th>'.($products_attributes_item_media ?? 'media').'</th>
<th>'.($products_attributes_alternative_media ?? 'alternative').'</th>
<th>'.$general_created.'</th>
<th>'.$general_actions.'</th>
</tr>
@@ -274,15 +275,18 @@ $view .= '
<td><input form="update" id="source_'.$items['rowID'].'" type="hidden" name="attributes['.$items['rowID'].'][item_media]" value="'.$items['item_media'].'">
<img id="image_'.$items['rowID'].'" src="'.$items['full_path'].'" alt="" style="display: block; max-width: 75px;">
</td>
<td><input form="update" id="source_alt_'.$items['rowID'].'" type="hidden" name="attributes['.$items['rowID'].'][alternative_media]" value="'.$items['alternative_media'].'">
<img id="alt_'.$items['rowID'].'" src="'.$items['alternative_media_full_path'].'" alt="" style="display: block; max-width: 75px;">
</td>
<td>'.getRelativeTime($items['created']).'</td>
<td>
<button type="button" class="btn" id="openSelectorBtn" onclick="setSourceID(\''.$items['rowID'].'\'), openDialog(\'image_'.$items['rowID'].'\')">'.($button_assign_image ?? 'Assign Image').'</button>
<input form="update" type="submit" name="update" value="&" class="btn">
<button type="button" class="btn" id="openSelectorBtn" onclick="setSourceID(\''.$items['rowID'].'\'), openDialog(\'image_'.$items['rowID'].'\')">'.($button_assign_image ?? 'Media').'</button>
<button type="button" class="btn" id="openSelectorBtn" onclick="setSourceID(\'alt_'.$items['rowID'].'\'), openDialog(\'alt_'.$items['rowID'].'\')">'.($button_assign_image ?? 'Alt').'</button>
</td>
<input form="update" type="hidden" name="attributes['.$items['rowID'].'][rowID]" value="'.$items['rowID'].'" readonly>
<input form="update" type="hidden" name="attributes['.$items['rowID'].'][group_id]" value="'.$products_attributes['rowID'].'" readonly>
</tr>
</form>';
';
}
$view .= '<!-- Image Selector Dialog -->
@@ -340,8 +344,13 @@ $view .= '
//const openButton = document.getElementById(\'openSelectorBtn\');
function setSourceID(sourceid){
image_source_id = "source_"+sourceid;
image_source_src = "image_"+sourceid;
if(sourceid.substring(0,3) == "alt"){
image_source_id = "source_"+sourceid;
image_source_src = sourceid;
} else {
image_source_id = "source_"+sourceid;
image_source_src = "image_"+sourceid;
}
}
function openDialog(){
@@ -351,6 +360,7 @@ $view .= '
function selectImage(id,src) {
if (image_source_id != 0){
console.log(image_source_id);
const selectedImageInput = document.getElementById(image_source_id);
const previewImage = document.getElementById(image_source_src);