/**
 * Replace a page title with the endpoint title.
 * @param  string $title
 * @return string
 */
function wc_page_endpoint_title($title)
{
    global $wp_query;
    if (!is_null($wp_query) && !is_admin() && is_main_query() && in_the_loop() && is_page() && is_wc_endpoint_url()) {
        $endpoint = WC()->query->get_current_endpoint();
        if ($endpoint_title = WC()->query->get_endpoint_title($endpoint)) {
            $title = $endpoint_title;
        }
        remove_filter('the_title', 'wc_page_endpoint_title');
    }
    return $title;
}
Exemple #2
0
/**
 * Replace a page title with the endpoint title
 * @param  string $title
 * @return string
 */
function wc_page_endpoint_title($title)
{
    if (is_main_query() && in_the_loop() && is_page() && is_wc_endpoint_url()) {
        $endpoint = WC()->query->get_current_endpoint();
        if ($endpoint_title = WC()->query->get_endpoint_title($endpoint)) {
            $title = $endpoint_title;
        }
    }
    return $title;
}
 public function set_order_email_filters($product)
 {
     if (is_wc_endpoint_url()) {
         return $product;
     }
     // Add order item name actions
     add_action('woocommerce_order_item_name', 'wc_gzd_cart_product_delivery_time', wc_gzd_get_hook_priority('email_product_delivery_time'), 2);
     add_action('woocommerce_order_item_name', 'wc_gzd_cart_product_item_desc', wc_gzd_get_hook_priority('email_product_item_desc'), 2);
     add_filter('woocommerce_order_formatted_line_subtotal', 'wc_gzd_cart_product_unit_price', wc_gzd_get_hook_priority('email_product_unit_price'), 2);
     return $product;
 }
 public function wc_page_endpoint_title($title = '', $id = '')
 {
     if (is_page($id)) {
         global $wp_query;
         if (!is_null($wp_query) && !is_admin() && is_main_query() && in_the_loop() && is_page() && is_wc_endpoint_url()) {
             $endpoint = WC()->query->get_current_endpoint();
             if ('order-received' == $endpoint) {
                 $order_id = $wp_query->query['order-received'];
                 if (WC_QD()->db()->_is_donation($order_id)) {
                     $title = 'Donation Received';
                 }
             }
             if ('view-order' == $endpoint) {
                 $order_id = $wp_query->query['view-order'];
                 if (WC_QD()->db()->_is_donation($order_id)) {
                     $title = 'Donation #' . $order_id;
                     remove_filter('the_title', 'wc_page_endpoint_title');
                 }
             }
         }
     }
     return $title;
 }
