Inventory_Presser_Admin_Options::callback_price_display()

Outputs a dropdown select control for the Price Display setting


Return

(void)


Source

File: includes/admin/class-admin-options.php

	public function callback_price_display() {
		$separator             = apply_filters( 'invp_price_display_separator', ' / ', $this->option['price_display'] ?? '', 0 );
		$price_display_options = apply_filters(
			'invp_price_display_options',
			array(
				'default'          => INVP::currency_symbol() . '{Price}',
				'msrp'             => INVP::currency_symbol() . '{MSRP}',
				'full_or_down'     => INVP::currency_symbol() . '{Price}' . $separator . INVP::currency_symbol() . '{Down Payment} Down',
				'down_only'        => INVP::currency_symbol() . '{Down Payment} Down',
				'was_now_discount' => sprintf(
					'%1$s %2$s{MSRP} %3$s %2$s{Price} %4$s %2$s{MSRP}-{Price}',
					apply_filters( 'invp_price_was_now_discount_retail', __( 'Retail', 'inventory-presser' ) ),
					INVP::currency_symbol(),
					apply_filters( 'invp_price_was_now_discount_now', __( 'Now', 'inventory-presser' ) ),
					apply_filters( 'invp_price_was_now_discount_save', __( 'You Save', 'inventory-presser' ) )
				),
				'payment_only'     => INVP::currency_symbol() . '{Payment} {Frequency}',
				'down_and_payment' => INVP::currency_symbol() . '{Down payment}' . $separator . INVP::currency_symbol() . '{Payment} {Frequency}',
				'call_for_price'   => __( 'Call For Price', 'inventory-presser' ),
			)
		);

		$selected_val = null;
		if ( isset( $this->option['price_display'] ) ) {
			$selected_val = $this->option['price_display'];
		}

		printf(
			'<select name="%s[price_display]" id="price_display">',
			esc_attr( INVP::OPTION_NAME )
		);
		foreach ( $price_display_options as $val => $name ) {
			printf(
				'<option value="%s"%s>%s</option>',
				esc_attr( $val ),
				selected( $val, $selected_val, false ),
				esc_html( $name )
			);
		}
		printf(
			'</select><p class="description" id="%s[price_display]-description">&quot;%s&quot; %s.</p>',
			esc_attr( INVP::OPTION_NAME ),
			esc_html__( 'Call for Price', 'inventory-presser' ),
			esc_html__( 'will display for any price that is zero', 'inventory-presser' )
		);