Пример #1
0
    function widget($args, $instance)
    {
        if (get_integration_type() != 'simple') {
            if (is_plural_form_active()) {
                $names = get_catalog_names();
                $label = sprintf(__('%s Search', 'ecommerce-product-catalog'), ic_ucfirst($names['singular']));
            } else {
                $label = __('Product Search', 'ecommerce-product-catalog');
            }
            $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
            echo $args['before_widget'];
            if ($title) {
                echo $args['before_title'] . $title . $args['after_title'];
            }
            // Use current theme search form if it exists
            $search_button_text = apply_filters('product_search_button_text', '');
            echo '<form role="search" class="' . design_schemes('box', 0) . '" method="get" id="product_search_form" action="' . esc_url(home_url('/')) . '">
<input type="hidden" name="post_type" value="' . get_current_screen_post_type() . '" />
<input class="product-search-box" type="search" value="' . get_search_query() . '" id="s" name="s" placeholder="' . $label . '" />
<input class="product-search-submit" type="submit" id="searchsubmit" value="' . $search_button_text . '" />
</form>';
            echo $args['after_widget'];
        }
    }
Пример #2
0
/**
 * Adds paginaion to the product listings
 *
 * @global object $wp_query
 * @return string
 */
function product_archive_pagination()
{
    if (!is_home_archive() && is_singular() || is_ic_product_listing() && is_ic_only_main_cats()) {
        return;
    }
    global $paged, $wp_query;
    if ($wp_query->max_num_pages <= 1) {
        return;
    }
    $paged = get_query_var('paged') ? absint(get_query_var('paged')) : 1;
    $max = intval($wp_query->max_num_pages);
    if ($paged >= 1) {
        $links[] = $paged;
    }
    if ($paged >= 3) {
        $links[] = $paged - 1;
        $links[] = $paged - 2;
    }
    if ($paged + 2 <= $max) {
        $links[] = $paged + 2;
        $links[] = $paged + 1;
    }
    $names = get_archive_names();
    echo '<div id="product_archive_nav" class="product-archive-nav ' . design_schemes('box', 0) . '"><ul>' . "\n";
    if (get_previous_posts_link($names['previous_products'])) {
        printf('<li>%s</li> ' . "\n", get_previous_posts_link($names['previous_products']));
    }
    if (!in_array(1, $links)) {
        $class = 1 == $paged ? ' class="active"' : '';
        printf('<li%s><a href="%s">%s</a></li> ' . "\n", $class, esc_url(get_pagenum_link(1)), '1');
        if (!in_array(2, $links)) {
            echo '<li>…</li>';
        }
    }
    sort($links);
    foreach ((array) $links as $link) {
        $class = $paged == $link ? ' class="active"' : '';
        printf('<li%s><a href="%s">%s</a></li> ' . "\n", $class, esc_url(get_pagenum_link($link)), $link);
    }
    if (!in_array($max, $links)) {
        if (!in_array($max - 1, $links)) {
            echo '<li>…</li>' . "\n";
        }
        $class = $paged == $max ? ' class="active"' : '';
        printf('<li%s><a href="%s">%s</a></li> ' . "\n", $class, esc_url(get_pagenum_link($max)), $max);
    }
    if (get_next_posts_link($names['next_products'])) {
        printf('<li>%s</li> ' . "\n", get_next_posts_link($names['next_products']));
    }
    echo '</ul></div>' . "\n";
    wp_reset_postdata();
}
Пример #3
0
function color_schemes()
{
    $tab = $_GET['tab'];
    $submenu = $_GET['submenu'];
    if ($submenu == 'design-schemes') {
        ?>
		<script>
			jQuery( '.settings-submenu a' ).removeClass( 'current' );
			jQuery( '.settings-submenu a#design-schemes' ).addClass( 'current' );
		</script>
		<form method="post" action="options.php">
			<?php 
        settings_fields('design_schemes');
        $custom_single_styles = unserialize(DEFAULT_DESIGN_SCHEMES);
        $design_schemes = get_option('design_schemes', $custom_single_styles);
        ?>
			<h2><?php 
        _e('Design Settings', 'ecommerce-product-catalog');
        ?>
</h2>
			<h3><?php 
        _e('Design Schemes', 'ecommerce-product-catalog');
        ?>
</h3>
			<div class="al-box info"><p><?php 
        _e("Changing design schemes has almost always impact on various elements. For example changing price color has impact on single product page and archive page price color.", 'ecommerce-product-catalog');
        ?>
</p><p><?php 
        _e('You can figure it out by checking "impact" column.', 'ecommerce-product-catalog');
        ?>
</p></div>
			<table style="clear:right" class="wp-list-table widefat product-settings-table">
				<thead><tr>
						<th><strong><?php 
        _e('Setting', 'ecommerce-product-catalog');
        ?>
</strong></th>
						<th><strong><?php 
        _e('Value', 'ecommerce-product-catalog');
        ?>
</strong></th>
						<th><strong><?php 
        _e('Example Effect', 'ecommerce-product-catalog');
        ?>
</strong></th>
						<th><strong><?php 
        _e('Impact', 'ecommerce-product-catalog');
        ?>
</strong></th>
					</tr></thead>
				<tbody>
					<tr>
						<td><label for="design_schemes[price-size]"><?php 
        _e('Price Size', 'ecommerce-product-catalog');
        ?>
</label></td>
						<td><select id="single_price" name="design_schemes[price-size]">
								<option name="design_schemes[big-price]" value="big-price"<?php 
        selected('big-price', $design_schemes['price-size']);
        ?>
><?php 
        _e('Big', 'ecommerce-product-catalog');
        ?>
</option>
								<option name="design_schemes[small-price]" value="small-price"<?php 
        selected('small-price', $design_schemes['price-size']);
        ?>
><?php 
        _e('Small', 'ecommerce-product-catalog');
        ?>
</option>
							</select></td>
						<td rowspan=2 class="price-value example <?php 
        design_schemes();
        ?>
"><?php 
        do_action('example_price');
        ?>
</td>
						<td><?php 
        _e('single product', 'ecommerce-product-catalog');
        ?>
</td>
					</tr>
					<tr>
						<td><?php 
        _e('Price Color', 'ecommerce-product-catalog');
        ?>
</td>
						<td>
							<select id="single_price" name="design_schemes[price-color]">
								<option name="design_schemes[red-price]" value="red-price"<?php 
        selected('red-price', $design_schemes['price-color']);
        ?>
><?php 
        _e('Red', 'ecommerce-product-catalog');
        ?>
</option>
								<option name="design_schemes[orange-price]" value="orange-price"<?php 
        selected('orange-price', $design_schemes['price-color']);
        ?>
><?php 
        _e('Orange', 'ecommerce-product-catalog');
        ?>
</option>
								<option name="design_schemes[green-price]" value="green-price"<?php 
        selected('green-price', $design_schemes['price-color']);
        ?>
><?php 
        _e('Green', 'ecommerce-product-catalog');
        ?>
</option>
								<option name="design_schemes[blue-price]" value="blue-price"<?php 
        selected('blue-price', $design_schemes['price-color']);
        ?>
><?php 
        _e('Blue', 'ecommerce-product-catalog');
        ?>
</option>
								<option name="design_schemes[grey-price]" value="grey-price"<?php 
        selected('grey-price', $design_schemes['price-color']);
        ?>
><?php 
        _e('Grey', 'ecommerce-product-catalog');
        ?>
</option>
							</select>
						</td>
						<td><?php 
        _e('single product', 'ecommerce-product-catalog');
        ?>
, <?php 
        _e('product archive', 'ecommerce-product-catalog');
        ?>
</td>
					</tr>
					<tr>
						<td><?php 
        _e('Boxes Color', 'ecommerce-product-catalog');
        ?>
</td>
						<td>
							<select id="box_schemes" name="design_schemes[box-color]">
								<option name="design_schemes[red-box]" value="red-box"<?php 
        selected('red-box', $design_schemes['box-color']);
        ?>
><?php 
        _e('Red', 'ecommerce-product-catalog');
        ?>
</option>
								<option name="design_schemes[orange-box]" value="orange-box"<?php 
        selected('orange-box', $design_schemes['box-color']);
        ?>
><?php 
        _e('Orange', 'ecommerce-product-catalog');
        ?>
</option>
								<option name="design_schemes[green-box]" value="green-box"<?php 
        selected('green-box', $design_schemes['box-color']);
        ?>
><?php 
        _e('Green', 'ecommerce-product-catalog');
        ?>
</option>
								<option name="design_schemes[blue-box]" value="blue-box"<?php 
        selected('blue-box', $design_schemes['box-color']);
        ?>
><?php 
        _e('Blue', 'ecommerce-product-catalog');
        ?>
</option>
								<option name="design_schemes[grey-box]" value="grey-box"<?php 
        selected('grey-box', $design_schemes['box-color']);
        ?>
><?php 
        _e('Grey', 'ecommerce-product-catalog');
        ?>
</option>
							</select>
						</td>
						<td><div class="product-name example <?php 
        design_schemes('box');
        ?>
">Exclusive Red Lamp</div></td>
						<td><?php 
        _e('product archive title', 'ecommerce-product-catalog');
        ?>
, <?php 
        _e('archive pagination', 'ecommerce-product-catalog');
        ?>
</td>
					</tr>
				</tbody>
			</table>
			<?php 
        do_action('color_schemes_settings');
        ?>
			<p class="submit">
				<input type="submit" class="button-primary" value="<?php 
        _e('Save changes', 'ecommerce-product-catalog');
        ?>
" />
			</p>
		</form>
		<?php 
    }
}
Пример #4
0
/**
 * Shows default product sort bar content
 *
 */
