add-to-wishlist-added.php
3 years ago
add-to-wishlist-browse.php
3 years ago
add-to-wishlist-button.php
3 years ago
add-to-wishlist-remove.php
3 years ago
add-to-wishlist.php
4 years ago
share.php
3 years ago
wishlist-view-footer-mobile.php
3 years ago
wishlist-view-footer.php
3 years ago
wishlist-view-header.php
3 years ago
wishlist-view-mobile.php
3 years ago
wishlist-view.php
3 years ago
wishlist.php
3 years ago
wishlist-view-mobile.php
303 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Wishlist page template - Standard Layout |
| 4 | * |
| 5 | * @author YITH |
| 6 | * @package YITH\Wishlist\Templates\Wishlist\View |
| 7 | * @version 3.0.11 |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * Template variables: |
| 12 | * |
| 13 | * @var $wishlist \YITH_WCWL_Wishlist Current wishlist |
| 14 | * @var $wishlist_items array Array of items to show for current page |
| 15 | * @var $wishlist_token string Current wishlist token |
| 16 | * @var $wishlist_id int Current wishlist id |
| 17 | * @var $users_wishlists array Array of current user wishlists |
| 18 | * @var $pagination string yes/no |
| 19 | * @var $per_page int Items per page |
| 20 | * @var $current_page int Current page |
| 21 | * @var $page_links array Array of page links |
| 22 | * @var $is_user_owner bool Whether current user is wishlist owner |
| 23 | * @var $show_price bool Whether to show price column |
| 24 | * @var $show_dateadded bool Whether to show item date of addition |
| 25 | * @var $show_stock_status bool Whether to show product stock status |
| 26 | * @var $show_add_to_cart bool Whether to show Add to Cart button |
| 27 | * @var $show_remove_product bool Whether to show Remove button |
| 28 | * @var $show_price_variations bool Whether to show price variation over time |
| 29 | * @var $show_variation bool Whether to show variation attributes when possible |
| 30 | * @var $show_cb bool Whether to show checkbox column |
| 31 | * @var $show_quantity bool Whether to show input quantity or not |
| 32 | * @var $show_ask_estimate_button bool Whether to show Ask an Estimate form |
| 33 | * @var $show_last_column bool Whether to show last column (calculated basing on previous flags) |
| 34 | * @var $move_to_another_wishlist bool Whether to show Move to another wishlist select |
| 35 | * @var $move_to_another_wishlist_type string Whether to show a select or a popup for wishlist change |
| 36 | * @var $additional_info bool Whether to show Additional info textarea in Ask an estimate form |
| 37 | * @var $price_excl_tax bool Whether to show price excluding taxes |
| 38 | * @var $enable_drag_n_drop bool Whether to enable drag n drop feature |
| 39 | * @var $repeat_remove_button bool Whether to repeat remove button in last column |
| 40 | * @var $available_multi_wishlist bool Whether multi wishlist is enabled and available |
| 41 | * @var $no_interactions bool |
| 42 | */ |
| 43 | |
| 44 | if ( ! defined( 'YITH_WCWL' ) ) { |
| 45 | exit; |
| 46 | } // Exit if accessed directly |
| 47 | ?> |
| 48 | |
| 49 | <!-- WISHLIST MOBILE --> |
| 50 | <ul |
| 51 | class="shop_table cart wishlist_table wishlist_view responsive mobile <?php echo $show_cb ? 'with-checkbox' : ''; ?> <?php echo $no_interactions ? 'no-interactions' : ''; ?>" |
| 52 | data-pagination="<?php echo esc_attr( $pagination ); ?>" data-per-page="<?php echo esc_attr( $per_page ); ?>" data-page="<?php echo esc_attr( $current_page ); ?>" |
| 53 | data-id="<?php echo esc_attr( $wishlist_id ); ?>" data-token="<?php echo esc_attr( $wishlist_token ); ?>"> |
| 54 | |
| 55 | <?php |
| 56 | if ( $wishlist && $wishlist->has_items() ) : |
| 57 | foreach ( $wishlist_items as $item ) : |
| 58 | /** |
| 59 | * Each of wishlist items |
| 60 | * |
| 61 | * @var $item \YITH_WCWL_Wishlist_Item |
| 62 | */ |
| 63 | global $product; |
| 64 | |
| 65 | $product = $item->get_product(); |
| 66 | |
| 67 | if ( $product && $product->exists() ) : |
| 68 | ?> |
| 69 | <li id="yith-wcwl-row-<?php echo esc_attr( $item->get_product_id() ); ?>" data-row-id="<?php echo esc_attr( $item->get_product_id() ); ?>"> |
| 70 | <?php if ( $show_cb ) : ?> |
| 71 | <div class="product-checkbox"> |
| 72 | <input type="checkbox" value="yes" name="items[<?php echo esc_attr( $item->get_product_id() ); ?>][cb]"/> |
| 73 | </div> |
| 74 | <?php endif ?> |
| 75 | |
| 76 | <div class="item-wrapper"> |
| 77 | <div class="product-thumbnail"> |
| 78 | <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item->get_product_id() ) ) ); ?>"> |
| 79 | <?php echo wp_kses_post( $product->get_image() ); ?> |
| 80 | </a> |
| 81 | </div> |
| 82 | |
| 83 | <div class="item-details"> |
| 84 | <div class="product-name"> |
| 85 | <h3> |
| 86 | <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item->get_product_id() ) ) ); ?>"> |
| 87 | <?php echo wp_kses_post( apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ); ?> |
| 88 | </a> |
| 89 | </h3> |
| 90 | <?php |
| 91 | /** |
| 92 | * DO_ACTION: yith_wcwl_table_after_product_name |
| 93 | * |
| 94 | * Allows to render some content or fire some action after the product name in the wishlist table. |
| 95 | * |
| 96 | * @param YITH_WCWL_Wishlist_Item $item Wishlist item object |
| 97 | */ |
| 98 | do_action( 'yith_wcwl_table_after_product_name', $item ); |
| 99 | ?> |
| 100 | </div> |
| 101 | |
| 102 | <?php if ( $show_variation || $show_dateadded || $show_price ) : ?> |
| 103 | <table class="item-details-table"> |
| 104 | |
| 105 | <?php if ( $show_variation && $product->is_type( 'variation' ) ) : ?> |
| 106 | <?php |
| 107 | /** |
| 108 | * Product object representing variation for current item |
| 109 | * |
| 110 | * @var $product \WC_Product_Variation |
| 111 | */ |
| 112 | $attributes = $product->get_attributes(); |
| 113 | |
| 114 | if ( ! empty( $attributes ) ) : |
| 115 | foreach ( $attributes as $name => $value ) : |
| 116 | if ( ! taxonomy_exists( $name ) ) { |
| 117 | continue; |
| 118 | } |
| 119 | |
| 120 | $attribute = get_term_by( 'slug', $value, $name ); |
| 121 | |
| 122 | if ( ! is_wp_error( $attribute ) && ! empty( $attribute->name ) ) { |
| 123 | $value = $attribute->name; |
| 124 | } |
| 125 | ?> |
| 126 | <tr> |
| 127 | <td class="label"> |
| 128 | <?php echo esc_attr( wc_attribute_label( $name, $product ) ); ?>: |
| 129 | </td> |
| 130 | <td class="value"> |
| 131 | <?php echo esc_attr( rawurldecode( $value ) ); ?> |
| 132 | </td> |
| 133 | </tr> |
| 134 | <?php |
| 135 | endforeach; |
| 136 | endif; |
| 137 | ?> |
| 138 | <?php endif; ?> |
| 139 | |
| 140 | <?php if ( $show_dateadded && $item->get_date_added() ) : ?> |
| 141 | <tr> |
| 142 | <td class="label"> |
| 143 | <?php esc_html_e( 'Added on:', 'yith-woocommerce-wishlist' ); ?> |
| 144 | </td> |
| 145 | <td class="value"> |
| 146 | <?php echo esc_html( $item->get_date_added_formatted() ); ?> |
| 147 | </td> |
| 148 | </tr> |
| 149 | <?php endif; ?> |
| 150 | |
| 151 | <?php if ( $show_price || $show_price_variations ) : ?> |
| 152 | <tr> |
| 153 | <td class="label"> |
| 154 | <?php esc_html_e( 'Price:', 'yith-woocommerce-wishlist' ); ?> |
| 155 | </td> |
| 156 | <td class="value"> |
| 157 | <?php |
| 158 | if ( $show_price ) { |
| 159 | echo wp_kses_post( $item->get_formatted_product_price() ); |
| 160 | } |
| 161 | |
| 162 | if ( $show_price_variations ) { |
| 163 | echo wp_kses_post( $item->get_price_variation() ); |
| 164 | } |
| 165 | ?> |
| 166 | </td> |
| 167 | </tr> |
| 168 | <?php endif ?> |
| 169 | |
| 170 | </table> |
| 171 | <?php endif; ?> |
| 172 | </div> |
| 173 | </div> |
| 174 | |
| 175 | <div class="additional-info-wrapper"> |
| 176 | <?php if ( $show_quantity || $show_stock_status ) : ?> |
| 177 | <table class="additional-info"> |
| 178 | <?php if ( $show_quantity ) : ?> |
| 179 | <tr> |
| 180 | <td class="label"> |
| 181 | <?php esc_html_e( 'Quantity:', 'yith-woocommerce-wishlist' ); ?> |
| 182 | </td> |
| 183 | <td class="product-quantity"> |
| 184 | <?php if ( ! $no_interactions && $wishlist->current_user_can( 'update_quantity' ) ) : ?> |
| 185 | <input type="number" min="1" step="1" name="items[<?php echo esc_attr( $item->get_product_id() ); ?>][quantity]" value="<?php echo esc_attr( $item->get_quantity() ); ?>"/> |
| 186 | <?php else : ?> |
| 187 | <?php echo esc_html( $item->get_quantity() ); ?> |
| 188 | <?php endif; ?> |
| 189 | </td> |
| 190 | </tr> |
| 191 | <?php endif; ?> |
| 192 | |
| 193 | <?php if ( $show_stock_status ) : ?> |
| 194 | <tr> |
| 195 | <td class="label"> |
| 196 | <?php esc_html_e( 'Stock:', 'yith-woocommerce-wishlist' ); ?> |
| 197 | </td> |
| 198 | <td class="value"> |
| 199 | <?php echo 'out-of-stock' === $item->get_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>'; ?> |
| 200 | </td> |
| 201 | </tr> |
| 202 | <?php endif ?> |
| 203 | </table> |
| 204 | <?php endif; ?> |
| 205 | |
| 206 | <!-- Add to cart button --> |
| 207 | <?php $show_add_to_cart = apply_filters( 'yith_wcwl_table_product_show_add_to_cart', $show_add_to_cart, $item, $wishlist ); ?> |
| 208 | <?php if ( $show_add_to_cart && $item->is_purchasable() && 'out-of-stock' !== $item->get_stock_status() ) : ?> |
| 209 | <div class="product-add-to-cart"> |
| 210 | <?php woocommerce_template_loop_add_to_cart( array( 'quantity' => $show_quantity ? $item->get_quantity() : 1 ) ); ?> |
| 211 | </div> |
| 212 | <?php endif ?> |
| 213 | |
| 214 | <!-- Change wishlist --> |
| 215 | <?php if ( $move_to_another_wishlist && $available_multi_wishlist && count( $users_wishlists ) > 1 ) : ?> |
| 216 | <div class="move-to-another-wishlist"> |
| 217 | <?php if ( 'select' === $move_to_another_wishlist_type ) : ?> |
| 218 | <select class="change-wishlist selectBox"> |
| 219 | <option value=""><?php esc_html_e( 'Move', 'yith-woocommerce-wishlist' ); ?></option> |
| 220 | <?php |
| 221 | foreach ( $users_wishlists as $wl ) : |
| 222 | /** |
| 223 | * Each of customer wishlists |
| 224 | * |
| 225 | * @var $wl \YITH_WCWL_Wishlist |
| 226 | */ |
| 227 | if ( $wl->get_token() === $wishlist_token ) { |
| 228 | continue; |
| 229 | } |
| 230 | ?> |
| 231 | <option value="<?php echo esc_attr( $wl->get_token() ); ?>"> |
| 232 | <?php echo esc_html( sprintf( '%s - %s', $wl->get_formatted_name(), $wl->get_formatted_privacy() ) ); ?> |
| 233 | </option> |
| 234 | <?php |
| 235 | endforeach; |
| 236 | ?> |
| 237 | </select> |
| 238 | <?php else : ?> |
| 239 | <a href="#move_to_another_wishlist" class="move-to-another-wishlist-button" data-rel="prettyPhoto[move_to_another_wishlist]"> |
| 240 | <?php |
| 241 | /** |
| 242 | * APPLY_FILTERS: yith_wcwl_move_to_another_list_label |
| 243 | * |
| 244 | * Filter the label to move the product to another wishlist. |
| 245 | * |
| 246 | * @param string $label Label |
| 247 | * |
| 248 | * @return string |
| 249 | */ |
| 250 | echo esc_html( apply_filters( 'yith_wcwl_move_to_another_list_label', __( 'Move to another list ›', 'yith-woocommerce-wishlist' ) ) ); |
| 251 | ?> |
| 252 | </a> |
| 253 | <?php endif; ?> |
| 254 | </div> |
| 255 | <?php endif; ?> |
| 256 | |
| 257 | <?php if ( $show_remove_product || $repeat_remove_button ) : ?> |
| 258 | <div class="product-remove"> |
| 259 | <?php |
| 260 | /** |
| 261 | * APPLY_FILTERS: yith_wcwl_remove_product_wishlist_message_title |
| 262 | * |
| 263 | * Filter the title of the button to remove the product from the wishlist. |
| 264 | * |
| 265 | * @param string $title Button title |
| 266 | * |
| 267 | * @return string |
| 268 | */ |
| 269 | ?> |
| 270 | <a href="<?php echo esc_url( $item->get_remove_url() ); ?>" class="remove_from_wishlist" title="<?php echo esc_html( apply_filters( 'yith_wcwl_remove_product_wishlist_message_title', __( 'Remove this product', 'yith-woocommerce-wishlist' ) ) ); ?>"><i class="fa fa-trash"></i></a> |
| 271 | </div> |
| 272 | <?php endif; ?> |
| 273 | </div> |
| 274 | </li> |
| 275 | <?php |
| 276 | endif; |
| 277 | endforeach; |
| 278 | else : |
| 279 | ?> |
| 280 | <p class="wishlist-empty"> |
| 281 | <?php |
| 282 | /** |
| 283 | * APPLY_FILTERS: yith_wcwl_no_product_to_remove_message |
| 284 | * |
| 285 | * Filter the message shown when there are no products in the wishlist. |
| 286 | * |
| 287 | * @param string $message Message |
| 288 | * |
| 289 | * @return string |
| 290 | */ |
| 291 | echo esc_html( apply_filters( 'yith_wcwl_no_product_to_remove_message', __( 'No products added to the wishlist', 'yith-woocommerce-wishlist' ) ) ); |
| 292 | ?> |
| 293 | </p> |
| 294 | <?php endif; ?> |
| 295 | |
| 296 | </ul> |
| 297 | |
| 298 | <?php if ( ! empty( $page_links ) ) : ?> |
| 299 | <nav class="wishlist-pagination"> |
| 300 | <?php echo wp_kses_post( $page_links ); ?> |
| 301 | </nav> |
| 302 | <?php endif; ?> |
| 303 |