· 6 years ago · Dec 03, 2019, 10:48 PM
1<?php
2/**
3 * MedRent - Beta functions and definitions
4 *
5 * @link https://developer.wordpress.org/themes/basics/theme-functions/
6 *
7 * @package MedRent_-_Beta
8 */
9
10if ( ! function_exists( 'medrent_beta_setup' ) ) :
11 /**
12 * Sets up theme defaults and registers support for various WordPress features.
13 *
14 * Note that this function is hooked into the after_setup_theme hook, which
15 * runs before the init hook. The init hook is too late for some features, such
16 * as indicating support for post thumbnails.
17 */
18 function medrent_beta_setup() {
19 /*
20 * Make theme available for translation.
21 * Translations can be filed in the /languages/ directory.
22 * If you're building a theme based on MedRent - Beta, use a find and replace
23 * to change 'medrent-beta' to the name of your theme in all the template files.
24 */
25 load_theme_textdomain( 'medrent-beta', get_template_directory() . '/languages' );
26
27 // Add default posts and comments RSS feed links to head.
28 add_theme_support( 'automatic-feed-links' );
29
30 /*
31 * Let WordPress manage the document title.
32 * By adding theme support, we declare that this theme does not use a
33 * hard-coded <title> tag in the document head, and expect WordPress to
34 * provide it for us.
35 */
36 add_theme_support( 'title-tag' );
37
38 /*
39 * Enable support for Post Thumbnails on posts and pages.
40 *
41 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
42 */
43 add_theme_support( 'post-thumbnails' );
44
45 // This theme uses wp_nav_menu() in one location.
46 register_nav_menus( array(
47 'menu-1' => esc_html__( 'Primary', 'medrent-beta' ),
48 ) );
49 register_nav_menus( array(
50 'menu-2' => esc_html__( 'Secondary', 'medrent-beta' ),
51 ) );
52
53 /*
54 * Switch default core markup for search form, comment form, and comments
55 * to output valid HTML5.
56 */
57 add_theme_support( 'html5', array(
58 'search-form',
59 'comment-form',
60 'comment-list',
61 'gallery',
62 'caption',
63 ) );
64
65 // Set up the WordPress core custom background feature.
66 add_theme_support( 'custom-background', apply_filters( 'medrent_beta_custom_background_args', array(
67 'default-color' => 'ffffff',
68 'default-image' => '',
69 ) ) );
70
71 // Add theme support for selective refresh for widgets.
72 add_theme_support( 'customize-selective-refresh-widgets' );
73
74 /**
75 * Add support for core custom logo.
76 *
77 * @link https://codex.wordpress.org/Theme_Logo
78 */
79 add_theme_support( 'custom-logo', array(
80 'height' => 250,
81 'width' => 250,
82 'flex-width' => true,
83 'flex-height' => true,
84 ) );
85
86 // disable for posts
87 add_filter('use_block_editor_for_post', '__return_false', 10);
88
89 // disable for post types
90 add_filter('use_block_editor_for_page', '__return_false', 10);
91
92 // add tag support to pages
93 function tags_support_all() {
94 register_taxonomy_for_object_type('post_tag', 'page');
95 }
96
97 // ensure all tags are included in queries
98 function tags_support_query($wp_query) {
99 if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');
100 }
101
102 // tag hooks
103 add_action('init', 'tags_support_all');
104 add_action('pre_get_posts', 'tags_support_query');
105
106 }
107endif;
108add_action( 'after_setup_theme', 'medrent_beta_setup' );
109
110/**
111 * Set the content width in pixels, based on the theme's design and stylesheet.
112 *
113 * Priority 0 to make it available to lower priority callbacks.
114 *
115 * @global int $content_width
116 */
117function medrent_beta_content_width() {
118 // This variable is intended to be overruled from themes.
119 // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
120 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
121 $GLOBALS['content_width'] = apply_filters( 'medrent_beta_content_width', 640 );
122}
123add_action( 'after_setup_theme', 'medrent_beta_content_width', 0 );
124
125/**
126 * Register widget area.
127 *
128 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
129 */
130function medrent_beta_widgets_init() {
131 register_sidebar( array(
132 'name' => esc_html__( 'Sidebar', 'medrent-beta' ),
133 'id' => 'sidebar-1',
134 'description' => esc_html__( 'Add widgets here.', 'medrent-beta' ),
135 'before_widget' => '<section id="%1$s" class="widget %2$s">',
136 'after_widget' => '</section>',
137 'before_title' => '<h2 class="widget-title">',
138 'after_title' => '</h2>',
139 ) );
140
141 register_sidebar( array(
142 'name' => esc_html__( 'Sidebar 2', 'medrent-beta' ),
143 'id' => 'sidebar-2',
144 'description' => esc_html__( 'Add widgets here.', 'medrent-beta' ),
145 'before_widget' => '<section id="%1$s" class="widget %2$s">',
146 'after_widget' => '</section>',
147 'before_title' => '<h2 class="widget-title">',
148 'after_title' => '</h2>',
149 ) );
150
151 register_sidebar( array(
152 'name' => esc_html__( 'Sidebar en página de marcas', 'medrent-beta' ),
153 'id' => 'sidebar-3',
154 'description' => esc_html__( 'Add widgets here.', 'medrent-beta' ),
155 'before_widget' => '<section id="%1$s" class="widget %2$s">',
156 'after_widget' => '</section>',
157 'before_title' => '<h2 class="widget-title">',
158 'after_title' => '</h2>',
159 ) );
160}
161add_action( 'widgets_init', 'medrent_beta_widgets_init' );
162
163/**
164 * Enqueue scripts and styles.
165 */
166function medrent_beta_scripts() {
167 wp_enqueue_style( 'bootstrap-css', get_template_directory_uri()."/node_modules/bootstrap/dist/css/bootstrap.min.css" );
168 wp_enqueue_style( 'font-awesome-css', get_template_directory_uri()."/node_modules/font-awesome/css/font-awesome.min.css" );
169 wp_enqueue_style( 'intltellinput-css', get_template_directory_uri()."/node_modules/intl-tel-input/build/css/intlTelInput.css" );
170
171 wp_enqueue_style( 'slick-css', get_template_directory_uri()."/node_modules/slick-carousel/slick/slick.css" );
172 //wp_enqueue_style( 'slick-theme-css', get_template_directory_uri()."/node_modules/slick-carousel/slick/slick-theme.css" );
173
174
175 wp_enqueue_style( 'medrent-beta-style', get_template_directory_uri()."/css/medrent.css" );
176
177 if( is_page( "eventos" ) ){
178 wp_deregister_script('jquery');
179 wp_deregister_script('jquery-ui');
180 wp_enqueue_script( 'jquery-main', get_template_directory_uri() . '/node_modules/jquery/dist/jquery.min.js', array(), array(), true );
181 wp_enqueue_style( 'zabuto-calendar-css', get_template_directory_uri()."/css/zabuto_calendar.min.css" );
182 wp_enqueue_script( 'zabuto-calendar', get_template_directory_uri() . '/js/zabuto_calendar.js', array(), array(), true );
183 }
184
185 wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/node_modules/bootstrap/dist/js/bootstrap.bundle.js', array(), array(), true );
186 wp_enqueue_script( 'intltellinput', get_template_directory_uri() . '/node_modules/intl-tel-input/build/js/intlTelInput.min.js', array(), array(), true );
187
188 wp_enqueue_script( 'slick-carousel', get_template_directory_uri() . '/node_modules/slick-carousel/slick/slick.js', array(), array(), true );
189
190 wp_enqueue_script( 'jquery-validate', get_template_directory_uri() . '/node_modules/jquery-validation/dist/jquery.validate.min.js', array(), array(), true );
191 wp_enqueue_script( 'jquery-validate-additional-methods', get_template_directory_uri() . '/node_modules/jquery-validation/dist/additional-methods.min.js', array(), array(), true );
192
193 //wp_enqueue_script( 'bootstrap-util', get_template_directory_uri() . '/node_modules/bootstrap/js/dist/util.js', array(), array(), true );
194
195 wp_enqueue_script( 'medrent-beta-navigation', get_template_directory_uri() . '/js/navigation.js', array(), array(), true );
196
197 wp_enqueue_script( 'medrent-beta-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), array(), true );
198 wp_enqueue_script( 'medrent-main', get_template_directory_uri() . '/js/main.js', array(), array(), true );
199 wp_localize_script('medrent-main', 'medrent_ajax', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
200
201 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
202 wp_enqueue_script( 'comment-reply' );
203 }
204}
205add_action( 'wp_enqueue_scripts', 'medrent_beta_scripts' );
206
207
208add_action( 'save_post_product', 'update_product_set_sale_cat' );
209function update_product_set_sale_cat( $post_id ) {
210 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
211 return $post_id;
212 }
213
214 if ( ! current_user_can( 'edit_product', $post_id ) ) {
215 return $post_id;
216 }
217
218 if( get_post_status( $post_id ) == 'publish' && isset($_POST['_sale_price']) ) {
219 $sale_price = $_POST['_sale_price'];
220
221 if( $sale_price > 0 && ! has_term( 'Promociones', 'product_cat', $post_id ) ){
222 wp_set_object_terms($post_id, 'promociones', 'product_cat', true );
223 }
224 }
225}
226
227
228/************************** WIDGET PARA EL ACCESO RAPIDO *******************/
229
230function contenido_acceso_rapido(){
231
232 $html = '<style>
233 ul#accesos-rapidos {
234 font-size: .9rem;
235 }
236
237 li {
238 font-size: .8rem;
239 padding-left: 1rem;
240 }
241
242 </style>
243 <ul id="accesos-rapidos">
244 <li>Neurodiagnóstico <a href="/wp-admin/post.php?post=4535&action=edit"> Editar </a>
245 <ul>
246 <li>Electroencefalografía <a href="/wp-admin/post.php?post=4854&action=edit"> Editar </a></li>
247 <li>Electromiógrafo y potenciales evocados <a href="/wp-admin/post.php?post=4856&action=edit"> Editar </a></li>
248 <li>Polisomnógrafo <a href="/wp-admin/post.php?post=4858&action=edit"> Editar </a></li>
249 <li>Monitoreo neurológico intraoperatorio(MNIO) <a href="/wp-admin/post.php?post=4860&action=edit"> Editar </a></li>
250 <li>Consumibles <a href="/wp-admin/post.php?post=5151&action=edit"> Editar </a></li>
251 </ul>
252 </li>
253 <li>Neurotratamiento <a href="/wp-admin/post.php?post=4538&action=edit"> Editar </a>
254 <ul>
255 <li>Estimulación magnética transcreaneal repetitiva (rTMS) <a href="/wp-admin/post.php?post=4864&action=edit"> Editar </a></li>
256 <li>Rehabilitación cognitiva <a href="/wp-admin/post.php?post=4866&action=edit"> Editar </a></li>
257 <li>Rehabilitación neuromotora <a href="/wp-admin/post.php?post=4868&action=edit"> Editar </a></li>
258 </ul>
259 </li>
260 <li>Vascular <a href="/wp-admin/post.php?post=4540&action=edit"> Editar </a>
261 <ul>
262 <li>Doppler transcraneal <a href="/wp-admin/post.php?post=4870&action=edit"> Editar </a></li>
263 <li>Vascular periférico <a href="/wp-admin/post.php?post=4872&action=edit"> Editar </a></li>
264 </ul>
265 </li>
266 <li>Rehabilitación <a href="/wp-admin/post.php?post=295&action=edit"> Editar </a>
267 <ul>
268 <li>Electroterapia <a href="/wp-admin/post.php?post=4874&action=edit"> Editar </a></li>
269 <li>Laser <a href="/wp-admin/post.php?post=4876&action=edit"> Editar </a></li>
270 <li>Magnetoterapia <a href="/wp-admin/post.php?post=4878&action=edit"> Editar </a></li>
271 <li>Ondas de choque <a href="/wp-admin/post.php?post=4881&action=edit"> Editar </a></li>
272 <li>Ultrasonido <a href="/wp-admin/post.php?post=4883&action=edit"> Editar </a></li>
273 <li>Unidades multifuncionales <a href="/wp-admin/post.php?post=4885&action=edit"> Editar </a></li>
274 <li>Tracción lumbar y cervical <a href="/wp-admin/post.php?post=4887&action=edit"> Editar </a></li>
275 <li>Oscilación Profunda <a href="/wp-admin/post.php?post=6209&action=edit"> Editar </a></li>
276 </ul>
277 </li>
278 <li>Biomecánica y Análisis de movimiento <a href="/wp-admin/post.php?post=4586&action=edit"> Editar </a>
279 <ul>
280 <li>ISOCINECIA <a href="/wp-admin/post.php?post=4889&action=edit"> Editar </a></li>
281 <li>Análisis de Marcha <a href="/wp-admin/post.php?post=4891&action=edit"> Editar </a></li>
282 <li>Plataformas de fuerza y baropodometría <a href="/wp-admin/post.php?post=4893&action=edit"> Editar </a></li>
283 <li>Electromiografía de superficie <a href="/wp-admin/post.php?post=4896&action=edit"> Editar </a></li>
284 <li>Laboratorios de movimiento <a href="/wp-admin/post.php?post=4898&action=edit"> Editar </a></li>
285 </ul>
286 </li>
287 <li>Consumibles <a href="/wp-admin/post.php?post=4542&action=edit"> Editar </a>
288 <ul>
289 <li>Agujas EMG <a href="/wp-admin/post.php?post=4900&action=edit"> Editar </a></li>
290 <li>Agujas MNIO <a href="/wp-admin/post.php?post=4902&action=edit"> Editar </a></li>
291 <li>Electrodos <a href="/wp-admin/post.php?post=4904&action=edit"> Editar </a></li>
292 <li>Gorros <a href="/wp-admin/post.php?post=4906&action=edit"> Editar </a></li>
293 <li>Pastas y geles <a href="/wp-admin/post.php?post=4908&action=edit"> Editar </a></li>
294 <li>Puntas de estimulación <a href="/wp-admin/post.php?post=4910&action=edit"> Editar </a></li>
295 <li>Electrodos especiales <a href="/wp-admin/post.php?post=4912&action=edit"> Editar </a></li>
296 </ul>
297 </li>
298 <li>Insumos Hospitalarios <a href="/wp-admin/post.php?post=4850&action=edit"> Editar </a>
299 <ul>
300 <li>Cubrebocas <a href="/wp-admin/post.php?post=4916&action=edit"> Editar </a> </li>
301 </ul>
302 </li>
303 <ul>';
304 echo $html;
305}
306function widget_acceso_rapido() {
307
308 wp_add_dashboard_widget(
309 'widget_acceso_rapido',
310 'Acceso rápido',
311 'contenido_acceso_rapido'
312 );
313}
314add_action( 'wp_dashboard_setup', 'widget_acceso_rapido' );
315
316/** Elementos personalizados para Visual Composer **/
317include __DIR__ . '/inc/vc-elements.php';
318
319/** Elementos personalizados para Productos Woocommerce **/
320include __DIR__ . '/inc/woocommerce-extension.php';
321
322$labels = array(
323 'name' => _x( 'Cotizaciones', 'post type general name', 'medrent' ),
324 'singular_name' => _x( 'Cotizaciones', 'post type singular name', 'medrent' ),
325 'menu_name' => _x( 'Cotizacioness', 'admin menu', 'medrent' ),
326 'name_admin_bar' => _x( 'Cotizaciones', 'add new on admin bar', 'medrent' ),
327 'add_new' => _x( 'Add New', 'Cotizaciones', 'medrent' ),
328 'add_new_item' => __( 'Add New submit', 'medrent' ),
329 'new_item' => __( 'New submit', 'medrent' ),
330 'edit_item' => __( 'Edit submit', 'medrent' ),
331 'view_item' => __( 'View submit', 'medrent' ),
332 'all_items' => __( 'All submits', 'medrent' ),
333 'search_items' => __( 'Search submits', 'medrent' ),
334 'parent_item_colon' => __( 'Parent submits:', 'medrent' ),
335 'not_found' => __( 'No submits found.', 'medrent' ),
336 'not_found_in_trash' => __( 'No submits found in Trash.', 'medrent' )
337 );
338
339$args = array(
340 'labels' => $labels,
341 'description' => "",
342 'public' => false,
343 'publicly_queryable' => true,
344 'show_ui' => true,
345 'show_in_menu' => true,
346 'query_var' => true,
347 'rewrite' => array( 'slug' => 'submits' ),
348 'capability_type' => 'post',
349 'has_archive' => true,
350 'hierarchical' => true,
351 'menu_position' => null,
352 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'page-attributes' )
353 );
354
355register_post_type( 'cotizaciones', $args );
356
357$labels = array(
358 'name' => _x( 'Eventos', 'post type general name', 'medrent' ),
359 'singular_name' => _x( 'Eventos', 'post type singular name', 'medrent' ),
360 'menu_name' => _x( 'Eventos', 'admin menu', 'medrent' ),
361 'name_admin_bar' => _x( 'Eventos', 'add new on admin bar', 'medrent' ),
362 'add_new' => _x( 'Add New', 'Eventos', 'medrent' ),
363 'add_new_item' => __( 'Add New event', 'medrent' ),
364 'new_item' => __( 'New event', 'medrent' ),
365 'edit_item' => __( 'Edit event', 'medrent' ),
366 'view_item' => __( 'View event', 'medrent' ),
367 'all_items' => __( 'All events', 'medrent' ),
368 'search_items' => __( 'Search events', 'medrent' ),
369 'parent_item_colon' => __( 'Parent events:', 'medrent' ),
370 'not_found' => __( 'No events found.', 'medrent' ),
371 'not_found_in_trash' => __( 'No events found in Trash.', 'medrent' )
372 );
373
374$args = array(
375 'labels' => $labels,
376 'description' => "",
377 'public' => true,
378 'publicly_queryable' => true,
379 'show_ui' => true,
380 'show_in_menu' => true,
381 'query_var' => true,
382 //'rewrite' => array( 'slug' => 'evento' ),
383 'capability_type' => 'post',
384 'has_archive' => true,
385 'hierarchical' => true,
386 'menu_position' => null,
387 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields' )
388 );
389
390register_post_type( 'evento', $args );
391
392$labels = array(
393 'name' => _x( 'Testimonios', 'post type general name', 'medrent' ),
394 'singular_name' => _x( 'Testimonios', 'post type singular name', 'medrent' ),
395 'menu_name' => _x( 'Testimonios', 'admin menu', 'medrent' ),
396 'name_admin_bar' => _x( 'Testimonios', 'add new on admin bar', 'medrent' ),
397 'add_new' => _x( 'Add New', 'Testimonios', 'medrent' ),
398 'add_new_item' => __( 'Add New testimonial', 'medrent' ),
399 'new_item' => __( 'New testimonial', 'medrent' ),
400 'edit_item' => __( 'Edit testimonial', 'medrent' ),
401 'view_item' => __( 'View testimonial', 'medrent' ),
402 'all_items' => __( 'All testimonials', 'medrent' ),
403 'search_items' => __( 'Search testimonials', 'medrent' ),
404 'parent_item_colon' => __( 'Parent testimonials:', 'medrent' ),
405 'not_found' => __( 'No testimonials found.', 'medrent' ),
406 'not_found_in_trash' => __( 'No testimonials found in Trash.', 'medrent' )
407 );
408
409$args = array(
410 'labels' => $labels,
411 'description' => "",
412 'public' => true,
413 'publicly_queryable' => true,
414 'show_ui' => true,
415 'show_in_menu' => true,
416 'query_var' => true,
417 //'rewrite' => array( 'slug' => 'evento' ),
418 'capability_type' => 'post',
419 'has_archive' => true,
420 'hierarchical' => true,
421 'menu_position' => null,
422 'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
423 );
424
425register_post_type( 'testimonial', $args );
426
427
428$labels = array(
429 'name' => _x( 'Newletter Submit', 'post type general name', 'medrent' ),
430 'singular_name' => _x( 'Newletter Submit', 'post type singular name', 'medrent' ),
431 'menu_name' => _x( 'Newletter Submit', 'admin menu', 'medrent' ),
432 'name_admin_bar' => _x( 'Newletter Submit', 'add new on admin bar', 'medrent' ),
433 'add_new' => _x( 'Add New', 'Newletter Submit', 'medrent' ),
434 'add_new_item' => __( 'Add New submit', 'medrent' ),
435 'new_item' => __( 'New submit', 'medrent' ),
436 'edit_item' => __( 'Edit submit', 'medrent' ),
437 'view_item' => __( 'View submit', 'medrent' ),
438 'all_items' => __( 'All submit', 'medrent' ),
439 'search_items' => __( 'Search submit', 'medrent' ),
440 'parent_item_colon' => __( 'Parent submit:', 'medrent' ),
441 'not_found' => __( 'No submit found.', 'medrent' ),
442 'not_found_in_trash' => __( 'No submit found in Trash.', 'medrent' )
443 );
444
445$args = array(
446 'labels' => $labels,
447 'description' => "",
448 'public' => true,
449 'publicly_queryable' => true,
450 'show_ui' => true,
451 'show_in_menu' => true,
452 'query_var' => true,
453 //'rewrite' => array( 'slug' => 'evento' ),
454 'capability_type' => 'post',
455 'has_archive' => true,
456 'hierarchical' => true,
457 'menu_position' => null,
458 'supports' => array( 'title', 'editor', 'author' )
459 );
460
461register_post_type( 'newsletter-submit', $args );
462
463add_action( 'wp_ajax_nopriv_combo_productos', "combo_productos" );
464
465function combo_productos( $slug = "" ){
466
467 $response = new stdClass();
468 $response->result = false;
469 $response->products = "";
470
471 $args = array(
472 'post_type' => 'product',
473 'paged' => false
474 );
475
476 if( $brand_id != 'all' ){
477 $args['tax_query'] = array(
478 array(
479 'taxonomy' => 'pwb-brand',
480 'field' => 'slug',
481 'terms' => $_POST['slug']
482 )
483 );
484 }
485
486 $loop = new \WP_Query( $args );
487
488 if( $loop->have_posts() ) {
489
490 $response->result = true;
491 while ( $loop->have_posts() ) : $loop->the_post();
492
493 $product = wc_get_product( get_the_ID() );
494
495 $response->products .= '<option value="'.get_the_ID().'">'.$product->get_title().'</option>';
496
497
498 endwhile;
499 }
500
501 wp_reset_postdata();
502
503 echo json_encode( $response );
504 wp_die();
505
506 }
507
508add_action( 'wp_ajax_nopriv_combo_marcas', "combo_marcas" );
509
510function combo_marcas(){
511 $response = new stdClass();
512 $response->result = false;
513 $response->brands = "";
514
515 $brands_array = \Perfect_Woocommerce_Brands\Perfect_Woocommerce_Brands::get_brands();
516 if( $brands_array ){
517 $response->result = true;
518 foreach ($brands_array as $brand) {
519 $response->brands .= '<option value="'.$brand->slug.'">'.$brand->name.'</option>';
520 }
521 }
522
523 wp_reset_postdata();
524
525 echo json_encode( $response );
526 wp_die();
527}
528
529// Simple, grouped and external products
530add_filter('woocommerce_product_get_price', 'return_custom_price', 99, 2 );
531add_filter('woocommerce_product_get_regular_price', 'return_custom_price', 99, 2 );
532// Variations
533add_filter('woocommerce_product_variation_get_regular_price', 'return_custom_price', 99, 2 );
534add_filter('woocommerce_product_variation_get_price', 'return_custom_price', 99, 2 );
535
536// Variable (price range)
537add_filter('woocommerce_variation_prices_price', 'custom_variable_price', 99, 3 );
538add_filter('woocommerce_variation_prices_regular_price', 'custom_variable_price', 99, 3 );
539function custom_variable_price( $price, $variation, $product ) {
540 global $product;
541
542 if( ! in_array(20, $product->category_ids) ){
543 return $price;
544 }else{
545 return "";
546 }
547}
548
549function return_custom_price($price, $product) {
550
551 global $product;
552
553 if( ! in_array(20, $product->category_ids) ){
554 return $price;
555 }else{
556 return "";
557 }
558
559}
560
561
562add_action( 'wp_ajax_nopriv_newsletter_submit', "newsletter_submit" );
563function newsletter_submit(){
564 $response = new stdClass();
565 $response->result = false;
566
567 parse_str( $_POST['data'], $data);
568 $response->data = $data;
569
570 $post_id = wp_insert_post(
571 array(
572 'post_title'=> $data['correo-electronico'],
573 'post_type'=> 'newsletter-submit',
574 'post_content'=> serialize( $data ),
575 'post_status'=> 'publish'
576 )
577 );
578
579 if( $post_id ){
580 $response->result = true;
581 }
582
583 echo json_encode( $response );
584 wp_die();
585}
586
587add_action( 'wp_ajax_nopriv_buscar_producto_por_marca', "buscar_producto_por_marca" );
588function buscar_producto_por_marca(){
589 $response = new stdClass();
590 $response->result = false;
591 $html = "";
592
593
594 $products = array();
595
596 $args = array(
597 'post_type' => 'product',
598 'posts_per_page' => 5,
599 'paged' => false,
600 's' => $_POST['term']
601 );
602
603 if( $brand_id != 'all' ){
604 $args['tax_query'] = array(
605 array(
606 'taxonomy' => 'pwb-brand',
607 'field' => 'slug',
608 'terms' => $_POST['marca']
609 )
610 );
611 }
612
613 $loop = new \WP_Query( $args );
614
615 if( $loop->have_posts() ) {
616
617 while ( $loop->have_posts() ) : $loop->the_post();
618
619 $product = wc_get_product( get_the_ID() );
620
621 if( $product ){
622
623 $tags = get_the_terms( get_the_ID(), 'product_tag' );
624 $string_tags = "";
625 if( $tags ){
626 foreach ( $tags as $tag ) {
627 $string_tags .= $tag->slug." ";
628 }
629 }
630
631 $html .= '<div class="woocommerce-product col-6 col-md-3 p-3 '.$string_tags.' animated wpb_fadeIn fadeIn" style="overflow: hidden;">
632 <a href="'.get_the_permalink().'">'.woocommerce_get_product_thumbnail().'
633 <h2 class="woocommerce-loop-product__title">'.$product->get_title().'</h2>'.
634 do_shortcode('[add_to_cart id="'.get_the_ID().'" style=""]').
635 '</a>'.
636 '</div>';
637 }
638
639
640
641 endwhile;
642 }
643
644 if( $html != "" ){
645 $response->result = true;
646 $response->html = $html;
647 }
648
649 wp_reset_postdata();
650
651
652 echo json_encode( $response );
653 wp_die();
654}
655
656
657add_action( 'wp_ajax_nopriv_buscar_producto_por_especialidad', "buscar_producto_por_especialidad" );
658function buscar_producto_por_especialidad(){
659 $response = new stdClass();
660 $response->result = false;
661 $html = "";
662
663 $products = array();
664
665 $args = array(
666 'post_type' => 'product',
667 'posts_per_page' => 10,
668 'paged' => false,
669 's' => $_POST['term']
670 );
671
672 if( $brand_id != 'all' ){
673 $args['meta_query'] = array(
674 array(
675 'key' => 'especialidad-field',
676 'value' => $_POST['especialidad'],
677 'compare' => 'LIKE',
678 )
679 );
680 }
681
682 $response->args = $args;
683
684 $loop = new \WP_Query( $args );
685
686 if( $loop->have_posts() ) {
687
688 while ( $loop->have_posts() ) : $loop->the_post();
689
690 $product = wc_get_product( get_the_ID() );
691
692 if( $product ){
693
694 $tags = get_the_terms( get_the_ID(), 'product_tag' );
695 $string_tags = "";
696 if( $tags ){
697 foreach ( $tags as $tag ) {
698 $string_tags .= $tag->slug." ";
699 }
700 }
701
702 $brands = wp_get_object_terms( get_the_ID(), 'pwb-brand' );
703
704 $brand = "";
705
706 if( $brands ){
707 if( isset( $brands[0] ) ){
708 $brand = $brands[0]->slug;
709 }
710 }
711
712 $html .= '<div class="woocommerce-product col-6 col-md-3 p-3 '. $brand .' '. $string_tags .' animated wpb_fadeIn fadeIn" style="overflow: hidden;">
713 <a href="'.get_the_permalink().'">'.woocommerce_get_product_thumbnail().'
714 <h2 class="woocommerce-loop-product__title">'.$product->get_title().'</h2>'.
715 do_shortcode('[add_to_cart id="'.get_the_ID().'" style=""]').
716 '</a>'.
717 '</div>';
718 }
719
720
721
722 endwhile;
723 }
724
725 if( $html != "" ){
726 $response->result = true;
727 $response->html = $html;
728 }
729
730 wp_reset_postdata();
731
732
733 echo json_encode( $response );
734 wp_die();
735}
736
737add_action( 'wp_ajax_nopriv_data_eventos_fecha', "data_eventos_fecha" );
738
739function data_eventos_fecha(){
740 $response = new stdClass();
741
742 $eventos = array();
743
744 $args = array(
745 'post_type' => 'evento',
746 'posts_per_page' => 5,
747 'paged' => false,
748 'meta_query' => array(
749 array(
750 'key' => 'fecha',
751 'value' => $_POST['date'],
752 'compare' => '='
753 )
754 )
755 );
756
757 $loop = new \WP_Query( $args );
758
759 $response->html = "<p>Lo sentimos no hay eventos marcados para esa fecha</p>";
760
761 if( $loop->have_posts() ) {
762
763 $response->html = "";
764 while ( $loop->have_posts() ) : $loop->the_post();
765
766 $image = get_the_post_thumbnail_url( get_the_ID(), "full" );
767 $response->html .= '<article class="my-1 mt-md-3">
768 <a href="'. get_the_permalink() .'" class="blog-title">
769 <h2 class="d-block">
770 '. get_the_title() .'
771 </h2>
772 </a>
773 <div class="row my-2">
774 <div class="col-12">
775 <a href="'. get_the_permalink() .'" class="">
776 <img src="'. $image .'" class="img-fluid">
777 </a>
778 </div>
779 </div>
780
781 <p>'. get_the_excerpt() .'</p>
782
783 <div class="d-block mt-2">
784 <a href="'. get_the_permalink() .'" class="btn btn-green_light rounded-0 mr-4">Leer más</a>
785 <!--<a class="btn btn-sm btn-social-icon btn-twitter rounded-0">
786 <i class="fa fa-twitter" aria-hidden="true"></i> 10
787 </a>
788 <a class="btn btn-sm btn-social-icon btn-facebook rounded-0">
789 <i class="fa fa-facebook" aria-hidden="true"></i> 25
790 </a>
791 <a class="btn btn-sm btn-social-icon btn-google rounded-0">
792 <i class="fa fa-google" aria-hidden="true"></i> 2
793 </a>-->
794 </div>
795
796 </article>';
797 endwhile;
798
799 }
800
801 $response->result = true;
802
803 wp_reset_postdata();
804
805 echo json_encode( $response);
806 wp_die();
807}
808
809add_action( 'wp_ajax_nopriv_data_eventos', "data_eventos" );
810
811function data_eventos(){
812
813 $response = new stdClass();
814
815 $eventos = array();
816
817 $args = array(
818 'post_type' => 'evento',
819 'posts_per_page' => 100,
820 'paged' => false
821 );
822
823 $loop = new \WP_Query( $args );
824
825 if( $loop->have_posts() ) {
826
827 while ( $loop->have_posts() ) : $loop->the_post();
828 $evento = [];
829 $evento["date"] = get_post_meta( get_the_ID(), 'fecha', true );
830 $evento["badge"] = true;
831 $evento["title"] = get_the_title();
832
833 array_push($eventos, $evento);
834 endwhile;
835
836 }
837
838 $response->eventos = $eventos;
839 $response->result = true;
840
841 echo json_encode( $response);
842 wp_die();
843}
844
845add_action( 'wp_ajax_nopriv_cotizacion_submit', "cotizacion_submit" );
846
847function cotizacion_submit(){
848
849 $response = new stdClass();
850
851 parse_str( $_POST['data'], $data);
852 $response->data = $data;
853
854 $post_id = wp_insert_post(
855 array(
856 'post_title'=> $data['nombre-completo'],
857 'post_type'=> 'cotizaciones',
858 'post_content'=> serialize( $data ),
859 'post_status'=> 'publish'
860 )
861 );
862
863 $html = '';
864
865 if( $post_id ){
866 $response->result = true;
867
868 $body = "Nombre: {$data['nombre-completo']} <br>
869 Email: {$data['correo-electronico']} <br>
870 Teléfono: {$data['telefono']} <br>
871 País: {$data['pais']} <br>
872 Equipo: {$data['equipo']} <br>
873 Menssaje: {$data['mensaje']} <br>";
874
875 $headers[] = "From: MedRent <wordpress@med-rent.com>";
876 $headers[] = "Content-Type: text/html; charset=UTF-8\r\n";
877 $headers[] = "Bcc: hjimenez@denumeris.com\r\n";
878
879 echo wp_mail('javiadas@denumeris.com, aramirez@medrent.mx, telemarketing@medrent.mx', 'Cotización ' . get_bloginfo('name'), $body, $headers);
880 //echo wp_mail('pruebasti@denumeris.com', 'Cotización ' . get_bloginfo('name'), $body, $headers);
881
882 }else{
883
884 $response->result = false;
885 }
886
887 echo json_encode( $response);
888 wp_die();
889}
890
891/** Enviar correo para financiamiento **/
892add_action('wp_ajax_nopriv_contacto_formulario', 'enviar_contacto_formulario');
893add_action('wp_ajax_contacto_formulario', 'enviar_contacto_formulario');
894
895function enviar_contacto_formulario() {
896 extract($_POST, EXTR_PREFIX_SAME, "wddx");
897
898 // Enviar datos de contacto
899 $body = "Nombre: {$firstname}<br>" .
900 "Apellidos: {$lastname}<br>" .
901 "Email: {$email}, <br>" .
902 "Empresa: {$companyname}, <br>" .
903 "Tel Fijo: {$homephone}, <br>" .
904 "Tel Móvil: {$mobilephone}, <br>" .
905 "Estado: {$state}, <br>" .
906 "Ciudad: {$city}, <br>" .
907 "Pais: {$pais}, <br><br>";
908
909 if( $custentity8 != '' ){
910 $body .= "Marca: {$custentity8}, <br>";
911 }
912
913 if( $custentity9 != '' ){
914 $body .= "Modelo: {$custentity9}, <br><br>";
915 }
916
917 $body .= "Mensaje: {$comments}";
918
919 $headers[] = "Content-Type: text/html; charset=UTF-8\r\n";
920 $headers[] = "Bcc: hjimenez@denumeris.com\r\n";
921
922 echo wp_mail('javiadas@denumeris.com, aramirez@medrent.mx, telemarketing@medrent.mx', 'Contacto ' . get_bloginfo('name'), $body, $headers);
923
924 // Guardar en DB
925 saveDBValues($_POST);
926
927 // Enviar a NetSuite
928 sendFormValues($_POST);
929}
930
931/** Guardar en DB datos del formulario **/
932function saveDBValues($data){
933 global $wpdb;
934
935 // Validar si existe la tabla,
936 $sqlValidateTable = 'CREATE TABLE IF NOT EXISTS ' . $wpdb->prefix . 'registros_contacto (
937 id INT NOT NULL AUTO_INCREMENT,
938 date DATETIME NULL,
939 firstname VARCHAR(60) NULL,
940 lastname VARCHAR(60) NULL,
941 email VARCHAR(90) NULL,
942 companyname VARCHAR(60) NULL,
943 pais VARCHAR(45) NULL,
944 homephone VARCHAR(15) NULL,
945 mobilephone VARCHAR(15) NULL,
946 state VARCHAR(45) NULL,
947 city VARCHAR(45) NULL,
948 custentity8 VARCHAR(45) NULL,
949 custentity9 VARCHAR(45) NULL,
950 comments VARCHAR(150) NULL,
951 custentity_mx_rfc VARCHAR(45) NULL,
952 PRIMARY KEY (id)
953 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;';
954
955 $wpdb->query( $sqlValidateTable );
956
957 $wpdb->query(
958 $wpdb->prepare('insert into ' . $wpdb->prefix . 'registros_contacto(date, firstname, lastname, email, companyname, pais, homephone, mobilephone, state, city, custentity8, custentity9, comments, custentity_mx_rfc)
959 values (now(), %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
960 array( $data['firstname'], $data['lastname'], $data['email'], $data['companyname'], $data['pais'], $data['homephone'], $data['mobilephone'], $data['state'], $data['city'], $data['custentity8'], $data['custentity9'], $data['comments'], $data['custentity_mx_rfc'] )
961 )
962 );
963}
964
965/** Enviar a url de NetSuite datos de formulario **/
966function sendFormValues($data){
967 // $postItems = array();
968
969 // $postItems['firstname'] = $data['firstname'];
970 // $postItems['lastname'] = $data['lastname'];
971 // $postItems['email'] = $data['email'];
972 // $postItems['companyname'] = $data['companyname'];
973 // $postItems['pais'] = $data['pais'];
974 // $postItems['homephone'] = $data['homephone'];
975 // $postItems['mobilephone'] = $data['mobilephone'];
976 // $postItems['state'] = $data['state'];
977 // $postItems['city'] = $data['city'];
978 // $postItems['custentity8'] = $data['custentity8'];
979 // $postItems['custentity9'] = $data['custentity9'];
980 // $postItems['comments'] = $data['comments'];
981 // $postItems['custentity_mx_rfc'] = $data['custentity_mx_rfc'];
982
983
984 // $postString = implode ('&', $postItems);
985
986
987 // $curl_connection = curl_init($data['url_form']);
988
989
990 // curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
991 // curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
992 // curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
993 // curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
994 // curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
995
996 // curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $postString);
997
998 // $result = curl_exec($curl_connection);
999
1000 // curl_close($curl_connection);
1001
1002}
1003
1004/** Enviar correo para financiamiento **/
1005add_action('wp_ajax_nopriv_financiamiento_formulario', 'enviar_financiamiento_formulario');
1006add_action('wp_ajax_financiamiento_formulario', 'enviar_financiamiento_formulario');
1007
1008function enviar_financiamiento_formulario() {
1009 extract($_POST, EXTR_PREFIX_SAME, "wddx");
1010
1011 // Consultar equipo
1012 $equipo = get_post( $modelo );
1013
1014 $body = '<table style="width: 680px; margin: 0px auto 30px auto; border-collapse: collapse;" border="0">
1015 <tr style="">
1016 <td style="text-align: center;">
1017 <a href="http://med-rent.com/" style="text-decoration: none;">
1018 <img src="http://med-rent.com/wp-content/uploads/2017/09/logo.png" style="margin: 15px 0px 15px 0px;">
1019 </a>
1020 </td>
1021 </tr>
1022 <tr style="background-color: #14abeb;">
1023 <td><br></td>
1024 </tr>
1025 <tr style="background-color: #129590; height: 4px;">
1026 <td></td>
1027 </tr>
1028 </table>
1029 <table style="width: 680px; margin: 0px auto 0px auto; font-family: Verdana; font-size: 12px;">
1030 <tr>
1031 <td>
1032 <p>
1033 Los datos de la persona que se puso en contacto son: <br><br>
1034 </p>
1035 </td>
1036 </tr>
1037 <tr><td><strong>Datos personales </strong></td></tr>
1038 <tr><td><strong>Nombre: </strong> ' . $nombre . '</td></tr>
1039 <tr><td><strong>Email: </strong> ' . $email . '</td></tr>
1040 <tr><td><strong>Dirección: </strong> ' . $direccion . '</td></tr>
1041 <tr><td><strong>Teléfono: </strong> ' . $tel . '</td></tr>
1042 <tr><td><strong>País: </strong> ' . $pais . '</td></tr>
1043 <tr><td><strong>Ciudad: </strong> ' . $ciudad . '</td></tr>
1044 <tr><td><strong>Código Postal: </strong> ' . $cp . '<br><br></td></tr>
1045 <tr><td><strong>Datos del equipo </strong></td></tr>
1046 <tr><td><strong>Marca: </strong> ' . $marca . '</td></tr>
1047 <tr><td><strong>Modelo: </strong> ' . $equipo->post_title . '</td></tr>
1048 </table>
1049 <table style="width: 680px; margin: 30px auto 0px auto; font-family: Verdana; font-size: 12px; border-collapse: collapse; color: #ffffff;" border="0" bgcolor="#073b4c">
1050 <tr>
1051 <td style="text-align: center; padding: 10px;">
1052 Copyright © ' . date('Y') . ' MedRent Derechos Reservados
1053 </td>
1054 </tr>
1055 </table>';
1056
1057 $headers[] = "Content-Type: text/html; charset=UTF-8;\r\n";
1058 $headers[] = "Bcc: hjimenez@denumeris.com\r\n";
1059
1060 //echo wp_mail('contacto@med-rent.com', 'Financiamiento ' . get_bloginfo('name'), $body, $headers);
1061 echo wp_mail('adan@denumeris.com', 'Financiamiento ' . get_bloginfo('name'), $body, $headers);
1062
1063 // Mensaje a usuario
1064 $bodyUser = '<table style="width: 680px; margin: 0px auto 30px auto; border-collapse: collapse;" border="0">
1065 <tr style="">
1066 <td style="text-align: center;">
1067 <a href="http://med-rent.com/" style="text-decoration: none;">
1068 <img src="http://med-rent.com/wp-content/uploads/2017/09/logo.png" style="margin: 15px 0px 15px 0px;">
1069 </a>
1070 </td>
1071 </tr>
1072 <tr style="background-color: #14abeb;">
1073 <td><br></td>
1074 </tr>
1075 <tr style="background-color: #129590; height: 4px;">
1076 <td></td>
1077 </tr>
1078 </table>
1079 <table style="width: 680px; margin: 0px auto 0px auto; font-family: Verdana; font-size: 12px;">
1080 <tr>
1081 <td>
1082 <p>
1083 Gracias por contactarnos, en un plazo no mayor a 48 horas (2 días hábiles), alguno de nuestros agentes te contactará para atender tu solicitud. Te confirmamos los datos que nos hiciste llegar: <br><br>
1084 </p>
1085 </td>
1086 </tr>
1087 <tr><td><strong>Datos personales </strong></td></tr>
1088 <tr><td><strong>Nombre: </strong> ' . $nombre . '</td></tr>
1089 <tr><td><strong>Dirección: </strong> ' . $direccion . '</td></tr>
1090 <tr><td><strong>Teléfono: </strong> ' . $tel . '</td></tr>
1091 <tr><td><strong>País: </strong> ' . $pais . '</td></tr>
1092 <tr><td><strong>Ciudad: </strong> ' . $ciudad . '</td></tr>
1093 <tr><td><strong>Código Postal: </strong> ' . $cp . '<br><br></td></tr>
1094 <tr><td><strong>Datos del equipo </strong></td></tr>
1095 <tr><td><strong>Marca: </strong> ' . $marca . '</td></tr>
1096 <tr><td><strong>Modelo: </strong> ' . $equipo->post_title . '</td></tr>
1097 </table>
1098 <table style="width: 680px; margin: 30px auto 0px auto; font-family: Verdana; font-size: 12px; border-collapse: collapse; color: #ffffff;" border="0" bgcolor="#073b4c">
1099 <tr>
1100 <td>
1101 <p style="text-align: center; padding: 10px;">
1102 Santa Margarita 117, Col. Insurgentes San Borja, Del. Benito Juárez, CP 03100, CDMX. <br>
1103 Horarios: Lun – Vie: 8:30 – 17:00 hrs <br>
1104 Tel.: +52 (55) 6728 6050 <br>
1105 Interior de la República: 01 800-800-6337
1106 </p>
1107 </td>
1108 </tr>
1109 <tr>
1110 <td style="text-align: center; padding: 10px;">
1111 Copyright © ' . date('Y') . ' MedRent Derechos Reservados
1112 </td>
1113 </tr>
1114 </table>';
1115
1116 //echo wp_mail($email, 'Financiamiento ' . get_bloginfo('name'), $bodyUser, $headers);
1117 wp_die();
1118 exit;
1119}
1120
1121/** Enviar correo para servicio técnico **/
1122add_action('wp_ajax_nopriv_servicio_formulario', 'enviar_servicio_formulario');
1123add_action('wp_ajax_servicio_formulario', 'enviar_servicio_formulario');
1124
1125function enviar_servicio_formulario() {
1126 extract($_POST, EXTR_PREFIX_SAME, "wddx");
1127
1128 // Consultar equipo
1129 $equipo = get_post( $modelo );
1130
1131 $body = '<table style="width: 680px; margin: 0px auto 30px auto; border-collapse: collapse;" border="0">
1132 <tr style="">
1133 <td style="text-align: center;">
1134 <a href="http://med-rent.com/" style="text-decoration: none;">
1135 <img src="http://med-rent.com/wp-content/uploads/2017/09/logo.png" style="margin: 15px 0px 15px 0px;">
1136 </a>
1137 </td>
1138 </tr>
1139 <tr style="background-color: #14abeb;">
1140 <td><br></td>
1141 </tr>
1142 <tr style="background-color: #129590; height: 4px;">
1143 <td></td>
1144 </tr>
1145 </table>
1146 <table style="width: 680px; margin: 0px auto 0px auto; font-family: Verdana; font-size: 12px;">
1147 <tr>
1148 <td>
1149 <p>
1150 Los datos de la persona que se puso en contacto son: <br><br>
1151 </p>
1152 </td>
1153 </tr>
1154 <tr><td><strong>Datos personales </strong></td></tr>
1155 <tr><td><strong>Nombre: </strong> ' . $nombre . '</td></tr>
1156 <tr><td><strong>Email: </strong> ' . $email . '</td></tr>
1157 <tr><td><strong>Dirección: </strong> ' . $direccion . '</td></tr>
1158 <tr><td><strong>Teléfono: </strong> ' . $tel . '</td></tr>
1159 <tr><td><strong>País: </strong> ' . $pais . '</td></tr>
1160 <tr><td><strong>Ciudad: </strong> ' . $ciudad . '</td></tr>
1161 <tr><td><strong>Código Postal: </strong> ' . $cp . '<br><br></td></tr>
1162 <tr><td><strong>Datos del equipo </strong></td></tr>
1163 <tr><td><strong>Marca: </strong> ' . $marca . '</td></tr>
1164 <tr><td><strong>Modelo: </strong> ' . $equipo->post_title . '</td></tr>
1165 <tr><td><strong>Número de serie: </strong> ' . $serie . '</td></tr>
1166 <tr><td><strong>Falla o comentarios: </strong> ' . $mensaje . '</td></tr>
1167 </table>
1168 <table style="width: 680px; margin: 30px auto 0px auto; font-family: Verdana; font-size: 12px; border-collapse: collapse; color: #ffffff;" border="0" bgcolor="#073b4c">
1169 <tr>
1170 <td style="text-align: center; padding: 10px;">
1171 Copyright © ' . date('Y') . ' MedRent Derechos Reservados
1172 </td>
1173 </tr>
1174 </table>';
1175
1176 $headers[] = "Content-Type: text/html; charset=UTF-8;\r\n";
1177 $headers[] = "Bcc: hjimenez@denumeris.com\r\n";
1178
1179 //echo wp_mail('contacto@med-rent.com', 'Servicio Técnico ' . get_bloginfo('name'), $body, $headers);
1180 echo wp_mail('adan@denumeris.com', 'Servicio Técnico ' . get_bloginfo('name'), $body, $headers);
1181
1182 $bodyUser = '<table style="width: 680px; margin: 0px auto 30px auto; border-collapse: collapse;" border="0">
1183 <tr style="">
1184 <td style="text-align: center;">
1185 <a href="http://med-rent.com/" style="text-decoration: none;">
1186 <img src="http://med-rent.com/wp-content/uploads/2017/09/logo.png" style="margin: 15px 0px 15px 0px;">
1187 </a>
1188 </td>
1189 </tr>
1190 <tr style="background-color: #14abeb;">
1191 <td><br></td>
1192 </tr>
1193 <tr style="background-color: #129590; height: 4px;">
1194 <td></td>
1195 </tr>
1196 </table>
1197 <table style="width: 680px; margin: 0px auto 0px auto; font-family: Verdana; font-size: 12px;">
1198 <tr>
1199 <td>
1200 <p>
1201 Gracias por contactarnos, en un plazo no mayor a 48 horas (2 días hábiles), alguno de nuestros agentes te contactará para atender tu solicitud. Te confirmamos los datos que nos hiciste llegar: <br><br>
1202 </p>
1203 </td>
1204 </tr>
1205 <tr><td><strong>Datos personales </strong></td></tr>
1206 <tr><td><strong>Nombre: </strong> ' . $nombre . '</td></tr>
1207 <tr><td><strong>Dirección: </strong> ' . $direccion . '</td></tr>
1208 <tr><td><strong>Teléfono: </strong> ' . $tel . '</td></tr>
1209 <tr><td><strong>País: </strong> ' . $pais . '</td></tr>
1210 <tr><td><strong>Ciudad: </strong> ' . $ciudad . '</td></tr>
1211 <tr><td><strong>Código Postal: </strong> ' . $cp . '<br><br></td></tr>
1212 <tr><td><strong>Datos del equipo </strong></td></tr>
1213 <tr><td><strong>Marca: </strong> ' . $marca . '</td></tr>
1214 <tr><td><strong>Modelo: </strong> ' . $equipo->post_title . '</td></tr>
1215 <tr><td><strong>Número de serie: </strong> ' . $serie . '</td></tr>
1216 <tr><td><strong>Falla o comentarios: </strong> ' . $mensaje . '</td></tr>
1217 </table>
1218 <table style="width: 680px; margin: 30px auto 0px auto; font-family: Verdana; font-size: 12px; border-collapse: collapse; color: #ffffff;" border="0" bgcolor="#073b4c">
1219 <tr>
1220 <td>
1221 <p style="text-align: center; padding: 10px;">
1222 Santa Margarita 117, Col. Insurgentes San Borja, Del. Benito Juárez, CP 03100, CDMX. <br>
1223 Horarios: Lun – Vie: 8:30 – 17:00 hrs <br>
1224 Tel.: +52 (55) 6728 6050 <br>
1225 Interior de la República: 01 800-800-6337
1226 </p>
1227 </td>
1228 </tr>
1229 <tr>
1230 <td style="text-align: center; padding: 10px;">
1231 Copyright © ' . date('Y') . ' MedRent Derechos Reservados
1232 </td>
1233 </tr>
1234 </table>';
1235
1236 //echo wp_mail($email, 'Servicio Técnico ' . get_bloginfo('name'), $bodyUser, $headers);
1237
1238 exit;
1239}
1240
1241/* This snippet removes the action that inserts thumbnails to products in teh loop
1242 * and re-adds the function customized with our wrapper in it.
1243 * It applies to all archives with products.
1244 *
1245 * @original plugin: WooCommerce
1246 * @author of snippet: Brian Krogsard
1247 */
1248remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
1249add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
1250/**
1251 * WooCommerce Loop Product Thumbs
1252 **/
1253 if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) {
1254 function woocommerce_template_loop_product_thumbnail() {
1255 echo woocommerce_get_product_thumbnail();
1256 }
1257 }
1258/**
1259 * WooCommerce Product Thumbnail
1260 **/
1261 if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) {
1262
1263 function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0 ) {
1264 global $post, $woocommerce;
1265
1266
1267 $output = '<div class="imagewrapper">';
1268 if ( has_post_thumbnail() ) {
1269
1270 $output .= get_the_post_thumbnail( $post->ID, $size );
1271
1272 } else {
1273
1274 $output .= '<img src="'. woocommerce_placeholder_img_src() .'" alt="Placeholder" />';
1275
1276 }
1277
1278 $output .= '</div>';
1279
1280 return $output;
1281 }
1282
1283 }
1284
1285
1286/**
1287 * Implement the Custom Header feature.
1288 */
1289require get_template_directory() . '/inc/custom-header.php';
1290
1291/**
1292 * Custom template tags for this theme.
1293 */
1294require get_template_directory() . '/inc/template-tags.php';
1295
1296/**
1297 * Functions which enhance the theme by hooking into WordPress.
1298 */
1299require get_template_directory() . '/inc/template-functions.php';
1300
1301/**
1302 * Customizer additions.
1303 */
1304require get_template_directory() . '/inc/customizer.php';
1305
1306require get_template_directory() . '/inc/class-wp-bootstrap-navwalker.php';
1307
1308/**
1309 * Load Jetpack compatibility file.
1310 */
1311if ( defined( 'JETPACK__VERSION' ) ) {
1312 require get_template_directory() . '/inc/jetpack.php';
1313}