tier-pricing-table
/
src
/
Addons
/
RequestAQuote
/
Frontend
/
Adapters
/
HorizontalTableAdapter.php
HorizontalTableAdapter.php in Tiered Pricing Table for WooCommerce 7.1.5, at src/Addons/RequestAQuote/Frontend/Adapters/HorizontalTableAdapter.php
| 1 | <?php namespace TierPricingTable\Addons\RequestAQuote\Frontend\Adapters; |
| 2 | |
| 3 | use TierPricingTable\Core\ServiceContainer; |
| 4 | use TierPricingTable\PricingRule; |
| 5 | |
| 6 | class HorizontalTableAdapter extends AbstractLayoutAdapter { |
| 7 | |
| 8 | public function registerHooks() { |
| 9 | add_action( 'tiered_pricing_table/horizontal-table/after_columns', array( $this, 'render' ), 10, 2 ); |
| 10 | } |
| 11 | |
| 12 | public function render( PricingRule $pricingRule, $settings = array() ) { |
| 13 | $form = $this->getValidFormForIntegratedPosition( $pricingRule ); |
| 14 | if ( ! $form ) { |
| 15 | return; |
| 16 | } |
| 17 | |
| 18 | $productId = $pricingRule->getProductId(); |
| 19 | |
| 20 | $hasQty = ! empty( $settings['quantity_column_title'] ) || ! isset( $settings['quantity_column_title'] ); |
| 21 | $hasDiscount = ! empty( $settings['discount_column_title'] ) || ! empty( $settings['show_discount_column'] ); |
| 22 | $hasPrice = ! empty( $settings['price_column_title'] ) || ! isset( $settings['price_column_title'] ); |
| 23 | ServiceContainer::getInstance()->getFileManager()->includeTemplate( |
| 24 | 'frontend/integrated/horizontal-table.php', |
| 25 | array( |
| 26 | 'form' => $form, |
| 27 | 'productId' => $productId, |
| 28 | 'hasQty' => $hasQty, |
| 29 | 'hasDiscount' => $hasDiscount, |
| 30 | 'hasPrice' => $hasPrice, |
| 31 | 'buttonHtml' => $this->getQuoteButtonHtml( $form, $productId, 'button wp-element-button', 'padding: 5px 10px;margin:0', 'tpt-raq-table' ) |
| 32 | ), |
| 33 | plugin_dir_path( dirname( __DIR__ ) ) . 'views/' |
| 34 | ); |
| 35 | } |
| 36 | } |
| 37 |