Custom wishlist table
-
Hi there, I love this plugin, but I would like to customize the wishlist table to match my theme.
I already did some changes to the wishlist php file. You can have a look by adding the following product to a wishlist:
https://destination-peru.com/explore/sacred-valley-day-trip/
The problem is I cant make it work to show the product description and I would like to style the Remove button like the above “VIEW TOUR” button.
Is it possible to send you the php code I m using by email.
Your help would be highly appreciated.
Best, Johann.The page I need help with: [log in to see the link]
-
Hi @malteserone,
1. It will require customization to add product description into a table
2. Use DOM inspector in your browser to find the CSS applied for the “VIEW TOUR” button. Then you can apply your own styles for the “Remove” button in a plugin Style Options section. The rules should look something like this:
.tinv-wishlist .product-remove button { line-height: 1.7em; display: inline-block; width: 100%; height: auto; border-radius: 50px; transition: all 0.2s ease-in-out; border: none; background-color: rgba(71,160,255,0.8); color: #fff; margin-top: 10px; padding-left: 0; }Regards,
Stan-
This reply was modified 6 years, 10 months ago by
Stan.
Thanks for the reply Stan,
I modified the ti-wislist.php to the following code:
<?php
/**
* The Template for displaying wishlist if a current user is owner.
*
* @version 1.12.0
* @package TInvWishlist\Template
*/if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly.
}
wp_enqueue_script( ‘tinvwl’ );
?>
<div class=”tinv-wishlist woocommerce tinv-wishlist-clear”>
<?php do_action( ‘tinvwl_before_wishlist’, $wishlist ); ?>
<?php if ( function_exists( ‘wc_print_notices’ ) ) {
wc_print_notices();
} ?>
<?php
$wl_paged = get_query_var( ‘wl_paged’ );
$form_url = tinv_url_wishlist( $wishlist[‘share_key’], $wl_paged, true );
?>
<form action=”<?php echo esc_url( $form_url ); ?>” method=”post” autocomplete=”off”>
<?php do_action( ‘tinvwl_before_wishlist_table’, $wishlist ); ?>
<table class=”tinvwl-table-manage-list”>
<tbody>
<?php do_action( ‘tinvwl_wishlist_contents_before’ ); ?><?php
global $product, $post;
// store global product data.
$_product_tmp = $product;
// store global post data.
$_post_tmp = $post;foreach ( $products as $wl_product ) {
// override global product data.
$product = apply_filters( ‘tinvwl_wishlist_item’, $wl_product[‘data’] );
// override global post data.
$post = get_post( $product->get_id() );unset( $wl_product[‘data’] );
if ( $wl_product[‘quantity’] > 0 && apply_filters( ‘tinvwl_wishlist_item_visible’, true, $wl_product, $product ) ) {
$product_url = apply_filters( ‘tinvwl_wishlist_item_url’, $product->get_permalink(), $wl_product, $product );
do_action( ‘tinvwl_wishlist_row_before’, $wl_product, $product );
?>
<tr class=”<?php echo esc_attr( apply_filters( ‘tinvwl_wishlist_item_class’, ‘wishlist_item’, $wl_product, $product ) ); ?>”>
<?php if ( isset( $wishlist_table[‘colm_checkbox’] ) && $wishlist_table[‘colm_checkbox’] ) { ?>
<td class=”product-cb”>
<?php
echo apply_filters( ‘tinvwl_wishlist_item_cb’, sprintf( // WPCS: xss ok.
‘<input type=”checkbox” name=”wishlist_pr[]” value=”%d” title=”%s”>’, esc_attr( $wl_product[‘ID’] ), __( ‘Select for bulk action’, ‘ti-woocommerce-wishlist’ )
), $wl_product, $product );
?>
</td>
<?php } ?>
<div class=”atlist__item margin-bottom”>
<div class=”atlist__item__image”>
<?php
$thumbnail = apply_filters( ‘tinvwl_wishlist_item_thumbnail’, $product->get_image(), $wl_product, $product );if ( ! $product->is_visible() ) {
echo $thumbnail; // WPCS: xss ok.
} else {
printf( ‘%s‘, esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
}
?>
<?php adventure_tours_render_tour_icons(array(
‘before’ => ‘<div class=”atlist__item__icons”>’,
‘after’ => ‘</div>’,
), $item_id);
?>
<?php adventure_tours_renders_tour_badge( array(
‘tour_id’ => $item_id,
‘wrap_css_class’ => ‘atlist__item__angle-wrap’,
‘css_class’ => ‘atlist__item__angle’,
) );?>
</div>
<div class=”atlist__item__content<?php if ( ! $attributes ) { echo ‘ atlist__item__content–full-height’; }; ?>”>
<div class=”atlist__item__content__items”>
<div class=”atlist__item__content__item”>
<h2 class=”atlist__item__title”>
<?php
if ( ! $product->is_visible() ) {
echo apply_filters( ‘tinvwl_wishlist_item_name’, $product->get_title(), $wl_product, $product ) . ‘ ‘; // WPCS: xss ok.
} else {
echo apply_filters( ‘tinvwl_wishlist_item_name’, sprintf( ‘%s‘, esc_url( $product_url ), $product->get_title() ), $wl_product, $product ); // WPCS: xss ok.
}echo apply_filters( ‘tinvwl_wishlist_item_meta_data’, tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok.
?>
<?php echo esc_html( $item_title ); ?></h2>
<div class=”atlist__item__description”><?php echo adventure_tours_get_short_description( $item_post, $description_words_limit ); ?></div>
</div>
<div class=”atlist__item__content__item atlist__item__content__item–alternative”>
<?php
echo apply_filters( ‘tinvwl_wishlist_item_price’, $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
?>
<?php
$label_text = apply_filters( ‘adventure_tours_list_price_decoration_label’, esc_html__( ‘per person’, ‘adventure-tours’ ), $item );
if ( $label_text ) {
printf(‘<div class=”atlist__item__price-label”>%s</div>’, esc_html( $label_text ) );
}
?>
<div class=”atlist__item__read-more”>” class=”atbtn atbtn–small atbtn–rounded atbtn–light”><?php esc_html_e( ‘view tour’, ‘adventure-tours’ ); ?></div>
<div class=”product-remove”>
<button type=”submit” name=”tinvwl-remove”
value=”<?php echo esc_attr( $wl_product[‘ID’] ); ?>”
title=”<?php _e( ‘Remove’, ‘ti-woocommerce-wishlist’ ) ?>”><i
class=”ftinvwl ftinvwl-times”></i>
</button>
</div>
</div>
</div>
<?php if ( $attributes ) {
printf( ‘<div class=”atlist__item__attributes”>%s</div>’, $attributes );
} ?>
</div>
</div>
</tr>
<?php
do_action( ‘tinvwl_wishlist_row_after’, $wl_product, $product );
} // End if().
} // End foreach().
// restore global product data.
$product = $_product_tmp;
// restore global post data.
$post = $_post_tmp;
?>
<?php do_action( ‘tinvwl_wishlist_contents_after’ ); ?>
</tbody>
<tfoot>
<tr>
<?php do_action( ‘tinvwl_after_wishlist_table’, $wishlist ); ?>
<?php wp_nonce_field( ‘tinvwl_wishlist_owner’, ‘wishlist_nonce’ ); ?>
</tr>
</tfoot>
</table>
</form>
<?php do_action( ‘tinvwl_after_wishlist’, $wishlist ); ?>
<div class=”tinv-lists-nav tinv-wishlist-clear”>
<?php do_action( ‘tinvwl_pagenation_wishlist’, $wishlist ); ?>
</div>
</div>As code for the description I m using the following:
<div class=”atlist__item__description”><?php echo adventure_tours_get_short_description( $item_post, $description_words_limit ); ?></div>
On my website I am using 5 languages with English as default language.
Somehow the product description is only shown in Spanish. Why is that?You can add the following product to the wishlist:
https://destination-peru.com/explore/cusco-historico-tour-de-la-ciudad/?lang=eslanguages can be changed in the footer.
Any idea what needs to be changed to show description in all languages?
Hi @malteserone
It looks like you need to pass to your custom description method ‘adventure_tours_get_short_description’ correct post item for each language. It depends on a multilingual plugin. Check their docs.
-
This reply was modified 6 years, 10 months ago by
The topic ‘Custom wishlist table’ is closed to new replies.