function show_default_product_sort_bar($archive_template, $multiple_settings = null)
{
    if (get_option('old_sort_bar') == 1) {
        show_product_order_dropdown($archive_template, $multiple_settings = null);
    } else {
        if (current_user_can('edit_theme_options')) {
            $show = get_option('hide_empty_bar_message', 0);
            if ($show == 0) {
                global $is_filter_bar;
                $is_filter_bar = true;
                echo '<div class="product-sort-bar ' . design_schemes('box', 0) . '">';
                echo '<div class="empty-filters-info">';
                echo '<h3>' . __('Product Filters Bar has no widgets', 'ecommerce-product-catalog') . '</h3>';
                $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                $customize_url = add_query_arg(array('url' => urlencode($current_url), urlencode('autofocus[panel]') => 'widgets'), wp_customize_url());
                echo sprintf(__('Add widgets to the filters bar %snow%s or %sdismiss this notice%s.', 'ecommerce-product-catalog'), '<a href="' . $customize_url . '">', '</a>', '<a class="dismiss-empty-bar" href="#">', '</a>');
                echo '</div>';
                echo '</div>';
                unset($is_filter_bar);
            }
        }
    }
}
/**
 * Returns modern grid element for a given product category
 *
 * @param object $product_cat Product category object
 * @param string $archive_template
 * @return string
 */
