$printer) { if (count($printer['materials'])) { foreach ($printer['materials'] as $material_key => $material_id) { if ($_POST['material_id']==$material_id) unset ( $printers_array[$printer_key]['materials'][$material_key] ); } } } update_option( 'p3dlite_printers', $printers_array ); } if ( isset( $_POST['action'] ) && $_POST['action']=='remove_coating' ) { $coatings_array = get_option( 'p3dlite_coatings' ); unset( $coatings_array[(int)$_POST['coating_id']] ); $coatings_array=array_values( $coatings_array ); update_option( 'p3dlite_coatings', $coatings_array ); } if ( isset( $_POST['action'] ) && $_POST['action']=='remove_request' ) { $price_requests=get_option( 'p3dlite_price_requests' ); unset( $price_requests[$_POST['request_id']] ); update_option( 'p3dlite_price_requests', $price_requests ); } if ( isset( $_POST['p3dlite_email_templates'] ) && !empty( $_POST['p3dlite_email_templates'] ) ) { // $templates_update = array_map('wp_kses_post', $_POST['p3dlite_email_templates']); $templates_update = array_map('nl2br', $_POST['p3dlite_email_templates']); update_option( 'p3dlite_email_templates', $templates_update ); } if ( isset( $_POST['p3dlite_printer_name'] ) && count( $_POST['p3dlite_printer_name'] )>0 ) { for ( $i=0;$i0 ) { $printers[$i]['materials']=$_POST['p3dlite_printer_materials'][$i]; } if (isset($_FILES['p3dlite_printer_photo_upload']['tmp_name'][$i]) && strlen($_FILES['p3dlite_printer_photo_upload']['tmp_name'][$i])>0) { $uploaded_file = p3dlite_upload_file('p3dlite_printer_photo_upload', $i); $printers[$i]['photo']=str_replace('http:','',$uploaded_file['url']); } } update_option( 'p3dlite_printers', $printers ); } if ( isset( $_POST['p3dlite_material_name'] ) && count( $_POST['p3dlite_material_name'] )>0 ) { for ( $i=0;$i0) { $uploaded_file = p3dlite_upload_file('p3dlite_material_photo_upload', $i); $materials[$i]['photo']=str_replace('http:','',$uploaded_file['url']); } } update_option( 'p3dlite_materials', $materials ); } if ( isset( $_POST['p3dlite_coating_name'] ) && count( $_POST['p3dlite_coating_name'] )>0 ) { for ( $i=0;$i0 ) { $coatings[$i]['materials']=$_POST['p3dlite_coating_materials'][$i]; } if (isset($_FILES['p3dlite_coating_photo_upload']['tmp_name'][$i]) && strlen($_FILES['p3dlite_coating_photo_upload']['tmp_name'][$i])>0) { $uploaded_file = p3dlite_upload_file('p3dlite_coating_photo_upload', $i); $coatings[$i]['photo']=str_replace('http:','',$uploaded_file['url']); } } update_option( 'p3dlite_coatings', $coatings ); } if ( isset( $_POST['p3dlite_settings'] ) && !empty( $_POST['p3dlite_settings'] ) ) { update_option( 'p3dlite_settings', array_map('sanitize_text_field', $_POST['p3dlite_settings'] )); } if ( isset( $_POST['p3dlite_buynow'] ) && count( $_POST['p3dlite_buynow'] )>0 ) { $settings=get_option( 'p3dlite_settings' ); foreach ( $_POST['p3dlite_buynow'] as $key=>$price ) { if (strstr($key, '_')) { list ( $post_id, $printer_id, $material_id, $coating_id, $base64_filename ) = explode( '_', $key ); } $price_requests=get_option( 'p3dlite_price_requests' ); if (!isset($post_id) || !is_numeric($post_id)) { //new way $price_request=$price_requests[$key]; $post_id = $price_request['product_id']; $printer_id = $price_request['printer_id']; $material_id = $price_request['material_id']; $coating_id = $price_request['coating_id']; $filename = base64_decode($price_request['base64_filename']); #print_r($price_requests[$product_key]); #echo "$product_id, $printer_id, $material_id, $coating_id, $infill, $unit, $scale, $email_address, $filename";exit; } else { $filename=base64_decode( $base64_filename ); } $comments = $_POST['p3d_comments'][$key]; if ( count( $price_requests ) ) { $email=$price_requests[$key]['email']; $variation=$price_requests[$key]['attributes']; if ( $price ) { $price_requests[$key]['price']=$price; $db_printers=get_option( 'p3dlite_printers' ); $db_materials=get_option( 'p3dlite_materials' ); $db_coatings=get_option( 'p3dlite_coatings' ); $upload_dir = wp_upload_dir(); $link = $upload_dir['baseurl'].'/p3d/'.urlencode($filename); $current_templates = get_option( 'p3dlite_email_templates' ); $template_body = $current_templates['client_email_body']; $template_subject = $current_templates['client_email_subject']; $from = $current_templates['client_email_from']; $subject=__( "Your model's price" , '3dprint-lite' ); $dimensions=$price_request['scale_x']." × ".$price_request['scale_y']." × ".$price_request['scale_z']." ".__('cm', '3dprint')."
"; /* foreach ( $variation as $key => $value ) { if ( strpos( $key, 'attribute_' )===0 ) { $attribute_name=str_replace( 'attribute_', '', $key ); $attribute_name=strtoupper( str_replace( '_', ' ', $key ) ); if ( !strstr( $key, 'p3dlite_' ) ) $message.=$attribute_name.": $value
"; } } */ $replace_from = array('[printer_name]', '[material_name]', '[coating_name]', '[model_file]', '[dimensions]', '[price]', '[admin_comments]'); $replace_to = array ($price_request['printer'], $price_request['material'], (isset($price_request['coating']) ? $price_request['coating'] : ''), $link, $dimensions, p3dlite_format_price($price, $settings['currency'], $settings['currency_position']), $comments); $subject=str_ireplace($replace_from, $replace_to, $template_subject); $body=str_ireplace($replace_from, $replace_to, $template_body); do_action( 'p3dlite_send_quote', $body ); $headers = array( 'Content-Type: text/html; charset=UTF-8' ); $headers[] = "From: $from"; if (wp_mail( $email, $subject, stripslashes($body), $headers )) { update_option( 'p3dlite_price_requests', $price_requests ); } else { echo '

' . __('Could not email the quote(s)! Check if your wordpress site can send emails.' ,'3dprint-lite').'

'; } } }//if ( count( $price_requests ) ) }//foreach ( $_POST['p3dlite_buynow'] as $key=>$price ) do_action( 'p3dlite_after_send_quotes' ); }//if ( isset( $_POST['p3dlite_buynow'] ) && count( $_POST['p3dlite_buynow'] )>0 ) # p3dlite_check_install(); $printers=get_option( 'p3dlite_printers' ); $materials=get_option( 'p3dlite_materials' ); $coatings=get_option( 'p3dlite_coatings' ); $settings=get_option( 'p3dlite_settings' ); $price_requests=get_option( 'p3dlite_price_requests' ); $current_templates = get_option( 'p3dlite_email_templates' ); if (count($printers)==0) { $default_printers[]=array( 'name' => 'Default Printer', 'description' => '', 'photo' => '', 'width' => '300', 'length' => '400', 'height' => '300', 'platform_shape' => 'rectangle', 'diameter' => '100', 'full_color' => '1', 'min_side' => '1', 'price' => '0.02', 'materials' => array(0,1), 'price_type' => 'box_volume', 'price_type' => 'box_volume', 'price1' => '0', 'price_type1' => 'box_volume', 'price2' => '0', 'price_type2' => 'box_volume', 'price3' => '0', 'price_type3' => 'box_volume' ); update_option( 'p3dlite_printers', $default_printers ); $printers=get_option( 'p3dlite_printers' ); } if (count($materials)==0) { $default_materials[]=array( 'name' => 'PLA (1.75 mm) Green', 'description' => '', 'photo' => '', 'type' => 'filament', 'density' => '1.26', 'length' => '330', 'diameter' => '1.75', 'weight' => '1', 'price' => '0.03', 'price_type' => 'gram', 'roll_price' => '20', 'color' => '#08c101', 'shininess' => 'plastic', 'transparency' => 'opaque', 'glow' => '0', 'price1' => '0', 'price_type1' => 'cm3', 'price2' => '0', 'price_type2' => 'cm3', ); update_option( 'p3dlite_materials', $default_materials ); $materials=get_option( 'p3dlite_materials' ); } add_thickbox(); #p3dlite_check_install(); ?>


px × px
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Premium version', '3dprint-lite'); ?>

this video you can see how to configure NinjaForms integration.', '3dprint-lite' );?>

 
 


 

0 ) { $i=0; foreach ( $printers as $printer ) { ?>

> > >

ID #$i";?>
 

0 ) { $i=0; foreach ( $materials as $material ) { ?>

 '.$material['name'];?>

ID #$i";?>
 


0 ) { $i=0; foreach ( $coatings as $coating ) { ?>

 '.$coating['name'];?>

ID #$i";?>
 

0 ) { ?> $price_request ) { if (!is_array($price_request)) continue; if (strstr($product_key, '_')) { list ( $post_id, $printer_id, $material_id, $coating_id, $unit, $scale, $email_address, $base64_filename ) = explode( '_', $product_key ); } if (!isset($post_id) || !is_numeric($post_id) || is_null($post_id)) { //new way $post_id = $price_request['product_id']; $printer = $price_request['printer']; $material = $price_request['material']; $coating = $price_request['coating']; // $infill = $price_request['infill']; $unit = $price_request['unit']; $scale = $price_request['scale']; $email_address = $price_request['email']; $filename = base64_decode($price_request['base64_filename']); #print_r($price_requests[$product_key]); #echo "$product_id, $printer_id, $material_id, $coating_id, $infill, $unit, $scale, $email_address, $filename";exit; } else { $filename=base64_decode( $base64_filename ); } $upload_dir = wp_upload_dir(); if ( !isset($price_request['price']) || $price_request['price']=='' ) { $attr_st=''; if (isset($price_request['attributes']) && count($price_request['attributes'])) { foreach ( $price_request['attributes'] as $attr_key => $attr_value ) { if ( $attr_key=='attribute_pa_p3dlite_printer' ) { $attr_st.=__( "Printer" , '3dprint-lite' ).": ".$price_request['printer']."
"; } elseif ( $attr_key=='attribute_pa_p3dlite_material' ) { $attr_st.=__( "Material" , '3dprint-lite' ).": ".$price_request['material']."
"; } elseif ( $attr_key=='attribute_pa_p3dlite_coating' ) { $attr_st.=__( "Coating" , '3dprint-lite' )." : ".$price_request['coating']."
"; } elseif ( $attr_key=='attribute_pa_p3dlite_model' ) { $upload_dir = wp_upload_dir(); $filepath = $upload_dir['basedir']."/p3d/$attr_value"; $original_file = p3dlite_get_original($attr_value); $link = $upload_dir['baseurl'].'/p3d/'.rawurlencode( p3dlite_basename( $attr_value ) ); if (file_exists($original_file) && p3dlite_basename($filepath) != p3dlite_basename($original_file)) { $original_link = $upload_dir['baseurl'] ."/p3d/". rawurlencode(p3dlite_basename($original_file)) ; $attr_st.=__( "Model" , '3dprint-lite' )." : ".p3dlite_basename( $attr_value )."
"; $attr_st.=__( 'Original file', '3dprint-lite' ).' : '.urldecode(urldecode(p3dlite_basename($original_file))).'
'; } else { $attr_st.=__( "Model" , '3dprint-lite' )." : ".p3dlite_basename( $attr_value )."
"; } // if (file_exists($upload_dir['basedir']."/p3d/$attr_value.zip")) { // $link="$link.zip"; // $attr_value="$attr_value.zip"; // } // $attr_st.=__( "Model" , '3dprint-lite' ).": ".p3dlite_basename( $attr_value )."
"; } elseif ( $attr_key=='attribute_pa_p3dlite_unit' ) { $attr_st.=__( "Unit" , '3dprint-lite' ).": ".__( $attr_value )."
"; } else { //$product_attributes=( $product->get_attributes() ); $attribute_name=str_replace( 'attribute_', '', $attr_key ); $attribute_name=strtoupper( str_replace( '_', ' ', $attr_key ) ); $attr_st.=$attribute_name .": $attr_value
"; } } } $attr_st.= __('Resize Scale', '3dprint-lite')." : ".$price_request['resize_scale']."
"; $attr_st.= __('Dimensions', '3dprint-lite')." : ".$price_request['scale_x']." × ".$price_request['scale_y']." × ".$price_request['scale_z']." ".__('cm', '3dprint-lite')."
"; if (isset($price_request['estimated_price'])) { $attr_st.= __('Estimated Price', '3dprint-lite')." : ".p3dlite_format_price($price_request['estimated_price'], $settings['currency'], $settings['currency_position'])."
"; } echo ' '; } } ?>
X
'.__( 'Remove Request', '3dprint-lite' ).' '.get_permalink( $post_id ).' '.__( 'Email', '3dprint-lite' ).' : '.$price_request['email'].'
'.__( 'Comment', '3dprint-lite' ).' : '.$price_request['request_comment'].'
'.$attr_st.' * '.$settings['currency'].'

:

:

: Name Surname <me@example.net>

:

'p3dlite_email_templates[admin_email_body]', 'editor_height'=>100) ); ?>

:

:

: Name Surname <me@example.net>

:

'p3dlite_email_templates[client_email_body]', 'editor_height'=>100) ); ?>