Exemple #5
0
function avada_woocommerce_before_my_account($order_count, $edit_address = false)
{
    global $woocommerce;
    $edit_address = is_wc_endpoint_url('edit-address');
    avada_top_user_container();
    ?>

	<ul class="woocommerce-side-nav avada-myaccount-nav">
		<?php 
    if ($downloads = WC()->customer->get_downloadable_products()) {
        ?>
			<li <?php 
        if (!$edit_address) {
            echo 'class="active"';
        }
        ?>
>
				<a class="downloads" href="#">
					<?php 
        _e('View Downloads', 'Avada');
        ?>
				</a>
			</li>
		<?php 
    }
    if (function_exists('wc_get_order_types') && function_exists('wc_get_order_statuses')) {
        $customer_orders = get_posts(apply_filters('woocommerce_my_account_my_orders_query', array('numberposts' => $order_count, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => wc_get_order_types('view-orders'), 'post_status' => array_keys(wc_get_order_statuses()))));
    } else {
        $customer_orders = get_posts(apply_filters('woocommerce_my_account_my_orders_query', array('numberposts' => $order_count, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => 'shop_order', 'post_status' => 'publish')));
    }
    if ($customer_orders) {
        ?>
				<li <?php 
        if (!$edit_address && !WC()->customer->get_downloadable_products()) {
            echo 'class="active"';
        }
        ?>
>
					<a class="orders" href="#">
						<?php 
        _e('View Orders', 'Avada');
        ?>
					</a>
				</li>
			<?php 
    }
    ?>
		<li <?php 
    if ($edit_address || !WC()->customer->get_downloadable_products() && !$customer_orders) {
        echo 'class="active"';
    }
    ?>
>
			<a class="address" href="#">
				<?php 
    _e('Change Address', 'Avada');
    ?>
			</a>
		</li>
		<li>
			<a class="account" href="#">
				<?php 
    _e('Edit Account', 'Avada');
    ?>
			</a>
		</li>
	</ul>

<div class="woocommerce-content-box avada-myaccount-data">

<?php 
}
Exemple #6
0
function avada_woocommerce_before_my_account($order_count, $edit_address = false)
{
    global $smof_data, $woocommerce, $current_user;
    $edit_address = is_wc_endpoint_url('edit-address');
    ?>
	<p class="avada_myaccount_user">
		<span class="myaccount_user_container">
			<span class="username">
			<?php 
    printf(__('Hello, %s:', 'Avada'), $current_user->display_name);
    ?>
			</span>
			<?php 
    if ($smof_data['woo_acc_msg_1']) {
        ?>
			<span class="msg">
				<?php 
        echo $smof_data['woo_acc_msg_1'];
        ?>
			</span>
			<?php 
    }
    ?>
			<?php 
    if ($smof_data['woo_acc_msg_2']) {
        ?>
			<span class="msg">
				<?php 
        echo $smof_data['woo_acc_msg_2'];
        ?>
			</span>
			<?php 
    }
    ?>
			<span class="view-cart">
				<a href="<?php 
    echo get_permalink(get_option('woocommerce_cart_page_id'));
    ?>
"><?php 
    _e('View Cart', 'Avada');
    ?>
</a>
			</span>
		</span>
	</p>

	<ul class="woocommerce-side-nav avada-myaccount-nav">
		<?php 
    if ($downloads = WC()->customer->get_downloadable_products()) {
        ?>
		<li <?php 
        if (!$edit_address) {
            echo 'class="active"';
        }
        ?>
>
			<a class="downloads" href="#">
				<?php 
        _e('View Downloads', 'Avada');
        ?>
			</a>
		</li>
		<?php 
    }
    if (function_exists('wc_get_order_types') && function_exists('wc_get_order_statuses')) {
        $customer_orders = get_posts(apply_filters('woocommerce_my_account_my_orders_query', array('numberposts' => $order_count, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => wc_get_order_types('view-orders'), 'post_status' => array_keys(wc_get_order_statuses()))));
    } else {
        $customer_orders = get_posts(apply_filters('woocommerce_my_account_my_orders_query', array('numberposts' => $order_count, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => 'shop_order', 'post_status' => 'publish')));
    }
    if ($customer_orders) {
        ?>
		<li <?php 
        if (!$edit_address && !WC()->customer->get_downloadable_products()) {
            echo 'class="active"';
        }
        ?>
>
			<a class="orders" href="#">
				<?php 
        _e('View Orders', 'Avada');
        ?>
			</a>
		</li>
		<?php 
    }
    ?>
		<li <?php 
    if ($edit_address || !WC()->customer->get_downloadable_products() && !$customer_orders) {
        echo 'class="active"';
    }
    ?>
>
			<a class="address" href="#">
				<?php 
    _e('Change Address', 'Avada');
    ?>
			</a>
		</li>
		<li>
			<a class="account" href="#">
				<?php 
    _e('Edit Account', 'Avada');
    ?>
			</a>
		</li>
	</ul>

	<div class="woocommerce-content-box avada-myaccount-data">

	<?php 
}
 /**
  * Endpoints
  */
 private function endpoint_trail()
 {
     // Is an endpoint showing?
     if (is_wc_endpoint_url() && ($endpoint = WC()->query->get_current_endpoint()) && ($endpoint_title = WC()->query->get_endpoint_title($endpoint))) {
         $this->add_crumb($endpoint_title);
     }
 }
 public function load_scripts()
 {
     if (is_cart() || is_checkout() || is_wc_endpoint_url('edit-address')) {
         $city_select_path = $this->get_plugin_url() . 'assets/js/city-select.js';
         wp_enqueue_script('wc-city-select', $city_select_path, array('jquery', 'woocommerce'), self::VERSION, true);
         $cities = json_encode($this->get_cities());
         wp_localize_script('wc-city-select', 'wc_city_select_params', array('cities' => $cities, 'i18n_select_city_text' => esc_attr__('Select an option&hellip;', 'woocommerce')));
     }
 }
			