function get_default_category_theme($product_cat, $archive_template)
{
    $thumbnail_product = wp_get_attachment_image_src(get_product_category_image_id($product_cat->term_id), 'modern-grid-listing');
    $img_class = '';
    if ($thumbnail_product) {
        $url = $thumbnail_product[0];
        $ratio = $thumbnail_product[1] / $thumbnail_product[2];
        if ($ratio <= 1.35) {
            $img_class = ' class="higher"';
        }
    } else {
        $url = default_product_thumbnail_url();
    }
    //$modern_grid_settings	 = get_modern_grid_settings();
    $return = '<div class="al_archive modern-grid-element ' . product_listing_size_class($thumbnail_product) . '">';
    //$return .= '<a class="pseudo-a" href="' . get_term_link($product_cat) . '"></a>';
    $return .= '<div class="pseudo"></div>';
    $return .= '<a href="' . get_term_link($product_cat) . '"><img' . $img_class . ' src="' . $url . '" alt="' . $product_cat->name . '">';
    $return .= '<h3 class="product-name ' . design_schemes('box', 0) . '">' . $product_cat->name . '</h3></a>';
    $return .= '</div>';
    return $return;
}
Пример #6
0
function set_archive_price($archive_price, $post)
{
    $price_value = product_price($post->ID);
    if (!empty($price_value)) {
        $archive_price = '<span class="product-price ' . design_schemes('color', 0) . '">';
        $archive_price .= price_format($price_value);
        $archive_price .= '</span>';
    }
    return $archive_price;
}
Пример #7
0
 *
 * @version		1.1.2
 * @package		ecommerce-product-catalog/templates/template-parts/product-page
 * @author 		Norbert Dreszer
 */
$product_id = ic_get_product_id();
$single_names = get_single_names();
$price = price_format(product_price($product_id));
if (!empty($price)) {
    ?>
	<table class="price-table">
		<tr>
			<td class="price-label"><?php 
    echo $single_names['product_price'];
    ?>
</td>
			<td class="price-value <?php 
    design_schemes();
    ?>
"><?php 
    echo $price;
    ?>
</td>
		</tr>
		<?php 
    do_action('price_table');
    ?>
	</table>
	<?php 
    do_action('after_price_table');
}
Пример #8
0
/**
 * Returns modern grid element for a given product category
 *
 * @param object $product_cat Product category object
 * @param string $archive_template
 * @return string
 */
function get_default_category_theme($product_cat, $archive_template)
{
    $image_id = get_product_category_image_id($product_cat->term_id);
    $thumbnail_product = wp_get_attachment_image_src($image_id, 'modern-grid-listing');
    if ($thumbnail_product) {
        $img_class['alt'] = $product_cat->name;
        $img_class['class'] = 'modern-grid-image';
        $url = $thumbnail_product[0];
        if (!empty($thumbnail_product[2])) {
            $ratio = $thumbnail_product[1] / $thumbnail_product[2];
            if ($ratio <= 1.35) {
                $img_class['class'] .= ' higher';
            }
        }
        $image = wp_get_attachment_image($image_id, 'modern-grid-listing', false, $img_class);
    } else {
        $url = default_product_thumbnail_url();
        $image = '<img class="modern-grid-image" src="' . $url . '" alt="' . $product_cat->name . '">';
    }
    //$modern_grid_settings	 = get_modern_grid_settings();
    $return = '<div class="al_archive category-' . $product_cat->term_id . ' modern-grid-element ' . design_schemes('box', 0) . ' ' . product_listing_size_class($thumbnail_product) . '">';
    //$return .= '<a class="pseudo-a" href="' . get_term_link($product_cat) . '"></a>';
    $return .= '<div class="pseudo"></div>';
    $return .= '<a href="' . get_term_link($product_cat) . '">' . $image;
    $return .= '<h3 class="product-name ' . design_schemes('box', 0) . '">' . $product_cat->name . '</h3></a>';
    $return .= '</div>';
    return $return;
}