| @@ -69,8 +69,9 @@ | ||
| 69 | 69 | wp_die( esc_html__( 'You don\'t have permission to perform this action', 'shopbuilder' ) ); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check if the user is not logged in and the provided 'user_id' in the request does not match the currently logged-in user's ID. |
| 73 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 73 | 74 | if ( ! is_user_logged_in() && $user->ID !== sanitize_text_field( $_REQUEST['user_id'] ) ) { |
| 74 | 75 | wp_die( esc_html__( 'You don\'t have proper authorization to perform this action', 'shopbuilder' ) ); |
| 75 | 76 | } |
| 76 | 77 | |
| @@ -115,8 +116,9 @@ | ||
| 115 | 116 | |
| 116 | 117 | $_rtsb_import_id = get_post_meta( $post_id, '_rtsb_import_id', true ); |
| 117 | 118 | } |
| 118 | 119 | |
| 120 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 119 | 121 | $status = $_REQUEST['status'] ?? ''; |
| 120 | 122 | $post_args = [ 'timeout' => 120 ]; |
| 121 | 123 | $post_args['body'] = [ |
| 122 | 124 | 'status' => $status, |
| @@ -184,8 +186,15 @@ | ||
| 184 | 186 | <?php } ?> |
| 185 | 187 | </select> |
| 186 | 188 | </div> |
| 187 | 189 | |
| 190 | + <?php if ( ! rtsb()->has_pro() ) { ?> | |
| 191 | + <div class="rtsb-product-page-for rtsb-tb-field-wraper" style="display:none;" > | |
| 192 | + <label for="product_page_for"> </label> | |
| 193 | + <span class="elementor-pro-notice"><a target="_blank" href="<?php echo esc_url( rtsb()->pro_version_link() ); ?>">Upgrade to PRO</a> to unlock Product Categories, Product Tags, Selected Products</span> | |
| 194 | + </div> | |
| 195 | + <?php } ?> | |
| 196 | + | |
| 188 | 197 | <!-- Product Page For Categories --> |
| 189 | 198 | <div class="rtsb-categories-page-field rtsb-product-page-for-the-categories rtsb-tb-field-wraper <?php echo esc_attr( ! rtsb()->has_pro() ? 'pro-disable' : '' ); ?>" style="display:none;"> |
| 190 | 199 | <?php |
| 191 | 200 | $default_items_link = ''; |
| @@ -226,8 +235,15 @@ | ||
| 226 | 235 | ?> |
| 227 | 236 | </p> |
| 228 | 237 | </div> |
| 229 | 238 | |
| 239 | + <?php if ( ! rtsb()->has_pro() ) { ?> | |
| 240 | + <div class="rtsb-categories-page-field rtsb-product-page-for-the-categories rtsb-tb-field-wraper" style="display:none;"> | |
| 241 | + <label for="product_page_for"> </label> | |
| 242 | + <span class="elementor-pro-notice"><a target="_blank" href="<?php echo esc_url( rtsb()->pro_version_link() ); ?>">Upgrade to PRO</a> to unlock Categories Base Prodcut Page.</span> | |
| 243 | + </div> | |
| 244 | + <?php } ?> | |
| 245 | + | |
| 230 | 246 | <!-- Product Page for Selected Product Tags--> |
| 231 | 247 | <div class="rtsb-product-tags-page-field rtsb-product-page-for-the-tags rtsb-tb-field-wraper <?php echo esc_attr( ! rtsb()->has_pro() ? 'pro-disable' : '' ); ?>" style="display:none;"> |
| 232 | 248 | <?php |
| 233 | 249 | $default_items_link = ''; |
| @@ -310,11 +326,14 @@ | ||
| 310 | 326 | <div class="rtsb-product-page-preview-field rtsb-tb-field-wraper" style="display:none;"> |
| 311 | 327 | <?php |
| 312 | 328 | $default_items = ''; |
| 313 | 329 | $product_id = get_post_meta( $post_id, BuilderFns::$product_template_meta, true ); |
| 314 | - if ( $product_id ) { | |
| 330 | + if ( $product_id && get_post_status( $product_id ) ) { | |
| 315 | 331 | $default_items = '<option selected="selected" value="' . $product_id . '">' . get_the_title( $product_id ) . ' - ( ID ' . $product_id . ' )</option>'; |
| 316 | 332 | } |
| 333 | + if ( $product_id && ! get_post_status( $product_id ) ) { | |
| 334 | + delete_post_meta( $post_id, BuilderFns::$product_template_meta ); | |
| 335 | + } | |
| 317 | 336 | ?> |
| 318 | 337 | <label for="rtsb_product_page_preview"><?php esc_html_e( 'Select Preview Product', 'shopbuilder' ); ?></label> |
| 319 | 338 | <select class="rtsb-field" id="rtsb_product_page_preview" name="rtsb_product_page_preview"> |
| 320 | 339 | <?php Fns::print_html( $default_items, true ); ?> |
| @@ -347,9 +366,9 @@ | ||
| 347 | 366 | $set_default_option_name = BuilderFns::option_name_product_page_specific_cat_set_default( $post_id ); |
| 348 | 367 | } elseif ( 'product_tags' === $product_page_for ) { |
| 349 | 368 | $set_default_option_name = BuilderFns::option_name_product_page_specific_tag_set_default( $post_id ); |
| 350 | 369 | } |
| 351 | - $default_id = TemplateSettings::instance()->get_option( $set_default_option_name ); | |
| 370 | + $default_id = ! empty( $set_default_option_name ) && TemplateSettings::instance()->get_option( $set_default_option_name ); | |
| 352 | 371 | if ( $default_id ) { |
| 353 | 372 | $template_default = $post_id; |
| 354 | 373 | } |
| 355 | 374 | } |
| @@ -369,9 +388,9 @@ | ||
| 369 | 388 | type="checkbox" |
| 370 | 389 | id="default_template" |
| 371 | 390 | name="default_template" |
| 372 | 391 | value="default_template" |
| 373 | - <?php echo esc_attr( ( $post_id && absint( $post_id ) === absint( $template_default ) ) ? 'checked' : '' ); ?> | |
| 392 | + <?php echo esc_attr( ( $post_id && ( absint( $post_id ) === absint( $template_default ) ) ) ? 'checked' : '' ); ?> | |
| 374 | 393 | > |
| 375 | 394 | <span class="rtsb-slider rtsb-round "> |
| 376 | 395 | <span class="rtsb-loader"></span> |
| 377 | 396 | </span> |