<?php 
}
// end of the loop.
?>
	





</div><!-- end #content large-12 -->
</div><!-- end row -->
</div><!-- end page-right-sidebar container -->

<?php 
if (is_wc_endpoint_url('order-received')) {
    ?>
	<!-- Thank you page scripts -->
	<?php 
    if (isset($flatsome_opt['html_thank_you'])) {
        echo do_shortcode($flatsome_opt['html_thank_you']);
    }
    ?>
	
<?php 
}
?>

<?php 
get_footer();
 /**
  * Load JS & CSS FrontEnd
  *
  * @access public
  * @return void
  * @since 8.0.0
  */
 public function load_scripts()
 {
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $assets_path = str_replace(array('http:', 'https:'), '', WC()->plugin_url()) . '/assets/';
     // select2
     $select2_js_path = $assets_path . 'js/select2/select2' . $suffix . '.js';
     $select2_css_path = $assets_path . 'css/select2.css';
     if (!wp_script_is('select2', 'registered')) {
         wp_register_script('select2', $select2_js_path, array('jquery'), '3.5.2');
     }
     if (!wp_style_is('select2', 'registered')) {
         wp_register_style('select2', $select2_css_path);
     }
     // chosen
     $chosen_js_path = $assets_path . 'js/chosen/chosen.jquery' . $suffix . '.js';
     $chosen_css_path = $assets_path . 'css/chosen.css';
     if (!wp_script_is('chosen', 'registered')) {
         wp_register_script('chosen', $chosen_js_path, array('jquery'), '1.0.0', true);
     }
     if (!wp_style_is('chosen', 'registered')) {
         wp_enqueue_style('woocommerce_chosen_styles', $chosen_css_path);
     }
     wp_register_script('woocommerce-jne-shipping', $this->plugin_url() . '/assets/js/shipping' . $suffix . '.js', array('jquery'), '1.0.12', true);
     wp_register_script('woocommerce-jne-cekongkir', $this->plugin_url() . '/assets/js/cekongkir' . $suffix . '.js', array('jquery'), '1.0.12', true);
     wp_register_style('woocommerce-jne-cekongkir', $this->plugin_url() . '/assets/css/cekongkir.css');
     wp_register_style('woocommerce-jne-tracking-widget', $this->plugin_url() . '/assets/css/tracking.widget.css');
     // shipping
     if ($this->shipping->is_enable()) {
         if (is_checkout() || is_cart() || is_wc_endpoint_url('edit-address')) {
             wp_enqueue_script('woocommerce-jne-shipping');
             wp_localize_script('woocommerce-jne-shipping', 'agenwebsite_woocommerce_jne_params', $this->localize_script('shipping'));
         }
     }
     // cek ongkir
     if (is_product() && $this->shipping->cek_ongkir->tab_is_enable() || is_active_widget(false, false, 'jne_cekongkir_widget', true) || $this->is_active_shortcode('jne_cek_ongkir')) {
         wp_enqueue_style('woocommerce-jne-cekongkir');
         wp_enqueue_script('woocommerce-jne-cekongkir');
         wp_localize_script('woocommerce-jne-cekongkir', 'agenwebsite_woocommerce_jne_cekongkir_params', $this->localize_script('cekongkir'));
     }
     // load selec2 or chosen
     if ($this->shipping->is_enable() && is_cart() || is_product() && $this->shipping->cek_ongkir->tab_is_enable() || is_active_widget(false, false, 'jne_cekongkir_widget', true) || $this->is_active_shortcode('jne_cek_ongkir')) {
         if (!wp_script_is('select2')) {
             wp_enqueue_script('select2');
         }
         if (!wp_style_is('select2')) {
             wp_enqueue_style('select2');
         }
         if (!wp_script_is('chosen')) {
             wp_enqueue_script('chosen');
         }
         if (!wp_style_is('chosen')) {
             wp_enqueue_style('chosen');
         }
     }
 }
Exemple #11
0
     * @hooked storefront_display_comments - 10
     */
    do_action('storefront_page_after');
    ?>

							<?php 
}
// end of the loop.
?>

						</div>
					<!-- Content column end -->

					<!-- Sidebar column start -->
					<?php 
