PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.3.2
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.3.2
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / templates / modules / advanced-reviews / modal.php

modal.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 2.3.2, at templates/modules/advanced-reviews/modal.php

147 lines 9.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Template for advanced reviews modal.
5 *
6 * @var $args array module settings.
7 *
8 * @since 1.0
9 */
10
11 global $product;
12 ?>
13 <div class="merchant-adv-reviews-modal">
14 <div class="merchant-adv-reviews-modal-body">
15 <a href="#" class="merchant-adv-reviews-modal-close" title="<?php echo esc_attr__( 'Close popup', 'merchant' ); ?>">
16 <i class="ws-svg-icon icon-cancel">
17 <?php echo wp_kses( Merchant_SVG_Icons::get_svg_icon( 'icon-cancel' ), merchant_kses_allowed_tags( array(), false ) ); ?>
18 </i>
19 </a>
20 <div class="merchant-adv-reviews-modal-content">
21 <h4 class="modal-title"><?php echo esc_html__( 'You are reviewing', 'merchant' ); ?></h4>
22 <div class="merchant-adv-reviews-modal-product">
23 <?php echo get_the_post_thumbnail( $product->get_id(), 'woocommerce_thumbnail' ); ?>
24 <div class="modal-product-info">
25 <h5><?php echo esc_html( $product->get_name() ); ?></h5>
26 <p><?php echo wp_kses_post( strip_shortcodes( $product->get_short_description() ) ); ?></p>
27 </div>
28 </div>
29 <div class="merchant-adv-reviews-modal-rating">
30 <?php if ( get_option( 'woocommerce_review_rating_verification_required' ) === 'no' || wc_customer_bought_product( '', get_current_user_id(), $product->get_id() ) ) : ?>
31 <div id="review_form_wrapper">
32 <div id="review_form">
33 <?php
34 $commenter = wp_get_current_commenter();
35 $comment_form = array(
36 /* translators: %s is product title */
37 'title_reply' => '',
38 /* translators: %s is product title */
39 'title_reply_to' => esc_html__( 'Leave a Reply to %s', 'merchant' ),
40 'title_reply_before' => '<span id="reply-title" class="comment-reply-title">',
41 'title_reply_after' => '</span>',
42 'comment_notes_after' => '',
43 'label_submit' => esc_html__( 'Submit', 'merchant' ),
44 'logged_in_as' => '',
45 'comment_field' => '',
46 );
47
48 $name_email_required = (bool) get_option( 'require_name_email', 1 );
49
50 $fields = array(
51 'author' => array(
52 'label' => esc_html__( 'Name', 'merchant' ),
53 'type' => 'text',
54 'value' => $commenter['comment_author'],
55 'required' => $name_email_required,
56 ),
57 'email' => array(
58 'label' => esc_html__( 'Email', 'merchant' ),
59 'type' => 'email',
60 'value' => $commenter['comment_author_email'],
61 'required' => $name_email_required,
62 ),
63 );
64
65 $comment_form['fields'] = array();
66
67 foreach ( $fields as $key => $field ) {
68 $field_html = '<p class="comment-form-' . esc_attr( $key ) . '">';
69 $field_html .= '<label for="' . esc_attr( $key ) . '">' . esc_html( $field['label'] );
70
71 if ( $field['required'] ) {
72 $field_html .= '&nbsp;<span class="required">*</span>';
73 }
74
75 $field_html .= '</label><input id="' . esc_attr( $key ) . '" name="' . esc_attr( $key ) . '" type="' . esc_attr( $field['type'] ) . '" value="' . esc_attr( $field['value'] ) . '" size="30" ' . ( $field['required'] ? 'required' : '' ) . '/></p>';
76
77 $comment_form['fields'][ $key ] = $field_html;
78 }
79
80 $account_page_url = wc_get_page_permalink( 'myaccount' );
81 if ( $account_page_url ) {
82 /* translators: %s opening and closing link tags respectively */
83 $comment_form['must_log_in'] = '<p class="must-log-in">' . sprintf( esc_html__( 'You must be %1$slogged in%2$s to post a review.', 'merchant' ),
84 '<a href="' . esc_url( $account_page_url ) . '">',
85 '</a>' ) . '</p>';
86 }
87
88 if ( wc_review_ratings_enabled() ) {
89 $comment_form['comment_field'] = '<div class="comment-form-rating"><label class="modal-title" for="rating">' . esc_html__( 'Rating',
90 'merchant' ) . ( wc_review_ratings_required() ? '&nbsp;<span class="required">*</span>' : '' ) . '</label><select name="rating" id="rating" required>
91 <option value="">' . esc_html__( 'Rate&hellip;', 'merchant' ) . '</option>
92 <option value="5">' . esc_html__( 'Perfect', 'merchant' ) . '</option>
93 <option value="4">' . esc_html__( 'Good', 'merchant' ) . '</option>
94 <option value="3">' . esc_html__( 'Average', 'merchant' ) . '</option>
95 <option value="2">' . esc_html__( 'Not that bad', 'merchant' ) . '</option>
96 <option value="1">' . esc_html__( 'Very poor', 'merchant' ) . '</option>
97 </select></div>';
98 }
99
100 if ( isset( $args['review_options'] ) ) {
101
102 // Enable comment field for image and text or text only.
103 if ( 'image_and_text' === $args['review_options'] || 'text' === $args['review_options'] ) {
104 $comment_form['comment_field'] .= '<p class="comment-form-comment"><label class="modal-title" for="comment">' . esc_html__( 'Your review', 'merchant' ) . '&nbsp;<span class="required">*</span></label><textarea id="comment" name="comment" cols="45" rows="5" required></textarea></p>';
105 }
106
107 // Enable image upload field for image and text or image only.
108 if ( 'image_and_text' === $args['review_options'] || 'image' === $args['review_options'] ) {
109 $comment_form['comment_field'] .= '<div class="merchant-adv-reviews-media">';
110 // translators: %s is the number of photos limit
111 $comment_form['comment_field'] .= '<label class="modal-title" for="review_images">' . sprintf( esc_html__( 'Upload images (up to %s)', 'merchant' ), $args['photos_limit'] ) . '</label>';
112 $comment_form['comment_field'] .= '<input type="file" id="merchant-adv-review-images" name="review_images[]" accept="image/*" multiple>';
113 $comment_form['comment_field'] .= '<div id="merchant-adv-reviews-drop-area">';
114 $comment_form['comment_field'] .= '<svg class="merchant-adv-reviews-upload-icon" width="36" height="36" viewBox="0 0 50 50" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect fill="none" height="50" width="50"/><path d="M32,35c0,0,8.312,0,9.098,0C45.463,35,49,31.463,49,27.099s-3.537-7.902-7.902-7.902c-0.02,0-0.038,0.003-0.058,0.003 c0.061-0.494,0.103-0.994,0.103-1.504c0-6.71-5.439-12.15-12.15-12.15c-5.229,0-9.672,3.309-11.386,7.941 c-1.087-1.089-2.591-1.764-4.251-1.764c-3.319,0-6.009,2.69-6.009,6.008c0,0.085,0.01,0.167,0.013,0.251 C3.695,18.995,1,22.344,1,26.331C1,31.119,4.881,35,9.67,35c0.827,0,8.33,0,8.33,0" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"/><polyline fill="none" points="20,28 25,23 30,28" stroke="#000000" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/><line fill="none" stroke="#000000" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" x1="25" x2="25" y1="43" y2="23.333"/></svg>';
115 $comment_form['comment_field'] .= '<p class="merchant-adv-reviews-upload-text">' . esc_html__( 'Drag and drop images here or click to upload', 'merchant' ) . '</p>';
116 $comment_form['comment_field'] .= '<div class="merchant-adv-reviews-loader"><svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path fill="#000" d="M288 39.056v16.659c0 10.804 7.281 20.159 17.686 23.066C383.204 100.434 440 171.518 440 256c0 101.689-82.295 184-184 184-101.689 0-184-82.295-184-184 0-84.47 56.786-155.564 134.312-177.219C216.719 75.874 224 66.517 224 55.712V39.064c0-15.709-14.834-27.153-30.046-23.234C86.603 43.482 7.394 141.206 8.003 257.332c.72 137.052 111.477 246.956 248.531 246.667C393.255 503.711 504 392.788 504 256c0-115.633-79.14-212.779-186.211-240.236C302.678 11.889 288 23.456 288 39.056z" /></svg>';
117 $comment_form['comment_field'] .= '</div></div>';
118 $comment_form['comment_field'] .= '<input id="merchant-adv-review-images-holder" type="hidden" name="review_images_ids" value="" />';
119 $comment_form['comment_field'] .= '<div class="merchant-adv-reviews-upload-preview"></div>';
120 $comment_form['comment_field'] .= '</div>';
121
122 // Add nonce field for review images attachment.
123 $comment_form['comment_field'] .= wp_nonce_field( 'merchant_adv_reviews_upload_images', 'reviews_images_nonce', true, false );
124 }
125
126 }
127
128 comment_form(
129 /**
130 * Hook: woocommerce_product_review_comment_form_args
131 *
132 * @since 1.0
133 *
134 */
135 apply_filters( 'woocommerce_product_review_comment_form_args', $comment_form ),
136 $product->get_id()
137 );
138 ?>
139 </div>
140 </div>
141 <?php else : ?>
142 <p class="woocommerce-verification-required"><?php esc_html_e( 'Only logged in customers who have purchased this product may leave a review.', 'merchant' ); ?></p>
143 <?php endif; ?>
144 </div>
145 </div>
146 </div>
147 </div>