';
}
/**
* Remax Store quick view wrapper end
*
* @access public
* @return void
* @since 1.0.0
*/
function remax_store_yith_product_image_wrap_close () {
echo '';
}
/**
* WooCommerce setup function.
*
* @link https://docs.woocommerce.com/document/third-party-custom-theme-compatibility/
* @link https://github.com/woocommerce/woocommerce/wiki/Enabling-product-gallery-features-(zoom,-swipe,-lightbox)-in-3.0.0
*
* @access public
* @return void
* @since 1.0.0
*/
function remax_store_woocommerce_setup() {
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
/**
* WooCommerce specific scripts & stylesheets.
*
* @access public
* @return void
* @since 1.0.0
*/
function remax_store_woocommerce_scripts() {
wp_enqueue_style( 'remax-store-woocommerce-style', REMAX_STORE_THEME_URI . 'woocommerce.css' );
$font_path = WC()->plugin_url() . '/assets/fonts/';
$inline_font = '@font-face {
font-family: "star";
src: url("' . $font_path . 'star.eot");
src: url("' . $font_path . 'star.eot?#iefix") format("embedded-opentype"),
url("' . $font_path . 'star.woff") format("woff"),
url("' . $font_path . 'star.ttf") format("truetype"),
url("' . $font_path . 'star.svg#star") format("svg");
font-weight: normal;
font-style: normal;
}';
wp_add_inline_style( 'remax-store-woocommerce-style', $inline_font );
}
/**
* Add 'woocommerce-active' class to the body tag.
*
* @access public
* @param array $classes CSS classes applied to the body tag.
* @return array $classes modified to include 'woocommerce-active' class.
* @since 1.0.0
*/
function remax_store_woocommerce_active_body_class( $classes ) {
$classes[] = 'woocommerce-active';
return $classes;
}
/**
* Products per page.
*
* @access public
* @return integer number of products.
* @since 1.0.0
*/
function remax_store_woocommerce_products_per_page() {
$remax_store_woocommerce_products_per_page = get_theme_mod('remax_store_woocommerce_products_per_page',12);
return $remax_store_woocommerce_products_per_page;
}
/**
* Product gallery thumnbail columns.
*
* @access public
* @return integer number of columns.
* @since 1.0.0
*/
function remax_store_woocommerce_thumbnail_columns() {
return 4;
}
/**
* Default loop columns on product archives.
*
* @access public
* @return integer products per row.
* @since 1.0.0
*/
function remax_store_woocommerce_loop_columns() {
$remax_store_woocommerce_products_per_page = get_theme_mod('remax_store_woocommerce_loop_columns',3);
return $remax_store_woocommerce_products_per_page;
}
/**
* Related Products Args.
*
* @access public
* @param array $args related products args.
* @return array $args related products args.
* @since 1.0.0
*/
function remax_store_woocommerce_related_products_args( $args ) {
$relate_products_count = get_theme_mod('remax_store_woocommerce_related_products_posts_per_page',3);
$relate_products_column = get_theme_mod('remax_store_woocommerce_related_products_columns',3);
$defaults = array(
'posts_per_page' => $relate_products_count,
'columns' => $relate_products_column,
);
$args = wp_parse_args( $defaults, $args );
return $args;
}
/**
* Product columns wrapper.
*
* @access public
* @return void
* @since 1.0.0
*/
function remax_store_woocommerce_product_columns_wrapper() {
$columns = $this->remax_store_woocommerce_loop_columns();
echo '
';
}
/**
* Product columns wrapper close.
*
* @access public
* @return void
* @since 1.0.0
*/
function remax_store_woocommerce_product_columns_wrapper_close() {
echo '
';
}
/**
* Before Content.
*
* Wraps all WooCommerce content in wrappers which match the theme markup.
*
* @access public
* @return void
* @since 1.0.0
*/
function remax_store_woocommerce_wrapper_before() {
?>
remax_store_woocommerce_cart_link();
$fragments['a.cart-contents'] = ob_get_clean();
return $fragments;
}
/**
* Cart Link.
*
* Displayed a link to the cart including the number of items present and the cart total.
*
* @access public
* @return void
* @since 1.0.0
*/
function remax_store_woocommerce_cart_link() {
?>
cart->get_cart_contents_count()
);
?>
is_on_sale() ) {
if ( ! $product->is_type( 'variable' ) and $product->get_regular_price() and $product->get_sale_price() ) {
$max_percentage = ( ( $product->get_regular_price() - $product->get_sale_price() ) / $product->get_regular_price() ) * 100;
} else {
$max_percentage = 0;
foreach ( $product->get_children() as $child_id ) {
$variation = wc_get_product( $child_id );
$price = $variation->get_regular_price();
$sale = $variation->get_sale_price();
$percentage = '';
if ( $price != 0 && ! empty( $sale ) ) $percentage = ( $price - $sale ) / $price * 100;
if ( $percentage > $max_percentage ) {
$max_percentage = $percentage;
}
}
}
/**
* Return the woocommerce percentage
*/
echo "-" . esc_html( round($max_percentage) ) . "%
";
}
}
/**
* Woocommerce Wishlist Section
*
* @access public
* @return void
* @since 1.0.0
*/
function remax_store_woocommerce_top_wishlist() {
if (!defined( 'YITH_WCWL' )) return;
?>
get_average_rating();
?>
';
}
else{
echo '';
}
}
?>
';
}
/**
* Remax Store Wishlist products
*
* @access public
* @return void
* @since 1.0.0
*/
public function remax_store_wishlist_products() {
if ( !defined( 'YITH_WCWL' )) return;
global $product;
$url = add_query_arg( 'add_to_wishlist', $product->get_id() );
$id = $product->get_id();
$wishlist_url = YITH_WCWL()->get_wishlist_url();
?>
get_id();
$product_id = isset( $productid ) ? $productid : 0;
}
$is_button = ! isset( $button_or_link ) || ! $button_or_link ? get_option( 'yith_woocompare_is_button' ) : $button_or_link;
if ( ! isset( $button_text ) || $button_text == 'default' ) {
$button_text = get_option( 'yith_woocompare_button_text', esc_html__( 'Compare', 'remax-store' ) );
yit_wpml_register_string( 'Plugins', 'plugin_yit_compare_button_text', $button_text );
$button_text = yit_wpml_string_translate( 'Plugins', 'plugin_yit_compare_button_text', $button_text );
}
printf( '', '#', 'compare', intval($product_id));
}
/**
* Remax_Store Woocommerce products templates
*
* @access public
* @return void
* @since 1.0.0
*/
function remax_store_woocommerce_before_shop_loop_item(){
?>
remax_store_add_compare_link();
$this->remax_store_wishlist_products();
$this->remax_store_woo_product_quickview();
?>
remax_store_woo_get_star_rating(); ?>
'product',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => $remax_store_tab_category_id // get the products id
),
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'exclude-from-catalog',
'operator' => 'NOT IN'
)
),
'posts_per_page' => $remax_store_tab_product_count
);
$query = new WP_Query( $product_args );
if($query->have_posts()) { while($query->have_posts()) { $query->the_post();
echo '
';
echo wc_get_template_part( 'content', 'product' );
echo '
';
}
}else{
/**
* not have a products then dispaly images
*
* @since 1.0.0
*/
for ($x = 1; $x <= 8; $x++) {
echo '
';
remax_store_default_products();
echo '
';
}
}
wp_reset_postdata();
?>
' / ',
'wrap_before' => '',
'before' => '',
'after' => '',
'home' => _x( 'Home', 'breadcrumb', 'remax-store' ),
);
}
}
/**
* Woocommerce this off by calling 'get_instance()' method
*/
Remax_Store_Woocommerce::get_instance();