if (function_exists('is_cart') && is_cart() || function_exists('is_checkout') && is_checkout() || function_exists('is_wc_endpoint_url') && is_wc_endpoint_url('lost-password') || function_exists('is_account_page') && is_account_page()) {
    ?>
					<?php 
} else {
    ?>
						<div class="col-sm-4 col-md-3 col-md-offset-1 sidebar">

							<?php 
    do_action('shop_isle_sidebar');
    ?>

						</div>
					<?php 
}
?>
	
Exemple #12
0
 public static function is_wc_endpoint_url($endpoint = false)
 {
     return self::exists() && is_wc_endpoint_url($endpoint);
 }
 /**
  * Load JS & CSS FrontEnd
  *
  * @access public
  * @return void
  * @since 8.0.0
  */
 public function load_scripts()
 {
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $assets_path = str_replace(array('http:', 'https:'), '', WC()->plugin_url()) . '/assets/';
     // select2
     $select2_js_path = $assets_path . 'js/select2/select2' . $suffix . '.js';
     $select2_css_path = $assets_path . 'css/select2.css';
     if (!wp_script_is('select2', 'registered')) {
         wp_register_script('select2', $select2_js_path, array('jquery'), '3.5.2');
     }
     if (!wp_style_is('select2', 'registered')) {
         wp_register_style('select2', $select2_css_path);
     }
     // chosen
     $chosen_js_path = $assets_path . 'js/chosen/chosen.jquery' . $suffix . '.js';
     $chosen_css_path = $assets_path . 'css/chosen.css';
     if (!wp_script_is('chosen', 'registered')) {
         wp_register_script('chosen', $chosen_js_path, array('jquery'), '1.0.0', true);
     }
     if (!wp_style_is('chosen', 'registered')) {
         wp_enqueue_style('woocommerce_chosen_styles', $chosen_css_path);
     }
     wp_register_script('woocommerce-jne-shipping', $this->plugin_url() . '/assets/js/shipping' . $suffix . '.js', array('jquery'), '1.0.12', true);
     // shipping
     if ($this->shipping->is_enable()) {
         if (is_checkout() || is_wc_endpoint_url('edit-address')) {
             wp_enqueue_script('woocommerce-jne-shipping');
             wp_localize_script('woocommerce-jne-shipping', 'agenwebsite_woocommerce_jne_params', $this->localize_script('shipping'));
         }
     }
 }
Exemple #14
0
<?php

if (function_exists('is_woocommerce') && (is_account_page() || is_shop() || is_product_taxonomy() || is_product() || is_cart() || is_checkout() || is_checkout_pay_page() || is_order_received_page() || is_wc_endpoint_url('order-pay') || is_wc_endpoint_url('order-received') || is_wc_endpoint_url('view-order') || is_wc_endpoint_url('edit-account') || is_wc_endpoint_url('edit-address') || is_wc_endpoint_url('lost-password') || is_wc_endpoint_url('customer-logout') || is_wc_endpoint_url('add-payment-method'))) {
    get_template_part('template/template-nowrap');
} else {
    get_template_part('template/template-page-normal');
}
Exemple #15
0
 /**
  * Add new Title to Lost Password page for customers who have been created through Add Customer on Order
  */
 public function woocommerce_new_customer_change_title($page_title)
 {
     global $woocommerce;
     $is_lost_pass_page = false;
     // Check if is lost pass page
     if (function_exists('wc_get_endpoint_url')) {
         // Above WC 2.1
         if (is_wc_endpoint_url('lost-password')) {
             $is_lost_pass_page = true;
         }
     } else {
         if (is_page(woocommerce_get_page_id('lost_password'))) {
             $is_lost_pass_page = true;
         }
     }
     // Only do this is is lost pass page, and that we have a login to check against
     if ($is_lost_pass_page && isset($_GET['login'])) {
         $email_address = esc_attr($_GET['login']);
         $user = get_user_by("login", $email_address);
         $password_not_changed = get_user_meta($user->ID, "create_customer_on_order_password", true);
         if ($password_not_changed) {
             $page_title = __('Create your Password', 'create-customer-order');
         }
     }
     return $page_title;
 }
/**
 * Add body classes for WC pages.
 *
 * @param  array $classes
 * @return array
 */
function wc_body_class($classes)
{
    $classes = (array) $classes;
    if (is_woocommerce()) {
        $classes[] = 'woocommerce';
        $classes[] = 'woocommerce-page';
    } elseif (is_checkout()) {
        $classes[] = 'woocommerce-checkout';
        $classes[] = 'woocommerce-page';
    } elseif (is_cart()) {
        $classes[] = 'woocommerce-cart';
        $classes[] = 'woocommerce-page';
    } elseif (is_account_page()) {
        $classes[] = 'woocommerce-account';
        $classes[] = 'woocommerce-page';
    }
    if (is_store_notice_showing()) {
        $classes[] = 'woocommerce-demo-store';
    }
    foreach (WC()->query->query_vars as $key => $value) {
        if (is_wc_endpoint_url($key)) {
            $classes[] = 'woocommerce-' . sanitize_html_class($key);
        }
    }
    return array_unique($classes);
}
Exemple #17
0
function igthemes_after_content_sidebar()
{
    ?>
    <?php 
    if (!is_page_template('page-sidebar-left.php') && !is_page_template('page-fullwidth.php')) {
        if (class_exists('WooCommerce') && is_woocommerce() || class_exists('WooCommerce') && is_cart() || class_exists('WooCommerce') && is_checkout() || class_exists('WooCommerce') && is_account_page() || class_exists('WooCommerce') && is_wc_endpoint_url()) {
            get_sidebar('shop');
        } else {
            get_sidebar();
        }
    }
}
Exemple #18
-1
function get_order_item_totals1( $tax_display = '' ) {
	if(is_wc_endpoint_url( 'order-received' ))
	{
		
		$order_id=wc_get_order_id_by_order_key( $_GET['key']);
		$order=new WC_Order($order_id);
		/*echo '<pre>';
		print_r($order);
		echo '</pre>';*/
		$coupons=$order->get_used_coupons();
		$coupon_code=$coupons[0];
		$coupon_data=new WC_Coupon($coupon_code);
		$discount = get_post_meta($coupon_data->id,'coupon_amount',true);
		$type = get_post_meta($coupon_data->id,'discount_type',true);
		
		if($type=='percent'){
			$coupon_label=$discount.'&#37; Rabatt';
		}
		else{
			$coupon_label='Rabatt';
		}
		if ( ! $tax_display ) {
			$tax_display = $order->tax_display_cart;
		}
		
		
		if ( 'itemized' == get_option( 'woocommerce_tax_total_display' ) ) {
			
			
			foreach ( $order->get_tax_totals() as $code => $tax ) {
				$tax->rate = WC_Tax::get_rate_percent( $tax->rate_id );
				
				if ( ! isset( $tax_array[ 'tax_rate'] ) )
					$tax_array[ 'tax_rate' ] = array( 'tax' => $tax, 'amount' => $tax->amount, 'contains' => array( $tax ) );
				else {
					array_push( $tax_array[ 'tax_rate' ][ 'contains' ], $tax );
					$tax_array[ 'tax_rate' ][ 'amount' ] += $tax->amount;
				}
			}
			if(isset($tax_array['tax_rate']['tax']->rate))
			$tax_label='<span class="include_tax">(inkl.&nbsp;'.$tax_array['tax_rate']['tax']->rate.'&nbsp;'.$tax_array['tax_rate']['tax']->label.')</span>';
		}
			
		$total_rows = array();
		
		$shippingcost='0 '.get_woocommerce_currency_symbol();
		
		if ( $order->get_total_discount() > 0 ) {
			$total_rows['discount'] = array(
				'label' => __( $coupon_label, 'woocommerce' ),
				'value'	=> '-' . $order->get_discount_to_display( $tax_display )
			);
		}

		
			$total_rows['shipping'] = array(
				'label' => __( 'Versandkosten', 'woocommerce' ),
				'value'	=>$shippingcost
			);
		

		$total_rows['order_total'] = array(
			'label' => __( 'Gesamtsumme '.$tax_label, 'woocommerce' ),
			'value'	=> $order->get_formatted_order_total( $tax_display )
		);

		return $total_rows;
	}
}