| 1 |
<?php |
| 2 |
|
| 3 |
namespace TierPricingTable\Addons\AdvancedQuantityOptions; |
| 4 |
|
| 5 |
class ProductOptions { |
| 6 |
/** |
| 7 |
* Form |
| 8 |
* |
| 9 |
* @var AdvancedQuantityOptionsForm |
| 10 |
*/ |
| 11 |
protected $form; |
| 12 |
|
| 13 |
public function __construct( AdvancedQuantityOptionsForm $form ) { |
| 14 |
$this->form = $form; |
| 15 |
// Rendering |
| 16 |
add_action( |
| 17 |
'tiered_pricing_table/admin/after_minimum_order_quantity_field', |
| 18 |
function ( $productId, $loop ) { |
| 19 |
$this->form->render( $productId, $loop ); |
| 20 |
}, |
| 21 |
10, |
| 22 |
2 |
| 23 |
); |
| 24 |
add_action( |
| 25 |
'tiered_pricing_table/admin/after_variation_minimum_order_quantity_field', |
| 26 |
array($this->form, 'render'), |
| 27 |
10, |
| 28 |
2 |
| 29 |
); |
| 30 |
} |
| 31 |
|
| 32 |
public function save( $productId, $loop = null ) { |
| 33 |
DataProvider::updateFromRequest( |
| 34 |
'maximum', |
| 35 |
$productId, |
| 36 |
null, |
| 37 |
$loop |
| 38 |
); |
| 39 |
DataProvider::updateFromRequest( |
| 40 |
'group_of', |
| 41 |
$productId, |
| 42 |
null, |
| 43 |
$loop |
| 44 |
); |
| 45 |
} |
| 46 |
|
| 47 |
} |
| 48 |
|