Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi there

    First of all I’d like to point out that wishlist by default isn’t added to my account page; this is the result of either the theme or another plugin customizing default behavior of our plugin

    Anyway, there is no reason why wishlist shouldn’t appear correctly; so my best guess is that there is some template of our plugin overridden inside theme folder

    Could you please search for wishlist.php or wishlist-view.php files inside theme folder, or /woocommerce subdirectory, and rename them to wishlist.php.bak and wishlist-view.php.bak respectively?
    This will remove theme’s customization, excluding one possible point of failure

    Thread Starter mustaghees

    (@mustaghees)

    I checked the files you mentioned, and indeed the problem is there somewhere. I commented out some code (first two do_actions and first div tag), and now the wishlist page is rendering correctly. Can you confirm I did not do something wrong. Here is the concerned code (wishlist-view.php in theme/woocommerce):

    if ( ! defined( 'YITH_WCWL' ) ) {
    	exit;
    } // Exit if accessed directly
    ?>
    
    <?php //do_action( 'yith_wcwl_before_wishlist_form', $wishlist_meta ); ?>
    
    <form id="yith-wcwl-form" action="<?php echo esc_url( $form_action ); ?>" method="post" class="woocommerce">
    
        <?php wp_nonce_field( 'yith-wcwl-form', 'yith_wcwl_form_nonce' ) ?>
    
        <!-- TITLE -->
        <?php
        //do_action( 'yith_wcwl_before_wishlist_title' );
    
        if( ! empty( $page_title ) ) :
        ?>
            <!--div class="wishlist-title <?php echo true === $is_custom_list ? 'wishlist-title-with-form' : ''?>">
                <?php echo apply_filters( 'yith_wcwl_wishlist_title', '<h2>' . $page_title . '</h2>' ); ?>
                <?php if( $is_custom_list ): ?>
                    <a class="btn button show-title-form">
                        <?php echo apply_filters( 'yith_wcwl_edit_title_icon', '<i class="fa fa-pencil"></i>' )?>
                        <?php _e( 'Edit title', 'yith-woocommerce-wishlist' ) ?>
                    </a>
                <?php endif; ?>
            </div-->
            <?php if( $is_custom_list ): ?>
                <div class="hidden-title-form">
                    <input type="text" value="<?php echo esc_attr( $page_title ); ?>" name="wishlist_name"/>
                    <button>
                        <?php echo apply_filters( 'yith_wcwl_save_wishlist_title_icon', '<i class="fa fa-check"></i>' )?>
                        <?php _e( 'Save', 'yith-woocommerce-wishlist' )?>
                    </button>
                    <a class="hide-title-form btn button">
                        <?php echo apply_filters( 'yith_wcwl_cancel_wishlist_title_icon', '<i class="fa fa-remove"></i>' )?>
                        <?php _e( 'Cancel', 'yith-woocommerce-wishlist' )?>
                    </a>
                </div>
            <?php endif; ?>
        <?php
        endif;
    
         do_action( 'yith_wcwl_before_wishlist' ); ?>
    
        <!-- WISHLIST TABLE -->
    	<table class="shop_table_responsive shop_table cart wishlist_table" data-pagination="<?php echo esc_attr( $pagination )?>" data-per-page="<?php echo esc_attr( $per_page )?>" data-page="<?php echo esc_attr( $current_page )?>" data-id="<?php echo esc_attr( $wishlist_id ); ?>" data-token="<?php echo esc_attr( $wishlist_token ); ?>">
    
    rest of code continued...
    

    The only thing not working correctly now is I can’t change the wishlist title. Editing it takes me to a new URL.

    Thanks for helping

    Plugin Author YITHEMES

    (@yithemes)

    This is a slightly outdated version of the template; I’d suggest you to contact theme developers and ask them to update it within next release

    Anyway, if you want to keep editing this file, I suggest you to remove form tag too, since it will be added by another template

    Regarding the edit title form, the problem is that you’re not correctly setting up wishlist page
    The best solution in this case would be to implement a custom code that filters wishlist url, to point to your custom account endpoint
    If you specify me the page under my account that you use to show the wishlist (complete url) I’ll be glad to provide code

    Thread Starter mustaghees

    (@mustaghees)

    Hi!

    I removed the form element (and everything inside it) as you suggested. Then editing title started working correctly. However, no products in the wishlist were being displayed.

    So I looked at the code block I just removed, and noticed a table. From the looks of it, it was responsible for displaying the products. So I copied it to where form originally was. Now, finally, everything is working πŸ™‚

    Thank you so much for giving me your time. Really appreciate it <3

    Just leaving the modified code in case anyone else has the same problem.

    <Basel Theme files>/woocommerce/wishlist-view.php:

    
    <?php
    /**
     * Wishlist page template
     *
     * @author Your Inspiration Themes
     * @package YITH WooCommerce Wishlist
     * @version 2.0.12
     */
    
    if ( ! defined( 'YITH_WCWL' ) ) {
    	exit;
    } // Exit if accessed directly
    ?>
    
    <?php //do_action( 'yith_wcwl_before_wishlist_form', $wishlist_meta ); ?>
    
    <!-- WISHLIST TABLE -->
    	<table class="shop_table_responsive shop_table cart wishlist_table" data-pagination="<?php echo esc_attr( $pagination )?>" data-per-page="<?php echo esc_attr( $per_page )?>" data-page="<?php echo esc_attr( $current_page )?>" data-id="<?php echo esc_attr( $wishlist_id ); ?>" data-token="<?php echo esc_attr( $wishlist_token ); ?>">
    
    	    <?php $column_count = 2; ?>
    
            <thead>
            <tr>
    	        <?php if( $show_cb ) : ?>
    
    		        <th class="product-checkbox">
    			        <input type="checkbox" value="" name="" id="bulk_add_to_cart"/>
    		        </th>
    
    	        <?php
    		        $column_count ++;
                endif;
    	        ?>
    
    	        <?php if( $is_user_owner ): ?>
    		        <th class="product-remove"></th>
    	        <?php
    	            $column_count ++;
    	        endif;
    	        ?>
    
                <th class="product-thumbnail"></th>
    
                <th class="product-name">
                    <span class="nobr"><?php echo apply_filters( 'yith_wcwl_wishlist_view_name_heading', esc_html__( 'Product Name', 'yith-woocommerce-wishlist' ) ) ?></span>
                </th>
    
                <?php if( $show_price ) : ?>
    
                    <th class="product-price">
                        <span class="nobr">
                            <?php echo apply_filters( 'yith_wcwl_wishlist_view_price_heading', esc_html__( 'Unit Price', 'yith-woocommerce-wishlist' ) ) ?>
                        </span>
                    </th>
    
                <?php
    	            $column_count ++;
                endif;
                ?>
    
                <?php if( $show_stock_status ) : ?>
    
                    <th class="product-stock-status">
                        <span class="nobr">
                            <?php echo apply_filters( 'yith_wcwl_wishlist_view_stock_heading', esc_html__( 'Stock Status', 'yith-woocommerce-wishlist' ) ) ?>
                        </span>
                    </th>
    
                <?php
    	            $column_count ++;
                endif;
                ?>
    
                <?php if( $show_last_column ) : ?>
    
                    <th class="product-add-to-cart"></th>
    
                <?php
    	            $column_count ++;
                endif;
                ?>
            </tr>
            </thead>
    
            <tbody>
            <?php
            if( count( $wishlist_items ) > 0 ) :
    	        $added_items = array();
                foreach( $wishlist_items as $item ) :
                    global $product;
    
    	            $item['prod_id'] = yit_wpml_object_id ( $item['prod_id'], 'product', true );
    
    	            if( in_array( $item['prod_id'], $added_items ) ){
    		            continue;
    	            }
    
    	            $added_items[] = $item['prod_id'];
    	            $product = wc_get_product( $item['prod_id'] );
    	            $availability = $product->get_availability();
    	            $stock_status = $availability['class'];
    
                    if( $product && $product->exists() ) :
    	                ?>
                        <tr id="yith-wcwl-row-<?php echo esc_attr( $item['prod_id'] ); ?>" data-row-id="<?php echo esc_attr( $item['prod_id'] ); ?>">
    	                    <?php if( $show_cb ) : ?>
    		                    <td class="product-checkbox">
    			                    <input type="checkbox" value="<?php echo esc_attr( $item['prod_id'] ) ?>" name="add_to_cart[]" <?php echo ( ! $product->is_type( 'simple' ) ) ? 'disabled="disabled"' : '' ?>/>
    		                    </td>
    	                    <?php endif ?>
    
                            <?php if( $is_user_owner ): ?>
                            <td class="product-remove">
                                <div>
                                    <a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item['prod_id'] ) ) ?>" class="remove remove_from_wishlist" title="<?php _e( 'Remove this product', 'yith-woocommerce-wishlist' ) ?>">&times;</a>
                                </div>
                            </td>
                            <?php endif; ?>
    
                            <td class="product-thumbnail">
                                <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item['prod_id'] ) ) ) ?>">
                                    <?php echo apply_filters( 'yith_product_thumbnail', $product->get_image() ); ?>
                                </a>
                            </td>
    
                            <td class="product-name" data-title="<?php esc_attr_e( 'Product Name', 'yith-woocommerce-wishlist' ); ?>">
                                <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item['prod_id'] ) ) ) ?>"><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?></a>
                                <?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
                            </td>
    
                            <?php if( $show_price ) : ?>
                                <td class="product-price" data-title="<?php esc_attr_e( 'Unit Price', 'yith-woocommerce-wishlist' ); ?>">
                                    <?php echo true == $product->get_price() ? $product->get_price_html() : apply_filters( 'yith_free_text', esc_html__( 'Free!', 'yith-woocommerce-wishlist' ) ); ?>
                                </td>
                            <?php endif ?>
    
                            <?php if( $show_stock_status ) : ?>
                                <td class="product-stock-status" data-title="<?php esc_attr_e( 'Stock Status', 'yith-woocommerce-wishlist' ); ?>">
                                    <?php echo 'out-of-stock' === $stock_status ? '<span class="wishlist-out-of-stock">' . esc_html__( 'Out of Stock', 'yith-woocommerce-wishlist' ) . '</span>' : '<span class="wishlist-in-stock">' . esc_html__( 'In Stock', 'yith-woocommerce-wishlist' ) . '</span>'; ?>
                                </td>
                            <?php endif ?>
    
    	                    <?php if( $show_last_column ): ?>
                            <td class="product-add-to-cart">
    	                        <!-- Date added -->
    	                        <?php
    	                        if( $show_dateadded && isset( $item['dateadded'] ) ):
    								echo '<span class="dateadded">' . sprintf( esc_html__( 'Added on : %s', 'yith-woocommerce-wishlist' ), date_i18n( get_option( 'date_format' ), strtotime( $item['dateadded'] ) ) ) . '</span>';
    	                        endif;
    	                        ?>
    
    	                        <!-- Add to cart button -->
                                <?php if( $show_add_to_cart && isset( $stock_status ) && $stock_status != 'out-of-stock' ): ?>
                                    <?php woocommerce_template_loop_add_to_cart(); ?>
                                <?php endif ?>
    
    	                        <!-- Change wishlist -->
    							<?php if( $available_multi_wishlist && is_user_logged_in() && count( $users_wishlists ) > 1 && $move_to_another_wishlist && $is_user_owner ): ?>
    	                        <select class="change-wishlist selectBox">
    		                        <option value=""><?php _e( 'Move', 'yith-woocommerce-wishlist' ) ?></option>
    		                        <?php
    		                        foreach( $users_wishlists as $wl ):
    			                        if( $wl['wishlist_token'] == $wishlist_meta['wishlist_token'] ){
    				                        continue;
    			                        }
    
    		                        ?>
    			                        <option value="<?php echo esc_attr( $wl['wishlist_token'] ) ?>">
    				                        <?php
    				                        $wl_title = ! empty( $wl['wishlist_name'] ) ? esc_html( $wl['wishlist_name'] ) : esc_html( $default_wishlsit_title );
    				                        if( $wl['wishlist_privacy'] == 1 ){
    					                        $wl_privacy = esc_html__( 'Shared', 'yith-woocommerce-wishlist' );
    				                        }
    				                        elseif( $wl['wishlist_privacy'] == 2 ){
    					                        $wl_privacy = esc_html__( 'Private', 'yith-woocommerce-wishlist' );
    				                        }
    				                        else{
    					                        $wl_privacy = esc_html__( 'Public', 'yith-woocommerce-wishlist' );
    				                        }
    
    				                        echo sprintf( '%s - %s', $wl_title, $wl_privacy );
    				                        ?>
    			                        </option>
    		                        <?php
    		                        endforeach;
    		                        ?>
    	                        </select>
    	                        <?php endif; ?>
    
    	                        <!-- Remove from wishlist -->
    	                        <?php if( $is_user_owner && $repeat_remove_button ): ?>
                                    <a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item['prod_id'] ) ) ?>" class="remove_from_wishlist button" title="<?php _e( 'Remove this product', 'yith-woocommerce-wishlist' ) ?>"><?php _e( 'Remove', 'yith-woocommerce-wishlist' ) ?></a>
                                <?php endif; ?>
                            </td>
    	                <?php endif; ?>
                        </tr>
                    <?php
                    endif;
                endforeach;
            else: ?>
                <tr>
                    <td colspan="<?php echo esc_attr( $column_count ) ?>" class="wishlist-empty"><?php echo apply_filters( 'yith_wcwl_no_product_to_remove_message', esc_html__( 'No products were added to the wishlist', 'yith-woocommerce-wishlist' ) ) ?></td>
                </tr>
            <?php
            endif;
    
            if( ! empty( $page_links ) ) : ?>
                <tr class="pagination-row">
                    <td colspan="<?php echo esc_attr( $column_count ) ?>"><?php echo ! empty( $page_links ) ? $page_links : ''; ?></td>
                </tr>
            <?php endif ?>
            </tbody>
    
            <tfoot>
            <tr>
    	        <td colspan="<?php echo esc_attr( $column_count ) ?>">
    	            <?php if( $show_cb ) : ?>
    		            <div class="custom-add-to-cart-button-cotaniner">
    		                <a href="<?php echo esc_url( add_query_arg( array( 'wishlist_products_to_add_to_cart' => '', 'wishlist_token' => $wishlist_token ) ) ) ?>" class="button alt" id="custom_add_to_cart"><?php echo apply_filters( 'yith_wcwl_custom_add_to_cart_text', esc_html__( 'Add the selected products to the cart', 'yith-woocommerce-wishlist' ) ) ?></a>
    		            </div>
    	            <?php endif; ?>
    
    	            <?php if ( $is_user_owner && $show_ask_estimate_button && $count > 0 ): ?>
    		            <div class="ask-an-estimate-button-container">
    	                    <a href="<?php echo true == $additional_info || ! is_user_logged_in() ? '#ask_an_estimate_popup' : $ask_estimate_url ?>" class="btn button ask-an-estimate-button" <?php echo true == $additional_info ? 'data-rel="prettyPhoto[ask_an_estimate]"' : '' ?> >
    	                    <?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', '<i class="fa fa-shopping-cart"></i>' )?>
    	                    <?php echo apply_filters( 'yith_wcwl_ask_an_estimate_text', esc_html__( 'Ask for an estimate', 'yith-woocommerce-wishlist' ) ) ?>
    	                </a>
    		            </div>
    	            <?php endif; ?>
    
    		        <?php
    // 		        do_action( 'yith_wcwl_before_wishlist_share' );
    
    // 		        if ( is_user_logged_in() && $is_user_owner && ! $is_private && $share_enabled ){
    // 			        yith_wcwl_get_template( 'share.php', $share_atts );
    // 		        }
    
    // 		        do_action( 'yith_wcwl_after_wishlist_share' );
    		        ?>
    	        </td>
            </tr>
            </tfoot>
    
        </table>
    
    <?php //do_action( 'yith_wcwl_after_wishlist_form', $wishlist_meta ); ?>
    
    <?php if( $show_ask_estimate_button && ( ! is_user_logged_in() || $additional_info ) ): ?>
    	<div id="ask_an_estimate_popup">
    		<form action="<?php echo esc_url( $ask_estimate_url ); ?>" method="post" class="wishlist-ask-an-estimate-popup">
    			<?php if( ! is_user_logged_in() ): ?>
    				<label for="reply_email"><?php echo apply_filters( 'yith_wcwl_ask_estimate_reply_mail_label', esc_html__( 'Your email', 'yith-woocommerce-wishlist' ) ) ?></label>
    				<input type="email" value="" name="reply_email" id="reply_email">
    			<?php endif; ?>
    			<?php if( ! empty( $additional_info_label ) ):?>
    				<label for="additional_notes"><?php echo esc_html( $additional_info_label ) ?></label>
    			<?php endif; ?>
    			<textarea id="additional_notes" name="additional_notes"></textarea>
    
    			<button class="btn button ask-an-estimate-button ask-an-estimate-button-popup" >
    				<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', '<i class="fa fa-shopping-cart"></i>' )?>
    				<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_text', esc_html__( 'Ask for an estimate', 'yith-woocommerce-wishlist' ) ) ?>
    			</button>
    		</form>
    	</div>
    <?php endif; ?>
    
    Plugin Author YITHEMES

    (@yithemes)

    You’re welcome!

    We are doing our best to improve our plugins. Our target is to develop and release the best free plugins for WooCommerce, but to achieve this we need your help. Please leave a good review to support us and help our growth πŸ™‚

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Account page rendering twice’ is closed to new replies.