Last active
May 22, 2020 09:16
-
-
Save alexv66/fa81ff21080564fa3a0a94c71d414d7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly | |
} | |
/** | |
* @var string $header_html | |
* @var array $table_header | |
* @var array $rows | |
* @var string $footer_html | |
*/ | |
global $product; | |
$product_id = $product->get_id(); | |
?> | |
<div class='clear'></div> | |
<div class="bulk_table"> | |
<div class="wdp_pricing_table_caption"><?php echo $header_html; ?></div> | |
<table class="wdp_pricing_table"> | |
<thead> | |
<tr> | |
<?php foreach ( $table_header as $label ): ?> | |
<td><?php echo $label ?></td> | |
<?php endforeach; ?> | |
<td>Action</td> | |
</tr> | |
</thead> | |
<tbody> | |
<?php foreach ( $rows as $row ): ?> | |
<tr> | |
<?php foreach ( $row as $html ): ?> | |
<td><?php echo $html ?></td> | |
<?php endforeach; ?> | |
<?php $elements = explode( "-", $row['qty']); | |
$qty = trim($elements[0]); | |
$link = "?add-to-cart=$product_id&quantity=$qty"; | |
echo "<td><a href='$link'>BUY $qty now!</a></td>"; | |
?> | |
</tr> | |
<?php endforeach; ?> | |
</tbody> | |
</table> | |
<span class="wdp_pricing_table_footer"><?php echo $footer_html; ?></span> | |
<br> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment