Skip to content

Commit

Permalink
update for 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohaiminulislam1989 committed Sep 4, 2016
1 parent 718e151 commit 4dc0d17
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 26 deletions.
10 changes: 7 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: sk.shaikat
Tags: WooCommerce upcoming product, upcoming product, e-commerce, coming soon product, commerce, WooCommerce, extension, product, new product
Donate link: https://www.paypal.me/skshaikat
Requires at least: 3.1
Tested up to: 4.5.2
Tested up to: 4.6
Stable tag: 1.3.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -47,11 +47,15 @@ and Enjoy... :)

== Change log ==

= 1.3.2 =
* [fix] Fix Show all product coming soon
* [fix] Fix not showing price

= 1.3.1 =
* [new] Add available time formate to default WordPress time format
* [new] Add available time formate to default WordPress time format
* [tweak] Add language file for dutch
* [fix] Fix warning date picker is not a function
* [tweak] Update donation link on readme.text
* [tweak] Update donation link on readme.text

= 1.3 =
* [new] Add Show / Hide option for available date both single and shop page
Expand Down
52 changes: 29 additions & 23 deletions woocommerce-upcoming-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Woocommerce upcoming Products
Plugin URI: http://shaikat.me/
Description: Manage your upcoming product easily. add upcoming label, remove add to cart button for the product, short by upcoming on shop page and set product available date.
Version: 1.3.1
Version: 1.3.2
Author: Sk Shaikat
Author URI: https://twitter.com/SK_Shaikat
License: GPL2
Expand Down Expand Up @@ -50,7 +50,7 @@ public function __construct()


// wup let's play option
add_action( 'woocommerce_loaded', array($this,'wup_play_ground' ) );
add_action( 'template_redirect', array($this,'wup_play_ground' ) );

// Add Discount and sales price optin in backend for addmin
add_action( 'woocommerce_product_options_pricing', array($this,'add_upcoming_options' ),10 );
Expand Down Expand Up @@ -152,20 +152,31 @@ public function admin_enqueue_scripts() {
wp_enqueue_script( 'upcoming-scripts', plugins_url( 'js/script.js', __FILE__ ), array('jquery' ), false, true );
}

function is_upcoming() {
global $post;
if ( get_post_meta( $post->id, '_upcoming', true ) == 'yes' ) {
return true;
} else {
return false;
}
}

function wup_play_ground()
{
if ( WC_Admin_Settings::get_option( 'wup_price_hide_single', 'no' ) == 'yes' ) {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
}
// if ( WC_Admin_Settings::get_option( 'wup_price_hide_shop', 'no' ) == 'yes' ) {
// remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
// }
if ( WC_Admin_Settings::get_option( 'wup_button_hide_single', 'no' ) == 'yes' ) {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
if ( $this->is_upcoming() ) {
if ( WC_Admin_Settings::get_option( 'wup_price_hide_single', 'no' ) == 'yes' ) {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
}
// if ( WC_Admin_Settings::get_option( 'wup_price_hide_shop', 'no' ) == 'yes' ) {
// remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
// }
if ( WC_Admin_Settings::get_option( 'wup_button_hide_single', 'no' ) == 'yes' ) {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
// if ( WC_Admin_Settings::get_option( 'wup_button_hide_shop', 'no' ) == 'yes' ) {
// remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
// }
}
// if ( WC_Admin_Settings::get_option( 'wup_button_hide_shop', 'no' ) == 'yes' ) {
// remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
// }
}

function add_upcoming_options()
Expand All @@ -189,11 +200,8 @@ function save_upcoming_options( $post_id )
function upcoming_product_title( $title, $id )
{
$label = WC_Admin_Settings::get_option( 'wup_title_label_txt', __( 'Upcoming', 'wup' ) );
$_upcoming = get_post_meta( $id, '_upcoming', true );
if ( WC_Admin_Settings::get_option( 'wup_title_label', 'yes' ) == 'yes' ) {
if ( $_upcoming == 'yes' ) {
$title .= ' <span class="soon">(' . $label . ')</span>';
}
if ( $this->is_upcoming() && WC_Admin_Settings::get_option( 'wup_title_label', 'yes' ) == 'yes' ) {
$title .= ' <span class="soon">(' . $label . ')</span>';
}
return $title;
}
Expand Down Expand Up @@ -224,7 +232,7 @@ function upcoming_custom_queary($q)
function custom_get_availability()
{
$price_label = WC_Admin_Settings::get_option( 'wup_price_label_txt', __( 'Coming Soon', 'wup' ) );
if ( WC_Admin_Settings::get_option( 'wup_price_label', 'yes' ) == 'yes' ) {
if ( $this->is_upcoming() && WC_Admin_Settings::get_option( 'wup_price_label', 'yes' ) == 'yes' ) {
echo '<div class="product_meta"><span class="wup-price-label">' . $price_label . '</span></div>';
}
}
Expand All @@ -233,9 +241,8 @@ function upcoming_single_page_view()
{
global $post;
if ( WC_Admin_Settings::get_option( 'wup_show_available_date_single', 'yes' ) == 'yes' ) {
$_upcoming = get_post_meta( $post->ID, '_upcoming', true );
$_available_on = get_post_meta( $post->ID, '_available_on', true );
if ( $_upcoming == 'yes') {
if ( $this->is_upcoming() ) {
?>
<div class="product_meta">
<span class="available-from">
Expand Down Expand Up @@ -266,9 +273,8 @@ function upcoming_shop_page_view()
{
global $post;
if ( WC_Admin_Settings::get_option( 'wup_show_available_date_shop', 'yes' ) == 'yes' ) {
$_upcoming = get_post_meta( $post->ID, '_upcoming', true );
$_available_on = get_post_meta( $post->ID, '_available_on', true );
if ( $_upcoming == 'yes') {
if ( $this->is_upcoming() ) {
?>
<div class="upcoming">
<?php _e( 'Available from: ', 'wup' );
Expand Down

0 comments on commit 4dc0d17

Please sign in to comment.