Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/themify-.../template...
File: template-add-to-cart.php
<?php
[0] Fix | Delete
if (!defined('ABSPATH'))
[1] Fix | Delete
exit; // Exit if accessed directly
[2] Fix | Delete
/**
[3] Fix | Delete
* Template Add To Cart
[4] Fix | Delete
*
[5] Fix | Delete
* Access original fields: $args['mod_settings']
[6] Fix | Delete
* @author Themify
[7] Fix | Delete
*/
[8] Fix | Delete
if (themify_is_woocommerce_active()):
[9] Fix | Delete
[10] Fix | Delete
wp_enqueue_script( 'tbp' );
[11] Fix | Delete
[12] Fix | Delete
$fields_default = array(
[13] Fix | Delete
'quantity' => 'yes',
[14] Fix | Delete
'label' =>'',
[15] Fix | Delete
'label_variable' =>'',
[16] Fix | Delete
'variable_cart' =>'',
[17] Fix | Delete
'label_outofstock' =>'',
[18] Fix | Delete
'fullwidth' => '',
[19] Fix | Delete
'css' => '',
[20] Fix | Delete
'animation_effect' => ''
[21] Fix | Delete
);
[22] Fix | Delete
$fields_args = wp_parse_args($args['mod_settings'], $fields_default);
[23] Fix | Delete
unset($args['mod_settings']);
[24] Fix | Delete
$fields_default=null;
[25] Fix | Delete
$element_id =$args['module_ID'];
[26] Fix | Delete
$builder_id=$args['builder_id'];
[27] Fix | Delete
$mod_name=$args['mod_name'];
[28] Fix | Delete
$container_class = apply_filters('themify_builder_module_classes', array(
[29] Fix | Delete
'module',
[30] Fix | Delete
'module-' . $mod_name,
[31] Fix | Delete
$element_id,
[32] Fix | Delete
$fields_args['css'],
[33] Fix | Delete
'tf_rel'
[34] Fix | Delete
), $mod_name,$element_id, $fields_args);
[35] Fix | Delete
[36] Fix | Delete
if(!empty($fields_args['fullwidth']) && 'no' !== $fields_args['fullwidth']){
[37] Fix | Delete
$container_class[] = 'buttons-fullwidth';
[38] Fix | Delete
}
[39] Fix | Delete
if(!empty($fields_args['global_styles']) && Themify_Builder::$frontedit_active===false){
[40] Fix | Delete
$container_class[] = $fields_args['global_styles'];
[41] Fix | Delete
}
[42] Fix | Delete
$container_props = apply_filters('themify_builder_module_container_props', self::parse_animation_effect($fields_args,array(
[43] Fix | Delete
'class' => implode(' ', $container_class),
[44] Fix | Delete
)), $fields_args, $mod_name, $element_id);
[45] Fix | Delete
$args=null;
[46] Fix | Delete
[47] Fix | Delete
/* this module is used on both single and archive product pages */
[48] Fix | Delete
$is_single = is_product();
[49] Fix | Delete
if(Themify_Builder::$frontedit_active===false){
[50] Fix | Delete
$container_props['data-lazy']=1;
[51] Fix | Delete
}
[52] Fix | Delete
?>
[53] Fix | Delete
<!-- Add To Cart module -->
[54] Fix | Delete
<div <?php echo self::get_element_attributes(self::sticky_element_props($container_props, $fields_args)); ?>>
[55] Fix | Delete
<?php
[56] Fix | Delete
$container_props=$container_class=null;
[57] Fix | Delete
do_action('themify_builder_background_styling',$builder_id,array('styling'=>$fields_args,'mod_name'=>$mod_name),$element_id,'module');
[58] Fix | Delete
$the_query = Tbp_Utils::get_wc_actual_query();
[59] Fix | Delete
if ($the_query===null || $the_query->have_posts()){
[60] Fix | Delete
if($the_query!==null){
[61] Fix | Delete
$the_query->the_post();
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
global $product;
[65] Fix | Delete
[66] Fix | Delete
if ( $product->get_stock_status() === 'outofstock' ) {
[67] Fix | Delete
$label = $fields_args['label_outofstock'];
[68] Fix | Delete
} else if ( $product->get_type() === 'variable' ) {
[69] Fix | Delete
$label = $fields_args['label_variable'];
[70] Fix | Delete
} else {
[71] Fix | Delete
$label = $fields_args['label'];
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
if ( ! empty( $label ) ) {
[75] Fix | Delete
TB_Add_To_Cart_Module::$cartText = $label;
[76] Fix | Delete
if ( $is_single ) {
[77] Fix | Delete
add_filter( 'woocommerce_product_single_add_to_cart_text', array( 'TB_Add_To_Cart_Module', 'changeCartText' ) );
[78] Fix | Delete
} else {
[79] Fix | Delete
add_filter( 'woocommerce_product_add_to_cart_text', array( 'TB_Add_To_Cart_Module', 'changeCartText' ) );
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
if ( $fields_args['quantity'] !== 'yes' ) {
[83] Fix | Delete
add_filter( 'wc_get_template', array( 'TB_Add_To_Cart_Module', 'filterQuantityInput' ), 10, 5 );
[84] Fix | Delete
} else {
[85] Fix | Delete
// on archive pages WC by default doesn't show Quantity field
[86] Fix | Delete
if ( ! $is_single && $product->get_type() === 'simple' ) { ?>
[87] Fix | Delete
<div class="quantity">
[88] Fix | Delete
<input type="number" class="input-text qty text filled" step="1" min="1" max="" name="quantity" value="1" title="Qty" size="4" inputmode="numeric" onchange="this.parentElement.nextElementSibling.setAttribute( 'data-quantity', this.value );">
[89] Fix | Delete
</div>
[90] Fix | Delete
<?php }
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
if ( $is_single || ( $fields_args['variable_cart'] === 'yes' && $product->get_type() === 'variable' ) ) {
[94] Fix | Delete
woocommerce_template_single_add_to_cart();
[95] Fix | Delete
} else {
[96] Fix | Delete
woocommerce_template_loop_add_to_cart();
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
if ( $the_query !== null ) {
[100] Fix | Delete
wp_reset_postdata();
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
// reset filters
[104] Fix | Delete
remove_filter( 'woocommerce_product_single_add_to_cart_text', array( 'TB_Add_To_Cart_Module', 'changeCartText' ) );
[105] Fix | Delete
remove_filter( 'woocommerce_product_add_to_cart_text', array( 'TB_Add_To_Cart_Module', 'changeCartText' ) );
[106] Fix | Delete
remove_filter( 'wc_get_template', array( 'TB_Add_To_Cart_Module', 'filterQuantityInput' ) );
[107] Fix | Delete
}
[108] Fix | Delete
?>
[109] Fix | Delete
</div>
[110] Fix | Delete
<!-- /Add To Cart module -->
[111] Fix | Delete
<?php endif; ?>
[112] Fix | Delete
[113] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function