I've done it like this now, but I have three custom fields but I only want to display the one, which is the artikel-nummer- so how do I do that? Oh yes and maybe someone can tell me why I can't print using Chrome? It works with other browsers.
<style>
@media print {
#print {
display:flex;
justify-content:center;
align-items:center;
height:100%;
margin: 0 auto;
vertical-align: text-top;
position: relative;
top: 40px; left: 40px;
}
.centered {
position: relative;
top: 80%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>
<script>
function printDiv(print){
var restorepage = document.body.innerHTML;
var printcontent = document.getElementById('print').innerHTML;
document.body.innerHTML = printcontent;
window.print();
document.body.innerHTML = restorepage;
}
</script>
<details>
<summary><h1></h1></summary><button onclick="printDiv('print')">Print</button><div id='print'>
<p><center><div><h1><?php echo osc_item_category() ; ?></h1></div></center></p>
<p style="line-height: 150%"><center><div><font size="5" style="display:table-cell; vertical-align:middle; font-weight:bold;"><?php echo osc_item_title(); ?></font></div></center></p>
<p></p>
<p style="line-height: 150%" class="centered"><center><div><p><span><font size="5" style="display:table-cell; vertical-align:middle; font-weight:bold;text-align: end; position: relative;"><?php echo osc_item_formated_price(); ?></font></span></p></div></center></p><br><?php if( osc_count_item_meta() >= 1 ) { ?>
<div id="custom_fields">
<div class="meta_list">
<?php while ( osc_has_item_meta() ) { ?>
<?php if(osc_item_meta_value()!='') { ?>
<div class="meta">
<strong><?php echo osc_item_meta_name(); ?>:</strong> <span><?php echo osc_item_meta_value(); ?></span>
</div>
<?php } ?>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
</details>