Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'woocommerce_after_shop_loop_item_title', 'wpgenie_add_bid_button',50 );
- function wpgenie_add_bid_button(){
- global $product, $post;
- if ( $product->get_type() !== 'auction' ){
- return;
- }
- if(($product->is_closed() === FALSE ) and ($product->is_started() === TRUE )) :
- do_action('woocommerce_before_bid_form'); ?>
- <form class="auction_form cart" method="post" enctype='multipart/form-data' data-product_id="<?php echo $product->get_id(); ?>">
- <?php do_action('woocommerce_before_bid_button'); ?>
- <input type="hidden" name="bid" value="<?php echo esc_attr( $product->get_id() ); ?>" />
- <?php if($product->auction_type == 'reverse' ) : ?>
- <div class="quantity buttons_added">
- <input type="button" value="+" class="plus" />
- <input type="number" name="bid_value" data-auction-id="<?php echo esc_attr( $product->get_id() ); ?>" value="<?php echo $product->bid_value() ?>" max="<?php echo $product->bid_value() ?>" step="any" size="<?php echo strlen($product->get_curent_bid())+2 ?>" title="bid" class="input-text qty bid text left">
- <input type="button" value="-" class="minus" />
- <button type="submit" class="bid_button button alt"><?php echo apply_filters('bid_text', __( 'Bid', 'wc_simple_auctions' ), $product->get_type()); ?></button>
- </div>
- <?php else : ?>
- <div class="quantity buttons_added">
- <input type="button" value="+" class="plus" />
- <input type="number" name="bid_value" data-auction-id="<?php echo esc_attr( $product->get_id()); ?>" value="<?php echo $product->bid_value() ?>" min="<?php echo $product->bid_value() ?>" step="any" size="<?php echo strlen($product->get_curent_bid())+2 ?>" title="bid" class="input-text qty bid text left">
- <input type="button" value="-" class="minus" />
- </div>
- <button type="submit" class="bid_button button alt"><?php echo apply_filters('bid_text', __( 'Bid', 'wc_simple_auctions' ), $product->get_type() ); ?></button>
- <?php endif; ?>
- <input type="hidden" name="place-bid" value="<?php echo $product->get_id(); ?>" />
- <input type="hidden" name="product_id" value="<?php echo esc_attr( $product->get_id()); ?>" />
- <?php if ( is_user_logged_in() ) { ?>
- <input type="hidden" name="user_id" value="<?php echo get_current_user_id(); ?>" />
- <?php } ?>
- <?php do_action('woocommerce_after_bid_button'); ?>
- </form>
- <?php do_action('woocommerce_after_bid_form');
- endif;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement