# shopbuilder/3.1.3/app/Modules/Compare/CompareInstaller.php

ShopBuilder – WooCommerce Builder For Elementor, version 3.1.3. 68 lines.

- Page: https://pluginprobe.com/plugins/shopbuilder/3.1.3/code/app/Modules/Compare/CompareInstaller.php
- Raw: https://pluginprobe.com/plugins/shopbuilder/3.1.3/raw/app/Modules/Compare/CompareInstaller.php
- Modified: 2025-10-08T05:03:42+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/shopbuilder/3.1.3/code/app/Modules/Compare/CompareInstaller.php#L10-L20`.

```php
<?php

namespace RadiusTheme\SB\Modules\Compare;

use RadiusTheme\SB\Helpers\Fns;

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'This script cannot be accessed directly.' );
}


class CompareInstaller {

	/**
	 * Run the installer
	 *
	 * @return void
	 */
	public function run() {
		$this->create_page();
	}

	/**
	 * [create_page] Create page
	 *
	 * @return void [void]
	 */
	private function create_page() {

		$page_id = Fns::get_option( 'modules', 'compare', 'page', 0, 'number' );
		if ( $page_id > 0 ) {
			$page_object = get_post( $page_id );

			if ( $page_object && 'page' === $page_object->post_type && ! in_array(
				$page_object->post_status,
				[
					'pending',
					'trash',
					'future',
					'auto-draft',
				],
				true
			) ) {
				// Valid page is already in place.
				return;
			}
		}
		if ( function_exists( 'WC' ) ) {
			if ( ! function_exists( 'wc_create_page' ) ) {
				require_once WC_ABSPATH . '/includes/admin/wc-admin-functions.php';
			}
			$create_page_id = wc_create_page(
				sanitize_title_with_dashes( _x( 'compare', 'page_slug', 'shopbuilder' ) ),
				'',
				esc_html__( 'Compare', 'shopbuilder' ),
				'<!-- wp:shortcode -->[rtsb_compare_list]<!-- /wp:shortcode -->'
			);
			if ( $create_page_id ) {
				$section_items         = [];
				$section_items['page'] = strval( $create_page_id );
				Fns::set_options( 'modules', 'compare', $section_items );

			}
		}
	}
}

```
