示例#1
0
/**
 * getting additional (banner/order/roll up) order total price
 * @param array & $additional_orders
 * @param int $type ( 1(banner) / 2(poster) /3(roll up) )
 * @return int $total_price
 */
function get_additional_order_total_price(&$additional_orders, $type)
{
    $add_prices = get_additional_prices();
    $total_price = 0;
    foreach ($additional_orders as $item) {
        $total_price += $item['amount'] * get_price_by_square($item['width'], $item['height'], $add_prices[$type]);
    }
    return round($total_price);
}
foreach ($rollup_orders as $rollup) {
    ?>
		<tr data-id="<?php 
    echo $rollup['id'];
    ?>
">
			<td class="add_store" data-id="<?php 
    echo $rollup['store_id'];
    ?>
"><?php 
    echo $rollup['store_name'];
    ?>
</td>
			<td class="add_dimensions"><?php 
    echo $rollup['width'], ' x ', $rollup['height'];
    $total_price += $rollup['amount'] * get_price_by_square($rollup['width'], $rollup['height'], $add_prices[3]);
    ?>
</td>
			<td class="add_amount"><?php 
    echo $rollup['amount'];
    $total += $rollup['amount'];
    ?>
</td>
			<td>
				<button class="btn btn-danger additional_del" data-id="<?php 
    echo $rollup['id'];
    ?>
" title="delete"><i class="icon-trash icon-white"></i></button>
				<button class="btn btn-primary additional_edit" data-id="<?php 
    echo $rollup['id'];
    ?>
foreach ($poster_orders as $poster) {
    ?>
		<tr data-id="<?php 
    echo $poster['id'];
    ?>
">
			<td class="add_store" data-id="<?php 
    echo $poster['store_id'];
    ?>
"><?php 
    echo $poster['store_name'];
    ?>
</td>
			<td class="add_dimensions"><?php 
    echo $poster['width'], ' x ', $poster['height'];
    $total_price += $poster['amount'] * get_price_by_square($poster['width'], $poster['height'], $add_prices[2]);
    ?>
</td>
			<td class="add_amount"><?php 
    echo $poster['amount'];
    $total += $poster['amount'];
    ?>
</td>
			<td class="add_materials"><?php 
    echo $materials[$poster['material_id']];
    ?>
</td>
			<td>
				<button class="btn btn-danger additional_del" data-id="<?php 
    echo $poster['id'];
    ?>
?>
	</tr>
	<tr>
		<th>Price</th>
		<?php 
$j = 0;
$total_price = 0;
foreach ($campaign_orders as $type => &$campaign) {
    for ($i = 0; $i < count($campaign); $i++) {
        ?>
				<td colspan="4" class="campaign_<?php 
        echo $campaign_orders_list[$j];
        ?>
 campaign_price">
					<?php 
        if ($type == 1) {
            echo $price = round($campaign_totals[$j]['s_type_1'] * get_price_by_square(390, 300, $prices[1]) + $campaign_totals[$j]['s_type_2'] * get_price_by_square(100, 100, $prices[1]) + $campaign_totals[$j]['s_type_3'] * get_price_by_square(300, 290, $prices[1]) + $campaign_totals[$j]['s_type_4'] * get_price_by_square(580, 450, $prices[1]));
            $total_price += $price;
        } else {
            echo $price = round(($campaign_totals[$j]['s_type_1'] + $campaign_totals[$j]['s_type_2'] + $campaign_totals[$j]['s_type_3'] + $campaign_totals[$j]['s_type_4']) * $prices[$type]);
            $total_price += $price;
        }
        ?>
				</td>
				<?php 
        $j++;
    }
}
?>
	</tr>
</table>
foreach ($banner_orders as $banner) {
    ?>
	<tr data-id="<?php 
    echo $banner['id'];
    ?>
">
		<td class="add_store" data-id="<?php 
    echo $banner['store_id'];
    ?>
"><?php 
    echo $banner['store_name'];
    ?>
</td>
		<td class="add_dimensions"><?php 
    echo $banner['width'], ' x ', $banner['height'];
    $total_price += $banner['amount'] * get_price_by_square($banner['width'], $banner['height'], $add_prices[1]);
    ?>
</td>
		<td class="add_amount"><?php 
    echo $banner['amount'];
    $total += $banner['amount'];
    ?>
</td>
		<td class="add_hanging"><?php 
    echo $banner['hanging_method'];
    ?>
</td>
		<td class="add_materials"><?php 
    echo $materials[$banner['material_id']];
    ?>
</td>