PluginProbe
Tiered Pricing Table for WooCommerce / 7.1.7
Tiered Pricing Table for WooCommerce v7.1.7
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
tier-pricing-table / src / Addons / RequestAQuote / Frontend / Adapters / TableAdapter.php

TableAdapter.php in Tiered Pricing Table for WooCommerce 7.1.7, at src/Addons/RequestAQuote/Frontend/Adapters/TableAdapter.php

40 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\RequestAQuote\Frontend\Adapters;
2
3 use TierPricingTable\Core\ServiceContainer;
4 use TierPricingTable\PricingRule;
5
6 class TableAdapter extends AbstractLayoutAdapter {
7
8 public function registerHooks() {
9 add_action( 'tiered_pricing_table/tiered_pricing/rows', array( $this, 'render' ), 10, 3 );
10 add_action( 'tiered_pricing_table/tiered_pricing/after', array( $this, 'renderFormPrompt' ), 10, 2 );
11 }
12
13 public function render( PricingRule $pricingRule, $settings = array(), $templateName = 'tiered-pricing-table' ) {
14
15 $form = $this->getValidFormForIntegratedPosition( $pricingRule );
16
17 if ( ! $form ) {
18 return;
19 }
20
21 $isDivTable = strpos( $templateName, 'style-' ) !== false;
22
23 $hasQty = ! empty( $settings['quantity_column_title'] ) || ! isset( $settings['quantity_column_title'] );
24 $hasDiscount = ! empty( $settings['discount_column_title'] ) || ! empty( $settings['show_discount_column'] );
25 $hasPrice = ! empty( $settings['price_column_title'] ) || ! isset( $settings['price_column_title'] );
26
27 ServiceContainer::getInstance()->getFileManager()->includeTemplate( 'frontend/integrated/table.php', array(
28 'form' => $form,
29 'productId' => $pricingRule->getProductId(),
30 'isDivTable' => $isDivTable,
31 'hasQty' => $hasQty,
32 'hasPrice' => $hasPrice,
33 'hasDiscount' => $hasDiscount,
34 'buttonHtml' => $this->getQuoteButtonHtml( $form, $pricingRule->getProductId(),
35 $isDivTable ? 'button wp-element-button' : 'button wp-element-button alt',
36 'padding: 5px 10px;margin:0; float:right', 'tpt-raq-table' ),
37 ), plugin_dir_path( dirname( __DIR__ ) ) . 'views/' );
38 }
39 }
40