Inventory_Presser_Admin_Options::callback_price_display()

Outputs a dropdown select control for the Price Display setting


Return Return

(void)


Top ↑

Source Source

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

	public function callback_price_display() {
		$separator             = apply_filters( 'invp_price_display_separator', ' / ', $settings['price_display'], 0 );
		$price_display_options = apply_filters(
			'invp_price_display_options',
			array(
				'default'          => '${Price}',
				'msrp'             => '${MSRP}',
				'full_or_down'     => '${Price}' . $separator . '${Down Payment} Down',
				'down_only'        => '${Down Payment} Down',
				'was_now_discount' => sprintf(
					'%s ${MSRP} %s ${Price} %s ${MSRP}-{Price}',
					apply_filters( 'invp_price_was_now_discount_retail', __( 'Retail', 'inventory-presser' ) ),
					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'     => '${Payment} {Frequency}',
				'down_and_payment' => '${Down payment}' . $separator . '${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' )
		);
	}