Пример #1
0
/**
 * Returns default product image
 *
 * @return string
 */
function default_product_thumbnail()
{
    if (get_option('default_product_thumbnail')) {
        $url = get_option('default_product_thumbnail');
    } else {
        $product_id = get_the_ID();
        if ($product_id == sample_product_id()) {
            $url = AL_PLUGIN_BASE_PATH . 'img/implecode.jpg';
        } else {
            $url = AL_PLUGIN_BASE_PATH . 'img/no-default-thumbnail.png';
        }
    }
    return '<img src="' . $url . '"  />';
}
Пример #2
0
function enqueue_sample_product_scripts()
{
    if (isset($_GET['test_advanced'])) {
        $product_id = sample_product_id();
        if ($product_id == get_the_ID()) {
            wp_enqueue_style('wp-color-picker');
            wp_enqueue_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'));
            wp_enqueue_script('wp-color-picker', admin_url('js/color-picker.min.js'), array('iris'));
            $colorpicker_l10n = array('clear' => __('Clear'), 'defaultString' => __('Default'), 'pick' => __('Select Color'));
            wp_localize_script('wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n);
        }
    }
}
function product_adder_theme_check_notice()
{
    if (is_integration_mode_selected() && get_integration_type() == 'simple') {
        ?>
		<div id="implecode_message" class="updated product-adder-message messages-connect">
			<div class="squeezer">
				<h4><?php 
        _e('You are currently using eCommerce Product Catalog in Simple Mode. It is perfectly fine to use it this way, however some features are limited. To switch to Advanced Mode you probably need Theme Integration.', 'ecommerce-product-catalog');
        ?>
</h4>
				<p class="submit"><a href="https://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=simple-mode&key=top-message" target="_blank" class="button-primary"><?php 
        _e('Theme Integration Guide', 'ecommerce-product-catalog');
        ?>
</a> <a class="skip button" href="<?php 
        echo admin_url('edit.php?post_type=al_product&page=product-settings.php&tab=product-settings&submenu=support');
        ?>
"><?php 
        _e('Plugin Support', 'ecommerce-product-catalog');
        ?>
</a> <a class="skip button" href="<?php 
        echo esc_url(add_query_arg('hide_al_product_adder_support_check', 'true'));
        ?>
"><?php 
        _e('I know, don\'t bug me', 'ecommerce-product-catalog');
        ?>
</a></p>
			</div>
		</div><div class="clear"></div><?php 
    } else {
        if (is_integration_mode_selected() && get_integration_type() == 'advanced') {
            /* ?>
            	  <div id="implecode_message" class="updated product-adder-message messages-connect">
            	  <div class="squeezer">
            	  <h4><?php _e( 'You are currently using eCommerce Product Catalog in Advanced Mode without the integration file. It is perfectly fine to use it this way, however the file may be very handy if you need more control over product pages. See the guide for quick integration file creation.', 'ecommerce-product-catalog' ); ?></h4>
            	  <p class="submit"><a href="https://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=advanced-mode&key=top-message" target="_blank" class="button-primary"><?php _e( 'Theme Integration Guide', 'ecommerce-product-catalog' ); ?></a> <a class="skip button" href="<?php echo admin_url( 'edit.php?post_type=al_product&page=product-settings.php&tab=product-settings&submenu=support' ) ?>"><?php _e( 'Plugin Support', 'ecommerce-product-catalog' ); ?></a> <a class="skip button" href="<?php echo esc_url( add_query_arg( 'hide_al_product_adder_support_check', 'true' ) ); ?>"><?php _e( 'I know, don\'t bug me', 'ecommerce-product-catalog' ); ?></a></p>
            	  </div>
            	  </div><?php */
            ?>
		<div id="implecode_message" class="updated product-adder-message messages-connect">
			<div class="squeezer">
				<h4><?php 
            _e('Congratulations! Now your theme is fully integrated with eCommerce Product Catalog.', 'ecommerce-product-catalog');
            ?>
</h4>
				<p class="submit"><a href="<?php 
            echo admin_url('post-new.php?post_type=al_product');
            ?>
" class="button-primary"><?php 
            _e('Add Product', 'ecommerce-product-catalog');
            ?>
</a> <a class="skip button" href="<?php 
            echo admin_url('edit.php?post_type=al_product&page=product-settings.php');
            ?>
"><?php 
            _e('Product Settings', 'ecommerce-product-catalog');
            ?>
</a> <a href="https://implecode.com/docs/ecommerce-product-catalog/#cam=advanced-mode&key=top-message-docs" class="button"><?php 
            _e('Help & Documentation', 'ecommerce-product-catalog');
            ?>
</a>
				</p>
			</div>
		</div>
		<?php 
            $template = get_option('template');
            update_option('product_adder_theme_support_check', $template);
        } else {
            $product_id = sample_product_id();
            $sample_product_url = get_permalink($product_id);
            if (!$sample_product_url || get_post_status($product_id) != 'publish') {
                $sample_product_url = esc_url(add_query_arg('create_sample_product_page', 'true'));
            }
            ?>
		<div id="implecode_message" class="error product-adder-message messages-connect">
			<div class="squeezer">
				<h4><?php 
            _e('<strong>Your theme does not declare eCommerce Product Catalog support</strong> &#8211; please proceed to sample product page where automatic layout adjustment can be done.', 'ecommerce-product-catalog');
            ?>
</h4>
				<p class="submit">
					<?php 
            echo sample_product_button();
            ?>
					<a href="https://implecode.com/docs/ecommerce-product-catalog/theme-integration-wizard/#cam=default-mode&key=top-message-video" class="button"><?php 
            _e('Theme Integration Video', 'ecommerce-product-catalog');
            ?>
</a>
					<?php 
            /* <a href="https://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=default-mode&key=top-message" target="_blank" class="button"><?php _e( 'Theme Integration Guide', 'ecommerce-product-catalog' ); ?></a> */
            ?>
					<?php 
            /* <a class="skip button" href="<?php echo admin_url( 'edit.php?post_type=al_product&page=product-settings.php&tab=product-settings&submenu=support' ) ?>"><?php _e( 'Plugin Support', 'ecommerce-product-catalog' ); ?></a> */
            ?>
					<a class="skip button" href="<?php 
            echo esc_url(add_query_arg('hide_al_product_adder_support_check', 'true'));
            ?>
"><?php 
            _e('Hide Forever', 'ecommerce-product-catalog');
            ?>
</a>
				</p>
			</div>
		</div><?php 
        }
    }
}
Пример #4
0
function create_sample_product_with_redirect()
{
    if (isset($_GET['create_sample_product_page'])) {
        $sample_product_id = create_sample_product();
        wp_redirect(get_permalink(sample_product_id()));
        exit;
    }
}
Пример #5
0
/**
 * Checks if current page is integration wizard page
 *
 * @return boolean
 */
function is_ic_integration_wizard_page()
{
    if (sample_product_id() == get_the_ID() && current_user_can("manage_product_settings") && !is_advanced_mode_forced()) {
        return true;
    }
    return false;
}
Пример #6
0
function sample_product_url()
{
    $product_id = sample_product_id();
    $sample_product_url = get_permalink($product_id);
    $sample_product_url = esc_url(add_query_arg('test_advanced', 1, $sample_product_url));
    if (!$sample_product_url || get_post_status($product_id) != 'publish') {
        $sample_product_url = esc_url(add_query_arg('create_sample_product_page', 'true'));
    }
    return $sample_product_url;
}
function product_adder_theme_check_notice()
{
    if (is_integration_mode_selected() && get_integration_type() == 'simple') {
        ?>
<div id="implecode_message" class="updated product-adder-message messages-connect">
	<div class="squeezer">
		<h4><?php 
        _e('<strong>You are currently using eCommerce Product Catalog in Simple Mode</strong> &#8211; to switch to Advanced Mode you probably need Theme Integration.', 'al-ecommerce-product-catalog');
        ?>
</h4>
		<p class="submit"><a href="http://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=simple-mode&key=top-message" target="_blank" class="button-primary"><?php 
        _e('Theme Integration Guide', 'al-ecommerce-product-catalog');
        ?>
</a> <a class="skip button" href="<?php 
        echo admin_url('edit.php?post_type=al_product&page=product-settings.php&tab=product-settings&submenu=support');
        ?>
"><?php 
        _e('Plugin Support', 'al-ecommerce-product-catalog');
        ?>
</a><a class="skip button" href="<?php 
        echo add_query_arg('hide_al_product_adder_support_check', 'true');
        ?>
"><?php 
        _e('I know, don\'t bug me', 'al-ecommerce-product-catalog');
        ?>
</a></p>
	</div>
</div><div class="clear"></div><?php 
    } else {
        if (is_integration_mode_selected() && get_integration_type() == 'advanced') {
            ?>
<div id="implecode_message" class="updated product-adder-message messages-connect">
	<div class="squeezer">
		<h4><?php 
            _e('<strong>You are currently using eCommerce Product Catalog in Advanced Mode without the integration file</strong> &#8211; please see the guide for quick integration file creation.', 'al-ecommerce-product-catalog');
            ?>
</h4>
		<p class="submit"><a href="http://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=advanced-mode&key=top-message" target="_blank" class="button-primary"><?php 
            _e('Theme Integration Guide', 'al-ecommerce-product-catalog');
            ?>
</a> <a class="skip button" href="<?php 
            echo admin_url('edit.php?post_type=al_product&page=product-settings.php&tab=product-settings&submenu=support');
            ?>
"><?php 
            _e('Plugin Support', 'al-ecommerce-product-catalog');
            ?>
</a><a class="skip button" href="<?php 
            echo add_query_arg('hide_al_product_adder_support_check', 'true');
            ?>
"><?php 
            _e('I know, don\'t bug me', 'al-ecommerce-product-catalog');
            ?>
</a></p>
	</div>
</div><?php 
        } else {
            $product_id = sample_product_id();
            $sample_product_url = get_permalink($product_id);
            if (!$sample_product_url || get_post_status($product_id) != 'publish') {
                $sample_product_url = add_query_arg('create_sample_product_page', 'true');
            }
            ?>
<div id="implecode_message" class="error product-adder-message messages-connect">
	<div class="squeezer">
		<h4><?php 
            _e('<strong>Your theme does not declare eCommerce Product Catalog support</strong> &#8211; please proceed to sample product page where automatic layout adjustment can be done.', 'al-ecommerce-product-catalog');
            ?>
</h4>
		<p class="submit"><a href="<?php 
            echo $sample_product_url;
            ?>
" class="button-primary"><?php 
            _e('Sample Product Page', 'al-ecommerce-product-catalog');
            ?>
</a><a href="http://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=default-mode&key=top-message" target="_blank" class="button"><?php 
            _e('Theme Integration Guide', 'al-ecommerce-product-catalog');
            ?>
</a> <a class="skip button" href="<?php 
            echo admin_url('edit.php?post_type=al_product&page=product-settings.php&tab=product-settings&submenu=support');
            ?>
"><?php 
            _e('Plugin Support', 'al-ecommerce-product-catalog');
            ?>
</a><a class="skip button" href="<?php 
            echo add_query_arg('hide_al_product_adder_support_check', 'true');
            ?>
"><?php 
            _e('Hide this notice', 'al-ecommerce-product-catalog');
            ?>
</a></p>
	</div>
</div><?php 
        }
    }
}