Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI have custom realization - where i can add to product items, i can get for product items like this:
<?php if(!empty($cart_item['more_product'])) :
$first_array = array_slice($cart_item['more_product'],0,4);
$second_array = array_slice($cart_item['more_product'],4);
?>
<div class="products__includes">
<div class="products__includes__btn active">
Set includes
</div>
<div class="products__includes__wrap">
<div class="products__includes__inner">
<table>
<tbody>
<?php foreach($first_array as $piece): ?>
<tr>
<th><?php echo $piece['title'];?></th>
<th><?php echo $piece['count'];?></th>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if(!empty($second_array)):?>
<table>
<tbody>
<?php foreach($second_array as $piece): ?>
<tr>
<th><?php echo $piece['title'];?></th>
<th><?php echo $piece['count'];?></th>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
i need get this all in order, how i can do?
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI have custom realization - where i can add to product items, i can get for product items like this:
<?php if(!empty($cart_item['more_product'])) :
$first_array = array_slice($cart_item['more_product'],0,4);
$second_array = array_slice($cart_item['more_product'],4);
?>
<div class="products__includes">
<div class="products__includes__btn active">
Set includes
</div>
<div class="products__includes__wrap">
<div class="products__includes__inner">
<table>
<tbody>
<?php foreach($first_array as $piece): ?>
<tr>
<th><?php echo $piece['title'];?></th>
<th><?php echo $piece['count'];?></th>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if(!empty($second_array)):?>
<table>
<tbody>
<?php foreach($second_array as $piece): ?>
<tr>
<th><?php echo $piece['title'];?></th>
<th><?php echo $piece['count'];?></th>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
i need get this all in order, how i can do?
Share Improve this question asked Oct 28, 2019 at 19:17 LerryLerry 1111 gold badge2 silver badges10 bronze badges1 Answer
Reset to default 1Put a look here for all sort possibility with an array: https://www.php/manual/fr/array.sorting.php
Look here for array_reverse if you want to reverse the list: https://www.php/manual/en/function.array-reverse.php
EDIT: But maybe you want to manually sort your items?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745048929a4608265.html
评论列表(0条)