$inf_value) { if ($inf_value['infill']==$infill) { $infill_id = $inf_value['id']; $infill_name = $inf_value['name']; } } } $settings=get_option( 'p3dlite_settings' ); $error=false; $upload_dir = wp_upload_dir(); if ( strlen( $model_file )==0 || !is_file( $upload_dir['basedir'].'/p3d/'.$model_file ) || strlen( $printer_id )==0 || strlen( $material_id )==0 ) { $error=true; $p3dlite_email_status = 3; $p3dlite_email_status_message=esc_html__( 'File name must only contain latin characters and numbers.' , '3dprint-lite' ); } if ( empty( $email_address ) ) { $error=true; $p3dlite_email_status = 4; $p3dlite_email_status_message=esc_html__( 'Please enter valid email address.' , '3dprint-lite' ); } if ( !$error ) { $p3dlite_price_request=array(); $p3dlite_price_request['printer'] = $db_printers[$printer_id]['name']; $p3dlite_price_request['material'] = $db_materials[$material_id]['name']; $p3dlite_price_request['coating'] = (isset($db_coatings[$coating_id]) ? $db_coatings[$coating_id]['name'] : '') ; $p3dlite_price_request['printer_id'] = $printer_id; $p3dlite_price_request['material_id'] = $material_id; $p3dlite_price_request['coating_id'] = $coating_id; $p3dlite_price_request['product_id'] = $product_id; $p3dlite_price_request['infill'] = $infill; $p3dlite_price_request['unit'] = $unit; $p3dlite_price_request['scale'] = $scale; # $p3dlite_price_request['base64_filename'] = base64_encode( p3dlite_basename( $model_file )); $p3dlite_price_request['thumbnail_url'] = $thumbnail_url; $p3dlite_price_request['model_file'] = $model_file; $p3dlite_price_request['original_filename'] = $model_file; $p3dlite_price_request['quantity'] = $quantity; $current_templates = get_option( 'p3dlite_email_templates' ); $template_body = $current_templates['admin_email_body']; $template_subject = $current_templates['admin_email_subject']; $from = $current_templates['admin_email_from']; $p3dlite_price_request['price']=''; $p3dlite_price_request['estimated_price']=(float)$_POST['p3dlite_estimated_price']; $p3dlite_price_request['scale']=(float)$_POST['p3dlite_resize_scale']; $p3dlite_price_request['scale_x']=(float)$_POST['p3dlite_scale_x']; $p3dlite_price_request['scale_y']=(float)$_POST['p3dlite_scale_y']; $p3dlite_price_request['scale_z']=(float)$_POST['p3dlite_scale_z']; $p3dlite_price_request['weight']=(float)$_POST['p3dlite_weight']; $p3dlite_price_request['email']=$email_address; $p3dlite_price_request['request_comment']=$request_comment; p3dlite_update_option( "p3dlite_price_requests", $p3dlite_price_request ); $request_id = (int)$wpdb->insert_id; // $request_comment $upload_dir = wp_upload_dir(); $filepath = $upload_dir['basedir']."/p3d/$model_file"; //$original_file = p3dlite_get_original($model_file); $link = $upload_dir['baseurl'].'/p3d/'.rawurlencode( p3dlite_basename( $model_file ) ); $dimensions = (float)$_POST['p3dlite_scale_x']." × ".(float)$_POST['p3dlite_scale_y']." × ".(float)$_POST['p3dlite_scale_z']." ".__('cm', '3dprint-lite'); $scale = (float)$_POST['p3dlite_resize_scale']; $replace_from = array('[customer_email]','[quantity]', '[printer_name]','[material_name]','[coating_name]','[infill]','[infill_name]','[model_file]','[unit]','[resize_scale]','[dimensions]','[estimated_price]','[estimated_price_total]', '[customer_comments]','[price_requests_link]'); $replace_to = array($email_address, $quantity, $db_printers[$printer_id]['name'], $db_materials[$material_id]['name'], (isset($db_coatings[$coating_id]['name']) ? $db_coatings[$coating_id]['name'] : ''), $infill, $infill_name, $link, $unit, $scale, $dimensions, p3dlite_format_price($p3dlite_price_request['estimated_price'], $settings['currency'], $settings['currency_position']), p3dlite_format_price($p3dlite_price_request['estimated_price']*$quantity, $settings['currency'], $settings['currency_position']), $request_comment, "".admin_url( 'admin.php?page=p3dlite_price_requests&action=edit&price_request='.$request_id ).""); $subject=str_ireplace($replace_from, $replace_to, $template_subject); $body=str_ireplace($replace_from, $replace_to, $template_body); # $headers = array( 'Content-Type: text/html; charset=UTF-8' ); # $headers[] = "From: $from"; $headers = array(); $headers[] = "From: $from"; $headers[] = 'Content-Type: text/html; charset=UTF-8'; if ( wp_mail( $settings['email_address'], $subject, stripslashes($body), $headers ) ) { $p3dlite_email_status = 1; $p3dlite_email_status_message = esc_html__( 'Store owner has been notified about your request. You\'ll receive the email with the price shortly.' , '3dprint-lite' ); } else { $p3dlite_email_status = 0; $p3dlite_email_status_message = esc_html__( 'Could not send the email. Please try again later.' , '3dprint-lite' ); } p3dlite_clear_cookies(); do_action( 'p3dlite_request_price' ); } } } add_shortcode( '3dprint-lite', 'p3d_lite' ); function p3d_lite( $atts ) { global $p3dlite_email_status_message, $p3dlite_email_status, $post; $db_printers=p3dlite_get_option( 'p3dlite_printers' ); $db_materials=p3dlite_get_option( 'p3dlite_materials' ); $db_coatings=p3dlite_get_option( 'p3dlite_coatings' ); $db_infills=p3dlite_get_option( 'p3dlite_infills' ); $settings=get_option( 'p3dlite_settings' ); ob_start(); ?>
Loading file

Upload

 

 

 

 

 

 


     
%
 
× ×  

	
:
:
:
:
: x x

'.esc_html__( 'Estimated Price:', '3dprint-lite' ).'';?>

Loading price
'.esc_html($p3dlite_email_status_message).'
'; } elseif ($p3dlite_email_status!=1) { echo '
'.esc_html($p3dlite_email_status_message).'
'; } } ?>


$material) { # if (!in_array($key, $assigned_materials)) unset($db_materials[$key]); #} //prepare photos and descriptions echo '
'; foreach ( $db_printers as $db_printer ) { $i = $db_printer['id']; if (strlen($db_printer['description']) || strlen($db_printer['photo'])) { echo '
'; if (strlen($db_printer['description']) == 0) $image_class = 'p3dlite-tooltip-image-full'; else $image_class = ''; if (strlen($db_printer['photo'])) echo '
'; if (strlen($db_printer['description'])) echo '
'.esc_html__(stripslashes($db_printer['description'])).'
'; echo '
'; } } foreach ( $db_materials as $db_material ) { $i = $db_material['id']; if (strlen($db_material['description']) || strlen($db_material['photo'])) { echo '
'; if (strlen($db_material['description']) == 0) $image_class = 'p3dlite-tooltip-image-full'; else $image_class = ''; if (strlen($db_material['photo'])) echo '
'; if (strlen($db_material['description'])) echo '
'.esc_html__(stripslashes($db_material['description'])).'
'; echo '
'; } } foreach ( $db_coatings as $db_coating ) { $i = $db_coating['id']; if (strlen($db_coating['description']) || strlen($db_coating['photo'])) { echo '
'; if (strlen($db_coating['description']) == 0) $image_class = 'p3dlite-tooltip-image-full'; else $image_class = ''; if (strlen($db_coating['photo'])) echo '
'; if (strlen($db_coating['description'])) echo '
'.esc_html__(stripslashes($db_coating['description'])).'
'; echo '
'; } } foreach ( $db_infills as $db_infill ) { $i = $db_infill['id']; if (strlen($db_infill['description']) || strlen($db_infill['photo'])) { echo '
'; if (strlen($db_infill['description']) == 0) $image_class = 'p3dlite-tooltip-image-full'; else $image_class = ''; if (strlen($db_infill['photo'])) echo '
'; if (strlen($db_infill['description'])) echo '
'.esc_html__(stripslashes($db_infill['description'])).'
'; echo '
'; } } echo '
'; if ($settings['selection_order']=='materials_printers') { switch ($settings['materials_layout']) { case 'lists': include('templates/template_material_list.php'); break; case 'dropdowns': include('templates/template_material_dropdown.php'); break; case 'dropdown_new': include('templates/template_material_dropdown_new.php'); break; case 'colors': include('templates/template_material_colors.php'); break; default: include('templates/template_material_list.php'); break; } switch ($settings['coatings_layout']) { case 'lists': include('templates/template_coating_list.php'); break; case 'dropdowns': include('templates/template_coating_dropdown.php'); break; case 'dropdown_new': include('templates/template_coating_dropdown_new.php'); break; case 'colors': include('templates/template_coating_colors.php'); break; default: include('templates/template_coating_list.php'); break; } switch ($settings['printers_layout']) { case 'lists': include('templates/template_printer_list.php'); break; case 'dropdowns': include('templates/template_printer_dropdown.php'); break; case 'dropdown_new': include('templates/template_printer_dropdown_new.php'); break; default: include('templates/template_printer_list.php'); break; } switch ($settings['infills_layout']) { case 'lists': include('templates/template_infill_list.php'); break; case 'dropdowns': include('templates/template_infill_dropdown.php'); break; case 'dropdown_new': include('templates/template_infill_dropdown_new.php'); break; default: include('templates/template_infill_list.php'); break; } } elseif ($settings['selection_order']=='printers_materials') { switch ($settings['printers_layout']) { case 'lists': include('templates/template_printer_list.php'); break; case 'dropdowns': include('templates/template_printer_dropdown.php'); break; case 'dropdown_new': include('templates/template_printer_dropdown_new.php'); break; default: include('templates/template_printer_list.php'); break; } switch ($settings['infills_layout']) { case 'lists': include('templates/template_infill_list.php'); break; case 'dropdowns': include('templates/template_infill_dropdown.php'); break; case 'dropdown_new': include('templates/template_infill_dropdown_new.php'); break; default: include('templates/template_infill_list.php'); break; } switch ($settings['materials_layout']) { case 'lists': include('templates/template_material_list.php'); break; case 'dropdowns': include('templates/template_material_dropdown.php'); break; case 'dropdown_new': include('templates/template_material_dropdown_new.php'); break; case 'colors': include('templates/template_material_colors.php'); break; default: include('templates/template_material_list.php'); break; } switch ($settings['coatings_layout']) { case 'lists': include('templates/template_coating_list.php'); break; case 'dropdowns': include('templates/template_coating_dropdown.php'); break; case 'dropdown_new': include('templates/template_coating_dropdown_new.php'); break; case 'colors': include('templates/template_coating_colors.php'); break; default: include('templates/template_coating_list.php'); break; } } ?>