# tier-pricing-table/8.0.2/src/Addons/RequestAQuote/Frontend/Adapters/TableAdapter.php

Tiered Pricing Table for WooCommerce, version 8.0.2. 49 lines.

- Page: https://pluginprobe.com/plugins/tier-pricing-table/8.0.2/code/src/Addons/RequestAQuote/Frontend/Adapters/TableAdapter.php
- Raw: https://pluginprobe.com/plugins/tier-pricing-table/8.0.2/raw/src/Addons/RequestAQuote/Frontend/Adapters/TableAdapter.php
- Modified: 2026-09-24T13:05:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tier-pricing-table/8.0.2/code/src/Addons/RequestAQuote/Frontend/Adapters/TableAdapter.php#L10-L20`.

```php
<?php namespace TierPricingTable\Addons\RequestAQuote\Frontend\Adapters;

use TierPricingTable\Core\ServiceContainer;
use TierPricingTable\PricingRule;

class TableAdapter extends AbstractLayoutAdapter {
	
	public function registerHooks() {
		add_action( 'tiered_pricing_table/tiered_pricing/rows', array( $this, 'render' ), 10, 3 );
		add_action( 'tiered_pricing_table/tiered_pricing/after', array( $this, 'renderFormPrompt' ), 10, 2 );
	}
	
	public function render( PricingRule $pricingRule, $settings = array(), $templateName = 'tiered-pricing-table' ) {
		
		$form = $this->getValidFormForIntegratedPosition( $pricingRule );
		
		if ( ! $form ) {
			return;
		}
		
		$isDivTable = strpos( $templateName, 'style-' ) !== false;
		
		$hasQty      = ! empty( $settings['quantity_column_title'] ) || ! isset( $settings['quantity_column_title'] );
		$hasDiscount = ! empty( $settings['discount_column_title'] ); // the table draws the discount column from its header only
		$hasPrice    = ! empty( $settings['price_column_title'] ) || ! isset( $settings['price_column_title'] );
		
		// the row spans the whole table: the base columns plus whatever the header hook adds (custom columns)
		ob_start();
		do_action( 'tiered_pricing_table/tiered_pricing/header_columns', $pricingRule );
		$extraColumns = (int) preg_match_all( '/<th\b/i', (string) ob_get_clean() );
		$columns      = (int) $hasQty + (int) $hasDiscount + (int) $hasPrice + $extraColumns;
		$span         = max( 1, $columns - (int) $hasQty );
		
		ServiceContainer::getInstance()->getFileManager()->includeTemplate( 'frontend/integrated/table.php', array(
			'form'        => $form,
			'productId'   => $pricingRule->getProductId(),
			'isDivTable'  => $isDivTable,
			'hasQty'      => $hasQty,
			'hasPrice'    => $hasPrice,
			'hasDiscount' => $hasDiscount,
			'columns'     => $columns,
			'span'        => $span,
			'buttonHtml'  => $this->getQuoteButtonHtml( $form, $pricingRule->getProductId(),
				$isDivTable ? 'button wp-element-button' : 'button wp-element-button alt',
				'padding: 5px 10px;margin:0; float:right', 'tpt-raq-table' ),
		), plugin_dir_path( dirname( __DIR__ ) ) . 'views/' );
	}
}

```
