2012-11-21 18:07:45 +00:00
|
|
|
<?php
|
2013-02-20 17:14:46 +00:00
|
|
|
|
2014-09-20 18:55:53 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit; // Exit if accessed directly
|
|
|
|
}
|
2013-02-20 17:14:46 +00:00
|
|
|
|
2012-11-21 18:07:45 +00:00
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* External Product Class.
|
2012-11-21 18:07:45 +00:00
|
|
|
*
|
2012-11-29 16:48:40 +00:00
|
|
|
* External products cannot be bought; they link offsite. Extends simple products.
|
2012-11-21 18:07:45 +00:00
|
|
|
*
|
2012-11-22 10:22:18 +00:00
|
|
|
* @class WC_Product_External
|
2012-12-03 19:19:58 +00:00
|
|
|
* @version 2.0.0
|
2012-11-21 18:07:45 +00:00
|
|
|
* @package WooCommerce/Classes/Products
|
2013-02-20 17:14:46 +00:00
|
|
|
* @category Class
|
2012-11-21 18:07:45 +00:00
|
|
|
* @author WooThemes
|
|
|
|
*/
|
2013-02-13 09:29:00 +00:00
|
|
|
class WC_Product_External extends WC_Product {
|
2012-11-29 16:48:40 +00:00
|
|
|
|
2012-11-21 18:07:45 +00:00
|
|
|
/**
|
2016-10-17 11:22:23 +00:00
|
|
|
* Get internal type.
|
|
|
|
* @return string
|
2012-11-21 18:07:45 +00:00
|
|
|
*/
|
2016-10-17 11:22:23 +00:00
|
|
|
public function get_type() {
|
|
|
|
return 'external';
|
2012-11-21 18:07:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns false if the product cannot be bought.
|
|
|
|
*
|
|
|
|
* @access public
|
2014-03-21 21:41:32 +00:00
|
|
|
* @return bool
|
2012-11-21 18:07:45 +00:00
|
|
|
*/
|
2012-12-14 21:49:46 +00:00
|
|
|
public function is_purchasable() {
|
2012-11-21 18:07:45 +00:00
|
|
|
return apply_filters( 'woocommerce_is_purchasable', false, $this );
|
|
|
|
}
|
2012-11-29 16:48:40 +00:00
|
|
|
|
2013-09-25 11:35:06 +00:00
|
|
|
/**
|
|
|
|
* Get the add to url used mainly in loops.
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function add_to_cart_url() {
|
|
|
|
return apply_filters( 'woocommerce_product_add_to_cart_url', $this->get_product_url(), $this );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Get the add to cart button text for the single page.
|
2013-09-25 11:35:06 +00:00
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function single_add_to_cart_text() {
|
|
|
|
return apply_filters( 'woocommerce_product_single_add_to_cart_text', $this->get_button_text(), $this );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-11-03 13:31:20 +00:00
|
|
|
* Get the add to cart button text.
|
2013-09-25 11:35:06 +00:00
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function add_to_cart_text() {
|
|
|
|
return apply_filters( 'woocommerce_product_single_add_to_cart_text', $this->get_button_text(), $this );
|
|
|
|
}
|
|
|
|
|
2012-11-29 16:48:40 +00:00
|
|
|
/**
|
2016-01-06 15:11:50 +00:00
|
|
|
* Get product url.
|
2012-11-29 16:48:40 +00:00
|
|
|
*
|
|
|
|
* @access public
|
2013-11-27 18:20:31 +00:00
|
|
|
* @return string
|
2012-11-29 16:48:40 +00:00
|
|
|
*/
|
2012-12-14 21:49:46 +00:00
|
|
|
public function get_product_url() {
|
2013-09-25 11:35:06 +00:00
|
|
|
return esc_url( $this->product_url );
|
2012-11-29 16:48:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-01-06 15:11:50 +00:00
|
|
|
* Get button text.
|
2012-11-29 16:48:40 +00:00
|
|
|
*
|
|
|
|
* @access public
|
2013-11-27 18:20:31 +00:00
|
|
|
* @return string
|
2012-11-29 16:48:40 +00:00
|
|
|
*/
|
2012-12-14 21:49:46 +00:00
|
|
|
public function get_button_text() {
|
2012-11-29 16:48:40 +00:00
|
|
|
return $this->button_text ? $this->button_text : __( 'Buy product', 'woocommerce' );
|
|
|
|
}
|
2014-03-21 21:41:32 +00:00
|
|
|
}
|