
Yukardaki Woocommerce'nin bir kısmı yapmak istedim o kısmı çoğaltmak. Bu kısım satın al diyince başka bir siteye yönlendiriyor. Bende birden fazla sitelere yönlendirmek istiyorum. Örneğin Hızlı.com'dan Satın al Hepsiburada'dan Satın Al gibi.
Aşağıdaki bulduğum bağlantılı kodlar var bu kodlarla nasıl çoğaltabilirim bu kısmı.
do_action('woocommerce_product_options_sku');
echo '</div>';
echo '<div class="options_group show_if_external">';
// External URL
woocommerce_wp_text_input( array( 'id' => '_product_url', 'label' => __( 'Product URL', 'woocommerce' ), 'placeholder' => 'http://', 'description' => __( 'Enter the external URL to the product.', 'woocommerce' ) ) );
// Button text
woocommerce_wp_text_input( array( 'id' => '_button_text', 'label' => __( 'Button text', 'woocommerce' ), 'placeholder' => _x('Buy product', 'placeholder', 'woocommerce'), 'description' => __( 'This text will be shown on the button linking to the external product.', 'woocommerce' ) ) );
echo '</div>'; echo '<div class="options_group pricing show_if_simple show_if_external">'; // Product url
if ( $product_type == 'external' ) {
if ( isset( $_POST['_product_url'] ) )
update_post_meta( $post_id, '_product_url', esc_attr( $_POST['_product_url'] ) );
if ( isset( $_POST['_button_text'] ) )
update_post_meta( $post_id, '_button_text', esc_attr( $_POST['_button_text'] ) );
}<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* External Product Class
*
* External products cannot be bought; they link offsite. Extends simple products.
*
* @class WC_Product_External
* @version 2.0.0
* @package WooCommerce/Classes/Products
* @category Class
* @author WooThemes
*/
class WC_Product_External extends WC_Product {
/**
* __construct function.
*
* @access public
* @param mixed $product
*/
public function __construct( $product ) {
$this->product_type = 'external';
parent::__construct( $product );
}
/**
* Returns false if the product cannot be bought.
*
* @access public
* @return bool
*/
public function is_purchasable() {
return apply_filters( 'woocommerce_is_purchasable', false, $this );
}
/**
* 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 );
}
/**
* Get the add to cart button text for the single page
*
* @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 );
}
/**
* Get the add to cart button text
*
* @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 );
}
/**
* get_product_url function.
*
* @access public
* @return string
*/
public function get_product_url() {
return esc_url( $this->product_url );
}
/**
* get_button_text function.
*
* @access public
* @return string
*/
public function get_button_text() {
return $this->button_text ? $this->button_text : __( 'Buy product', 'woocommerce' );
}
}<?php
/**
* External product add to cart
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<?php do_action('woocommerce_before_add_to_cart_button'); ?>
<p class="cart">
<a href="<?php echo esc_url( $product_url ); ?>" rel="nofollow" class="single_add_to_cart_button button alt"><?php echo $button_text; ?></a>
</p>
<?php do_action('woocommerce_after_add_to_cart_button'); ?>
<?php do_action('woocommerce_before_add_to_cart_button'); ?>
<p class="cart">
<a href="<?php echo esc_url( $product_url ); ?>" rel="nofollow" class="single_add_to_cart_button button alt"><?php echo $button_text; ?></a>
</p>
<?php do_action('woocommerce_after_add_to_cart_button'); ?>
<?php do_action('woocommerce_before_add_to_cart_button'); ?>
<p class="cart">
<a href="<?php echo esc_url( $product_url ); ?>" rel="nofollow" class="single_add_to_cart_button button alt"><?php echo $button_text; ?></a>
</p>
<?php do_action('woocommerce_after_add_to_cart_button'); ?>