Modifications are lost after upgrade plugin
-
Hello,
I have made some changes in “addtowishlist.class.php” file, which is located in public folder. so what is the solution to keep changes after upgrade the plugin.
Please help me.
Many thanks in advanced.
-
Hi @ambaliyaharesh,
All modifications should be made using Child Themes if you want to keep your changes safe after updates.
If you contact us via our live chat and describe what changes should be implemented for your case, we will be able to provide further assistance.
Regards,
StanHi @stantinv
Thanks for the reply.
I have made changes in button function. see below and what to do to take these on child theme or how to protect from update the plugin.
function button( $echo = true ) {
$content = apply_filters( ‘tinvwl_wishlist_button_before’, ” );
$text = ( tinv_get_option( ‘add_to_wishlist’ . ( $this->is_loop ? ‘_catalog’ : ” ), ‘show_text’ ) ) ? apply_filters( ‘tinvwl-add_to_wishlist_catalog-text’, tinv_get_option( ‘add_to_wishlist’ . ( $this->is_loop ? ‘_catalog’ : ” ), ‘text’ ) ) : ”;
$icon = tinv_get_option( ‘add_to_wishlist’ . ( $this->is_loop ? ‘_catalog’ : ” ), ‘icon’ );
$icon_color = tinv_get_option( ‘add_to_wishlist’ . ( $this->is_loop ? ‘_catalog’ : ” ), ‘icon_style’ );
$icon_class = ”;
$action = ‘addto’;
if ( empty( $text ) ) {
$icon_class = ‘ no-txt’;
} else {
$content .= ‘<div class=”tinv-wishlist-clear”></div>’;
if ( tinv_get_option( ‘general’, ‘simple_flow’ ) ) {
$text = sprintf( ‘<span class=”tinvwl_add_to_wishlist-text”>%s</span><span class=”tinvwl_remove_from_wishlist-text”>%s</span>’, $text, apply_filters( ‘tinvwl-add_to_wishlist_catalog-text_remove’, tinv_get_option( ‘add_to_wishlist’ . ( $this->is_loop ? ‘_catalog’ : ” ), ‘text_remove’ ) ) );
} else {
if(is_shop() || is_product_category()) {
$text = sprintf( ‘<span class=”tinvwl_add_to_wishlist-text”>%s</span>’, ” );
}
else
{
$text = sprintf( ‘<span class=”tinvwl_add_to_wishlist-text”>%s</span>’, $text );
}}
}
if ( ! empty( $icon ) ) {
$icon_upload = tinv_get_option( ‘add_to_wishlist’ . ( $this->is_loop ? ‘_catalog’ : ” ), ‘icon_upload’ );
if ( ‘custom’ === $icon && ! empty( $icon_upload ) ) {
$text = sprintf( ‘%s’, esc_url( $icon_upload ), esc_attr( apply_filters( ‘tinvwl-add_to_wishlist_catalog-text’, tinv_get_option( ‘add_to_wishlist’ . ( $this->is_loop ? ‘_catalog’ : ” ), ‘text’ ) ) ), $text );
}
$icon = ‘tinvwl-icon-‘ . $icon;
if ( ‘custom’ !== $icon && $icon_color ) {
$icon .= ‘ icon-‘ . $icon_color;
}
}
$icon .= $icon_class;
$variation_id = ( ( $this->is_loop && ‘variable’ === ( version_compare( WC_VERSION, ‘3.0.0’, ‘<‘ ) ? $this->product->product_type : $this->product->get_type() ) ) ? $this->variation_id : ( version_compare( WC_VERSION, ‘3.0.0’, ‘<‘ ) ? $this->product->variation_id : ( $this->product->is_type( ‘variation’ ) ? $this->product->get_id() : 0 ) ) );
foreach ( $this->wishlist as $value ) {
if ( $value[‘in’] && in_array( $variation_id, $value[‘in’] ) ) {
$icon .= ‘ tinvwl-product-in-list’;
if ( tinv_get_option( ‘general’, ‘simple_flow’ ) ) {
if ( $this->is_loop ) {
if ( ! is_array( $value[‘in’] ) || in_array( $variation_id, $value[‘in’] ) ) {
$icon .= ‘ tinvwl-product-make-remove’;
$action = ‘remove’;
}
} else {
$icon .= ‘ tinvwl-product-make-remove’;
$action = ‘remove’;
}
}
break;
}
}$icon .= ‘ ‘ . tinv_get_option( ‘add_to_wishlist’ . ( $this->is_loop ? ‘_catalog’ : ” ), ‘class’ );
$icon .= ‘ tinvwl-position-‘ . tinv_get_option( ‘add_to_wishlist’ . ( $this->is_loop ? ‘_catalog’ : ” ), ‘position’ );
$icon .= ( tinv_get_option( ‘add_to_wishlist’ . ( $this->is_loop ? ‘_catalog’ : ” ), ‘show_preloader’ ) ) ? ‘ ftinvwl-animated’ : ”;
$content .= sprintf( ‘%s‘, $icon, htmlspecialchars( wp_json_encode( $this->wishlist ) ), ( version_compare( WC_VERSION, ‘3.0.0’, ‘<‘ ) ? $this->product->id : ( $this->product->is_type( ‘variation’ ) ? $this->product->get_parent_id() : $this->product->get_id() ) ), ( ( $this->is_loop && ‘variable’ === ( version_compare( WC_VERSION, ‘3.0.0’, ‘<‘ ) ? $this->product->product_type : $this->product->get_type() ) ) ? $this->variation_id : ( version_compare( WC_VERSION, ‘3.0.0’, ‘<‘ ) ? $this->product->variation_id : ( $this->product->is_type( ‘variation’ ) ? $this->product->get_id() : 0 ) ) ), ( version_compare( WC_VERSION, ‘3.0.0’, ‘<‘ ) ? $this->product->product_type : $this->product->get_type() ), $action, $text );
$content .= apply_filters( ‘tinvwl_wishlist_button_after’, ” );if ( ! empty( $text ) ) {
$content .= ‘<div class=”tinv-wishlist-clear”></div>’;
}echo apply_filters( ‘tinvwl_wishlist_button’, $content ); // WPCS: xss ok.
}Regards,
Haresh AmbaliyaHi @ambaliyaharesh,
You can hook your custom function to the ‘tinvwl_wishlist_button’ filter to alter button markup. You can read more about WordPress filters in the Codex:
https://codex.ww.wp.xz.cn/Plugin_API#FiltersIt’s the proper way to apply your customizations.
Kind regards,
Konstantin.Ok, Thank you for your reply.
The topic ‘Modifications are lost after upgrade plugin’ is closed to new replies.