Hi guys i have a problem with my form in ajax, i am using ajaxSubmit because i need upload files in the form, so this is my jquery code for the forms:
var send_form = function(form_id, btn_id, fail_id, done_id){
var sending_contact_form = false;
var contact_captcha = $('.codecatch').text();
setTimeout(function(){
$(".botCode").each(function(){
$(this).val(contact_captcha);
});
}, 3000);
$(form_id).submit(function(e){
e.preventDefault();
e.stopPropagation();
var form = $(this).ajaxSubmit({});
if ($(".codecatch").html() == $(".botCode").val() ) {
if(!sending_contact_form){
sending_contact_form = true;
var action = $(this).attr('action');
var btn = $(this).find(btn_id);
btn.val($(btn_id).data('sending'));
var xhr = form.data('jqxhr');
xhr.fail(function(){
$(done_id).fadeOut();
$(fail_id).fadeIn();
}).done(function(data){
btn.val($(btn_id).data('send'));
$(fail_id).fadeOut();
$(done_id).fadeIn().css("display","inline-block");
//$(this).trigger("reset");
setTimeout(function() {
$(done_id).fadeOut();
}, 3000 );
sending_contact_form = false;
},'json');
}
}else{
$(done_id).fadeOut();
$(fail_id).fadeIn().css("display","inline-block");
setTimeout(function() {
$(fail_id).fadeOut();
}, 3000 );
}
return false;
});
}
This is my code for form process
if(count($_POST)>0 && $_POST['f_codecatch'] == $contact_captcha_code){
$attachments = [];
if(!empty($_FILES)){
$files = $_FILES; // file array
foreach ($files as $file) {
$upload_dir = wp_upload_dir();
$path = $upload_dir['basedir'].'/files/'; //upload dir.
if(!is_dir($path)) { mkdir($path); }
$attachment_id = upload_user_file( $file ,$path);
$attachments[] = $path . $file['name'];
}
}
$msg = '';
$msg .= '<html><body>';
$msg .= '<div style="padding-top: 30px;padding-right: 20%;padding-left: 20%;">';
$msg .= '<div style="width: 100%; margin: 0 auto; text-align: center; margin-bottom: 20px;">';
$msg .= '<img src="'.THEME_PATH.'/images/logo-atiker.png" width="250px" alt="Atiker México" title="Atiker México">';
$msg .= '</div>';
if (!empty($_POST['f_name'])) {
$msg .= '<div style="display: -webkit-box;display: -webkit-flex;display: -ms-flexbox;display: flex;width: 100%;padding: 10px;-webkit-justify-content: space-around;-ms-flex-pack: distribute;justify-content: space-around;-webkit-box-align: center;-webkit-align-items: center;-ms-flex-align: center;align-items: center;border-top: 1px dashed #c3c3c3;">';
$msg .= '<div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;font-weight: 700;">';
$msg .= 'Nombre:';
$msg .= '</div>';
$msg .= '<div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;color: #6b6b6b;font-weight: 700;">';
$msg .= htmlspecialchars($_POST['f_name']);
$msg .= '</div>';
$msg .= '</div>';
}
if (!empty($_POST['f_email'])) {
$msg .= '<div style="display: -webkit-box;display: -webkit-flex;display: -ms-flexbox;display: flex;width: 100%;padding: 10px;-webkit-justify-content: space-around;-ms-flex-pack: distribute;justify-content: space-around;-webkit-box-align: center;-webkit-align-items: center;-ms-flex-align: center;align-items: center;border-top: 1px dashed #c3c3c3;">';
$msg .= '<div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;font-weight: 700;">';
$msg .='Email:';
$msg .= '</div>';
$msg .= '<div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;color: #6b6b6b;font-weight: 700;">';
$msg .= htmlspecialchars($_POST['f_email']);
$msg .= '</div>';
$msg .= '</div>';
}
if (!empty($_POST['f_phone'])) {
$msg .= '<div style="display: -webkit-box;display: -webkit-flex;display: -ms-flexbox;display: flex;width: 100%;padding: 10px;-webkit-justify-content: space-around;-ms-flex-pack: distribute;justify-content: space-around;-webkit-box-align: center;-webkit-align-items: center;-ms-flex-align: center;align-items: center;border-top: 1px dashed #c3c3c3;">';
$msg .= '<div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;font-weight: 700;">';
$msg .= 'Teléfono:';
$msg .= '</div>';
$msg .= '<div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;color: #6b6b6b;font-weight: 700;">';
$msg .= htmlspecialchars($_POST['f_phone']);
$msg .= '</div>';
$msg .= '</div>';
}
if (!empty($_POST['f_type'])) {
$msg .= '<div style="display: -webkit-box;display: -webkit-flex;display: -ms-flexbox;display: flex;width: 100%;padding: 10px;-webkit-justify-content: space-around;-ms-flex-pack: distribute;justify-content: space-around;-webkit-box-align: center;-webkit-align-items: center;-ms-flex-align: center;align-items: center;border-top: 1px dashed #c3c3c3;">';
$msg .= '<div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;font-weight: 700;">';
$msg .= 'Tipo de Cotización:';
$msg .= '</div>';
$msg .= '<div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;color: #6b6b6b;font-weight: 700;">';
$msg .= htmlspecialchars($_POST['f_type']);
$msg .= '</div>';
$msg .= '</div>';
}
if (!empty($_POST['f_model'])) {
$msg .= '<div style="display: -webkit-box;display: -webkit-flex;display: -ms-flexbox;display: flex;width: 100%;padding: 10px;-webkit-justify-content: space-around;-ms-flex-pack: distribute;justify-content: space-around;-webkit-box-align: center;-webkit-align-items: center;-ms-flex-align: center;align-items: center;border-top: 1px dashed #c3c3c3;">';
$msg .= '<div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;font-weight: 700;">';
$msg .='Año y Modelo:';
$msg .= '</div>';
$msg .= '<div style="-webkit-box-flex: 1;-webkit-flex: 1;-ms-flex: 1;flex: 1;color: #6b6b6b;font-weight: 700;">';
$msg .= htmlspecialchars($_POST['f_model']);
$msg .= '</div>';
$msg .= '</div>';
}
$msg .= '</div>';
$msg .= '</body></html>';
$to = 'myemail';//htmlspecialchars($_POST['f_email']);
$subject = htmlspecialchars($_POST['f_name']).' <'.htmlspecialchars($_POST['f_email']).'>';
$body = $msg;
$headers = array(
'From:'.htmlspecialchars($_POST['f_name']).' <'.htmlspecialchars($_POST['f_email']).'>',
'Content-Type: multipart/form-data; charset=UTF-8',
'Reply-To:'.htmlspecialchars($_POST['f_name']).' <'.htmlspecialchars($_POST['f_email']).'>'
);
wp_mail( $to, $subject, $body, $headers, $attachments);
echo json_encode(array('success'=>true));
exit;
}
I already get the email fine but that come in format plain html, is for the header content or what is your suggest because i already try many things xD, thanks for any help
This is the email i get
have you used
enctype="multipart/form-data"
in form tag
The problem was the headers this the correct way for the accents and more, thanks for any help :D
Content-type: text/html; charset=UTF-8
Related
I'm using this plugin: https://es.wordpress.org/plugins/pepro-bacs-receipt-upload-for-woocommerce/ and I want to send a email to the admin after a buyer upload a receipt. I have this code, but it's not sending emails, what am I doing wrong?
add_action( "woocommerce_customer_uploaded_receipt", "send_mail_after_bacs_receipt_uploaded", 10, 2);
function send_mail_after_bacs_receipt_uploaded($OrderID, $UploadedAttachmentID)
{
global $Pepro_Upload_Receipt;
$_image_url = wp_get_attachment_url($UploadedAttachmentID);
$_image_src = wp_get_attachment_image_src($UploadedAttachmentID, 'full');
$_image_src = $_image_src ? $_image_src[0] : $Pepro_Upload_Receipt->defaultImg;
$blog_name = get_bloginfo('name', 'display');
$blog_address = parse_url(get_bloginfo('url'), PHP_URL_HOST);
$blog_mail = "wordpress#$blog_address";
$admin_mail = get_option('admin_email');
$order = new WC_Order($OrderID);
$user_id = $order->get_user_id();
$current_user = get_user_by("ID", $user_id);
$mail_receiver = $current_user->user_email;
$mail_subject = "[$blog_name] BACS Receipt";
$mail_wrapper_styles = "display:block;
width:450px;
border-radius:0.5rem;
margin: 1rem auto;
text-align: center;
color: #2b2b2b;
padding: 1rem;
box-shadow: 0 2px 5px 1px #0003;
border: 1px solid #ccc;";
$mail_body = "<div style='$mail_wrapper_styles'>";
$mail_body .= "<h2>BACS Payment Proof Received</h2>";
$mail_body .= "<p>Hello <strong>$current_user->display_name</strong>, We've received you BACS Payment Proof.</p>";
$mail_body .= "<p>We are cheking nearly thousand payments daily and yours is in the list too.</p>";
$mail_body .= "<p>Please be patient, thank you.</p><br />";
$mail_body .= "<a href='$_image_url' target='_blank'>";
$mail_body .= " <img title='Click to enlarge' style='border-radius: 0.5rem;' src='$_image_src' width='400px' />";
$mail_body .= "</a><br />";
$mail_body .= "<p><strong><small>Copyright © $blog_name ($blog_address), all rights reserved.</small></strong><br />";
$mail_body .= "<small style='color: #717171;'>THIS MAIL WAS SENT TO <i>$mail_receiver</i></small></p>";
$mail_body .= "</div>";
$headers = array(
"Content-Type: text/html; charset=UTF-8",
"From: $blog_name <$blog_mail>"
);
// https://developer.wordpress.org/reference/functions/wp_mail/
wp_mail( $mail_receiver, $mail_subject, $mail_body, $headers );
}
Following is my php code for email function which is not sending email and i am not getting where the mistake is. Form data is posting properly but mail is not going.
$imgSrc = "logo1.png";
$bg = "background.jpg";
$subjectPara1 = "Dear admin";
$subjectPara2 = $_POST["message"];
$subjectPara4 = $_POST["email"];
$subject = $_POST["subject"];
$subjectPara3 = $_POST["author"];
$message = '<!DOCTYPE HTML><html>'.
'<head>'.
'<title>Email notification</title>'.
'</head>'.
'<body style="background-image: url('.$bg.');background-size: cover;">'.
'<div id="header" style="width: 80%;height: 60px;margin: 0 auto;padding: 10px;color: #fff;text-align: left;font-family: Open Sans,Arial,sans-serif;">'.
'<img height="50" width="220" style="border-width:0" src="'.$imgSrc.'" >'.
'</div>'.
'<div id="outer" style="width: 80%;margin: 0 auto;margin-top: 10px;">'.
'<div id="inner" style="width: 78%;font-family: inherit;font-size: 15px;font-weight: normal;line-height: 1.4em;color: #fff;margin-top: 10px;">'.
'<p>'.$subjectPara1.'</p>'.
'<p>'.$subjectPara2.'</p>'.
'<p><br/>Regards,<br/>'.$subjectPara3.'</p>'.
'<p>'.$subjectPara4.'</p>'.
'</div>'.
'</div>'.
'<div id="footer" style="width: 80%;height: 40px;text-align: center; padding: 10px; font-family: inherit; font-size: 15px; color: #fff;">'.
'All rights reserved # 2016'.
'</div>'.
'</body></html>';
$to = 'test#exmple.com';
$from = $subjectPara4;
$headers = 'From: test#exmple.com\r\n';
$headers .= 'Reply-To: test#exmple.com\r\n';
$headers .= 'MIME-Version: 1.0\r\n';
$headers .= 'Content-Type: text/html; charset=ISO-8859-1\r\n';
if(mail($to, $subject, $message, $headers))
{
echo "<script>window.location='index.php';</script>";
}
Kindly help me to resolve this.
I'm pretty new to PHP and am really learning as I do, no doubt wrongly at times. I've put together a script that reads a CSV containing orders for an e-commerce site and uses the data to send a completion email to the customer.
My problem is that if a customer orders several items in one order they are sent an email for each of those items rather than all the order items with the same order ID being contained in one email.
Its taken me several hours to to get to this point as I've literally been learning as I go but try as I might I'm banging my head against a brick wall with this loop issue and how to go about it. Any help, guidance or direction pointing would be much appreciated!
///////////// RUN THE CSV IMPORT ////////////
if(!file_exists($csvfile)) {
file_put_contents($debug, $date.$m5.PHP_EOL, FILE_APPEND);
exit;
}
$file = fopen($csvfile,"r");
if(!$file) {
file_put_contents($debug, $date.$m6.PHP_EOL, FILE_APPEND);
exit;
}
$size = filesize($csvfile);
if(!$size) {
file_put_contents($debug, $date.$m7.PHP_EOL, FILE_APPEND);
exit;
}
$csvcontent = fread($file,$size);
fclose($file);
$lines = 0;
$queries = "";
$linearray = array();
foreach(explode($lineseparator,$csvcontent) as $line) {
if($lines == 0){ $lines++; continue; }
if (empty($line)) { break; }
$lines++;
$line = trim($line," \t");
$line = str_replace("\r","",$line);
$line = str_replace("\"","",$line);
$linearray = explode($fieldseparator,$line);
$linemysql = implode("','",$linearray);
// Set The Variables
$order_id = $linearray[0];
$order_total = $linearray[1];
$payment_method = $linearray[2];
$shipping_cost = $linearray[3];
$total_quantity = $linearray[6];
$billing_first_name = $linearray[6];
$billing_last_name = $linearray[7];
$billing_company = $linearray[8];
$billing_street1 = $linearray[9];
$billing_street2 = $linearray[10];
$billing_city = $linearray[11];
$billing_zip = $linearray[12];
$billing_state = $linearray[13];
$billing_country = $linearray[14];
$billing_phone = $linearray[15];
$billing_email = $linearray[16];
$shipping_first_name = $linearray[17];
$shipping_last_name = $linearray[18];
$shipping_company = $linearray[19];
$shipping_street1 = $linearray[20];
$shipping_street2 = $linearray[21];
$shipping_city = $linearray[22];
$shipping_zip = $linearray[23];
$shipping_state = $linearray[24];
$shipping_country = $linearray[25];
$sku = $linearray[26];
$product_name = $linearray[27];
$order_line_quantity = $linearray[28];
$order_line_total_price = $linearray[29];
$ship_provider = $linearray[31];
$ship_tracking = $linearray[32];
$order_status = 'wc-completed';
$ship_date = date("Y-m-d");
$ship_sent = "on";
// Use MySQLi for regular price
$mysqli = new MySQLi($hostname, $username, $password, $database);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit;
}
$price_id = $mysqli->query("SELECT `post_id` FROM `dk_postmeta` WHERE `meta_value` LIKE '$sku'")->fetch_row()[0];
$regular_price = $mysqli->query("SELECT `meta_value` FROM `dk_postmeta` WHERE `post_id` =$price_id AND `meta_key` LIKE '_regular_price'")->fetch_row()[0];
// CLOSE CONNECTION
mysqli_close($mysqli);
$message = '<!DOCTYPE HTML>'.
'<head>'.
'<meta http-equiv="content-type" content="text/html">'.
'<meta charset="UTF-8">'.
'<title>mysite order complete</title>'.
'<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300&subset=latin,latin-ext" rel="stylesheet" type="text/css">'.
'<style>
body{font-family: "Open Sans",Arial,Helvetica,sans-serif;font-weight: 400;font-size:16px;line-height:26px;color:#212121;}
a {color: #7E1414;text-decoration: none;outline: 0px none !important;}
.clear{clear:both;}
.wrapper {margin:0 auto;}
.header {background-color: #151515;color: #FFF;width: auto;height: 70px;border: 1px solid #3C3C3C;padding:0 15px;margin-bottom:20px;}
a.logo {font-size: 38px;color: #FFF;line-height: 38px;letter-spacing: 1px;padding: 15px 0px 0px;}
.logo {float: left;}
.logo-small {font-family: Open Sans;text-transform: uppercase;font-size: 12px;margin: 0px;padding: 0px;}
.alert {font-size: 30px;color: #FFF;line-height: 38px;letter-spacing: 1px;padding: 15px 0px 0px;float:right}
.container {width:100%;padding:0}
.inner {margin:0 auto; height:100%;}
.my-account h2 {font-size: 22px;line-height: 30px;border-bottom: 1px solid #ABABAB;padding-bottom: 10px;margin: 0px 0px 20px;font-weight:normal;}
.order-box {padding:10px 20px;border:1px solid #ababab;}
.row {border-bottom:1px solid #E3E3E3;padding:10px 0;}
.row-totals {padding:10px 0 2px;}
.red{color:#7E1414;}
.product{width:48%;float:left;}
.product img {max-width:90px;}
.product .img-box{float:left;max-width:90px;border: 1px solid #CFCFCF;border-radius:3px;}
.product p {float:left;padding:0 0 0 10px;margin:0}
.price{width:20%;float:left;}
.quantity{width:10%;float:left;text-align:right;}
.total{width:20%;float:right;text-align:right;}
.totals-box {margin-top:0px;float:right;width:48%}
.totals-inner {padding:10px 20px 15px;border:1px solid #ababab;margin:20px 0;}
.alert-inner,.customer-inner {padding:0 20px;border:1px solid #ababab;margin:0 0 20px;}
.sub-left{float:left;width:40%;color:#7E1414;}
.sub-right{float:right;width:40%;text-align:right;}
.customer-inner {padding:10px 20px 0;margin:0px;}
.black {color:#212121 !important;}
.billing-box {}
.bbox-left {width:48%;float:left;}
.bbox-right {width:48%;float:right;}
.bbox-right .totals-inner,.bbox-left .totals-inner{padding:10px 20px}
.billing-box h3 {font-size: 18px;line-height: 30px;border-bottom: 1px solid #ABABAB;padding-bottom: 10px;margin: 0px 0px 20px;font-weight:normal;}
.billing-box p {padding:0;margin:0;}
.footer{background-color: #151515;color: #FFF;width: auto;border: 1px solid #3C3C3C;padding:0 15px;margin-bottom:0px;}
.footer p {font-size:20px;line-height:30px;padding:0;text-align:center;}
</style>'.
'</head>'.
'<body>'.
'<div class="wrapper">'.
'<div class="header">'.
'<div class="logo">'.
'<a class="logo" href="https://example.com">mysite <span class="logo-small">small logo</span></a>'.
'</div>'.
'<div class="alert">'.
'Order Shipped'.
'</div>'.
'</div>'.
'<div class="container">'.
'<div class="inner">'.
'<div class="alert-inner">'.
'<p>Dear '.$billing_first_name.','.
'<p>We just wanted to let you know that your recent order with mysite has been completed and shipped on '.$ship_date.'. You can track your order at the EMS website by using their tracking facility and your tracking number '.$ship_tracking.'.</p>'.
'<p>For your reference your order details are below. Thank you for shopping with mysite!</p>'.
'</div>'.
'<div class="my-account">'.
'<div class="order-box">'.
'<h2>Order Details</h2>'.
'<div class="row red">'.
'<div class="product">Product</div>'.
'<div class="price">Price</div>'.
'<div class="quantity">Quantity</div>'.
'<div class="total">Total</div>'.
'<div class="clear"></div>'.
'</div>'.
// NEED TO LOOP THIS SECTION WITH DATA FROM OTHER ROWS THAT MATCH $order_id
'<div class="row">'.
'<div class="product">'.
'<div class="img-box">'.
'<img src="https://example.com/wp-content/uploads/2015/04/'.$sku.'-1-135x180.jpg">'.
'</div>'.
'<p class="item">'.$product_name.'</p>'.
'</div>'.
'<div class="price">USD '.$regular_price.'</div>'.
'<div class="quantity">'.$order_line_quantity.'</div>'.
'<div class="total">USD '.$order_line_total_price.'</div>'.
'<div class="clear"></div>'.
'</div>'.
// END THE LOOP
'</div>'.
'<div class="totals-box">'.
'<div class="totals-inner">'.
'<div class="row row-totals">'.
'<div class="sub-left">SubTotal</div>'.
'<div class="sub-right">USD '.$order_line_total_price.'</div>'.
'<div class="clear"></div>'.
'</div>'.
'<div class="row row-totals">'.
'<div class="sub-left">Shipping</div>'.
'<div class="sub-right">USD '.$shipping_cost.'</div>'.
'<div class="clear"></div>'.
'</div>'.
'<div class="row row-totals">'.
'<div class="sub-left">Payment Method</div>'.
'<div class="sub-right">'.$payment_method.'</div>'.
'<div class="clear"></div>'.
'</div>'.
'<div class="row row-totals">'.
'<div class="sub-left">Total</div>'.
'<div class="sub-right">USD '.$order_total.'</div>'.
'<div class="clear"></div>'.
'</div>'.
'</div>'.
'</div>'.
'<div class="clear"></div>'.
'<div class="customer-inner">'.
'<h2>Customer details</h2>'.
'<p><spcan class="black">Telephone:</span> '.$billing_phone.'</p>'.
'<p>Email: '.$billing_email.'</p>'.
'</div>'.
'<div class="billing-box">'.
'<div class="bbox-left">'.
'<div class="totals-inner">'.
'<h3>Billing Details</h3>'.
'<p>'.$billing_first_name.' '.$billing_last_name.'</p>'.
'<p>'.$billing_company.'</p>'.
'<p>'.$billing_street1.'</p>'.
'<p>'.$billing_street2.'</p>'.
'<p>'.$billing_city.'</p>'.
'<p>'.$billing_zip.'</p>'.
'<p>'.$billing_state.'</p>'.
'<p>'.$billing_country.'</p>'.
'<div class="clear"></div>'.
'</div>'.
'</div>'.
'<div class="bbox-right">'.
'<div class="totals-inner">'.
'<h3>Shipping Details</h3>'.
'<p>'.$shipping_first_name.' '.$shipping_last_name.'</p>'.
'<p>'.$shipping_company.'</p>'.
'<p>'.$shipping_street1.'</p>'.
'<p>'.$shipping_street2.'</p>'.
'<p>'.$shipping_city.'</p>'.
'<p>'.$shipping_zip.'</p>'.
'<p>'.$shipping_state.'</p>'.
'<p>'.$shipping_country.'</p>'.
'<div class="clear"></div>'.
'</div>'.
'</div>'.
'<div class="clear"></div>'.
'</div>'.
'</div>'.
'<div class="footer">'.
'<p>Thank you for your custom!</p>'.
'</div>'.
'</div>'.
'</body>';
/*EMAIL TEMPLATE ENDS*/
$to = $billing_email; // give to email address
$subject = 'Your Order Is Complete'; //change subject of email
$from = 'orders#example.com'; // give from email address
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "CC: \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type:text/html;charset=utf-8\r\n";
// Sending mail
if(mail($to, $subject, $message, $headers))
{
echo 'HTML email sent successfully!';
}
else
{
echo 'Problem sending HTML email!';
}
I am using Wordpress.
CSS:
fsrep-main-image {
float: left;
margin-right: 8px;
text-align: center;
overflow: hidden
}
fsrep-main-image img {
padding: 1px;
border: 1px solid #CCC;
float:left;
overflow:hidden
}
description {
display:-block;
margin-top:-150px
}
When I open the page in Firefox it works fine, however if I open the same page in Chrome it has issues.
The following image is from Firefox, but in Chrome the description, location and bedroom details goes on the image.
HTML/PHP:
<?php
$PageContent = '<hr/>';
$WPUploadDir = wp_upload_dir();
$FSREPShowMap = $FSREPconfig['GoogleMap'];
if (isset($FSREPMap)) {
if ($FSREPMap == FALSE) {
$FSREPShowMap = FALSE;
}
}
$ListingDetails = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."fsrep_listings WHERE listing_id = ".$ListingID[0]);
if ($ListingDetails->listing_address_number == '' || $ListingDetails->listing_address_street == '' || $ListingDetails->listing_address_city == '') { $FSREPShowMap = FALSE; }
if ($FSREPconfig['DisplayCurrency'] == 'Yes') { $CurrencyDisplay = ' '.$FSREPconfig['CurrencyType']; } else { $CurrencyDisplay = ''; }
$PageContent .= '<h1>'.fsrep_listing_name_gen($ListingDetails->listing_id, $FSREPconfig['ListingNameDisplay']).'</h1>';
if ($ListingDetails->listing_price_num != '0.00') { $PageContent .= '<span class="listingprice">'; if ($FSREPconfig['ListingPriceID'] != '') { $PageContent .= fsrep_text_translator('FireStorm Real Estate Plugin', $FSREPconfig['ListingPriceID'].' Label', $FSREPconfig['ListingPriceID']).' '; } $PageContent .= $FSREPconfig['Currency'].fsrep_currency_format($ListingDetails->listing_price_num).$CurrencyDisplay.'</span><br />'; }
$PageContent .= '';
$FSREPImageSizes = fsrep_image_sizes();
$FSREPMainImageMargin = $FSREPImageSizes->main[0] + 4;
$FSREPImageMargin = $FSREPImageSizes->main[0] + 2;
$PageContent .='<div id="vertical_menu" style="float:right">
<a onclick=show_desc()>Overview</a>
<hr/>
<a onclick=show_Location()>Location Map</a>
<hr/>
<a onclick=show_enquiry()>Enquiry</a>
</div>';
$PageContent .= '<div id="fsrep-images" style="display:block">';
if (file_exists($WPUploadDir['basedir'].'/fsrep/houses/large/'.$ListingDetails->listing_id.'.jpg')) {
$PageContent .= '<div id="fsrep-main-image" style="width: '.$FSREPMainImageMargin.'px;display:block"><a id="fsrep-main-image-a" href="'.$WPUploadDir['baseurl'].'/fsrep/houses/large/'.$ListingDetails->listing_id.'.jpg" title="View Slideshow" class="thickbox" rel="fsreplisting"><img id="fsrep-main-image-img" src="'.$WPUploadDir['baseurl'].'/fsrep/houses/'.$ListingDetails->listing_id.'.jpg" alt="'.strip_tags(fsrep_listing_name_gen($ListingDetails->listing_id, $FSREPconfig['ListingNameDisplay'])).'" /></a></div>';
}
$PageContent .= '<div id="fsrep-aimages" style="margin-left: '.$FSREPImageMargin.'px; display:block">';
for ($i=1;$i<=50;$i++) {
if (file_exists($WPUploadDir['basedir'].'/fsrep/houses/additional/small/'.$ListingDetails->listing_id.'-'.$i.'.jpg')) {
//$PageContent .= '<div class="fsrep-aimage" id="fsrep-aimage" style="display:block"><img src="'.$WPUploadDir['baseurl'].'/fsrep/houses/additional/small/'.$ListingDetails->listing_id.'-'.$i.'.jpg" class="full" /></div>';
}
}
$PageContent .= '</div>';
if (file_exists($WPUploadDir['basedir'].'/fsrep/houses/large/'.$ListingDetails->listing_id.'.jpg')) {
//$PageContent .= '<div class="fsrep-aimage" id="fsrep-aimage" style="display:block"><img src="'.$WPUploadDir['baseurl'].'/fsrep/houses/small/'.$ListingDetails->listing_id.'.jpg" class="full" /></div>';
}
$PageContent .= '</div>';
$PageContent .= '<div style="clear: both;"></div>';
if ($FSREPShowMap == TRUE) {
$PageContent .= '<div id="location_map" style="display:none;float:left;width:920px">
<div style="margin-top:-150px;width: 80%;"><h2>'.fsrep_text_translator('FireStorm Real Estate Plugin', 'Located in Label', 'Located in').' '.fsrep_get_address_name($ListingDetails->listing_address_city, 'city').', '.fsrep_get_address_name($ListingDetails->listing_address_province, 'province').'</h2>';
// $PageContent .= '<div class="fsrep-aimager">Map</div>';
$PageContent .= '<div id="listings_map" style="width: 80%; height: 400px; border: 1px solid #999999; margin-bottom: 12px;"></div></div></div>';
$PageContent .= '<br />';
}
/*
$AdditionalImages = '';
for ($i=1;$i<=10;$i++) {
if (file_exists($WPUploadDir['basedir'].'/fsrep/houses/additional/small/'.$ListingDetails->listing_id.'-'.$i.'.jpg')) {
$AdditionalImages .= '<td align="center" valign="center"><img src="'.$WPUploadDir['baseurl'].'/fsrep/houses/additional/small/'.$ListingDetails->listing_id.'-'.$i.'.jpg" class="full" /></td>';
if ($i == 4) {
$AdditionalImages .= '</tr><tr>';
}
}
}
if ($AdditionalImages != '') {
$PageContent .= '<h2>Photo Gallery</h2>';
$PageContent .= '<table><tr><td><img src="'.$WPUploadDir['baseurl'].'/fsrep/houses/small/'.$ListingDetails->listing_id.'.jpg" class="full" /></td>'.$AdditionalImages.'</tr></table>';
$PageContent .= '<p> </p>';
}
*/
if (function_exists('fsrep_pro_listing_child')) { $PageContent .= fsrep_pro_listing_child($ListingDetails->listing_id); }
if ($ListingDetails->listing_description != '') {
$PageContent .= '<div id="description" style="display:block;margin-top:-150px;"><h4 style="display:block;">'.fsrep_text_translator('FireStorm Real Estate Plugin', 'Description Label', 'Description').'</h4>';
$PageContent .= '<p>'.stripslashes(nl2br($ListingDetails->listing_description)).'</p>';
}
$PageContent .= '<p> </p></div>';
$Documents = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."fsrep_listings_docs WHERE listing_id = ".$ListingDetails->listing_id);
if (count($Documents) > 0) {
$PageContent .= '<h2>'.fsrep_text_translator('FireStorm Real Estate Plugin', 'Documents and Support Material Label', 'Documents and Support Material').'</h2>';
$PageContent .= '<p>';
foreach ($Documents as $Documents) {
$PageContent .= ''.str_replace($ListingDetails->listing_id,'',$Documents->document_name).'<br />';
}
$PageContent .= '</p>';
$PageContent .= '<p> </p>';
}
if ($ListingDetails->listing_virtual_tour != '' || $ListingDetails->listing_slideshow != '' || $ListingDetails->listing_video != '') {
$PageContent .= '<h2>'.fsrep_text_translator('FireStorm Real Estate Plugin', 'Videos and Slideshows Label', 'Videos and Slideshows').'</h2>';
$PageContent .= '<p>';
if ($ListingDetails->listing_virtual_tour != '') {
$PageContent .= ''.fsrep_text_translator('FireStorm Real Estate Plugin', 'Virtual Tour Label', 'Virtual Tour').'<br />';
}
if ($ListingDetails->listing_slideshow != '') {
$PageContent .= ''.fsrep_text_translator('FireStorm Real Estate Plugin', 'Slideshow Label', 'Slideshow').'<br />';
}
if ($ListingDetails->listing_video != '') {
$PageContent .= ''.fsrep_text_translator('FireStorm Real Estate Plugin', 'Video Label', 'Video').'<br />';
}
$PageContent .= '</p>';
$PageContent .= '<p> </p>';
}
Try to separate that in two parts using DIV.
Give float:left; to first DIV
You also need to define the width for the image section.Trying to put the image in a container like div or p tag and specified the width for the image section.
I have this little issue with the price form for my Joomla backend.
The default value is always "nothing", so I just need to set "Euro" as default (see screenshot).
I'm pretty newbie with PHP, so I can't do it by myself..
Here is the part of code that realizes this form:
$htmlPrice = '<div class="jomcomdevPriceRow">';
$htmlPrice .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$htmlPrice .= '<label> '.JText::_('COM_JOMCOMDEV_FIELD_PRICE_NETTO').'</label><input type="text" name="' . $this->name.'[price_netto][]" id="' . $this->id . 'ValueNetto"' . ' value="" />';
$htmlPrice .= '</div>';
$htmlPrice .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$htmlPrice .= str_replace("\n", '', '<label is="jform_featured-lbl"> '.JText::_('COM_JOMCOMDEV_FIELDSET_PRICE_GROUP').'</label>'.JHtml::_('select.genericlist', JHtml::_('jdcategory.options', 'com_jomestate.price', array('onlyroot' => 0)), $this->name.'[type_id][]',"", 'value', 'text', null, true));
$htmlPrice .= '</div>';
$htmlPrice .= '</div>';
I hope I'm clear enough. Thank you in advance.
Screenshot:
http://i.stack.imgur.com/2Ix39.png
UPDATE
Hmm, I don't know really where is configured this element. Here is full code, maybe I'm looking a wrong part..
defined( '_JEXEC' ) or die( 'Restricted access' );
class JFormFieldJdPrice extends JFormField
{
/**
* #var string The form field type.
* #since 11.1
*/
public $type = 'JdAddress';
/**
* Method to get the field input markup.
*
* #return string The field input markup.
*
* #since 11.1
*/
public function getInput()
{
$id = JRequest::getInt('id');
// if(empty($id)) {
// $html = '<div style="padding: 10px; margin: 10px 0;">';
// $html .= JText::_('COM_JOMCOMDEV_PRICEADD_NOID_INFO');
// $html .= '</div>';
// return $html;
// }
$htmlPrice = '<div class="jomcomdevPriceRow">';
$htmlPrice .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$htmlPrice .= '<label> '.JText::_('COM_JOMCOMDEV_FIELD_PRICE_NETTO').'</label><input type="text" name="' . $this->name.'[price_netto][]" id="' . $this->id . 'ValueNetto"' . ' value="" />';
$htmlPrice .= '</div>';
$htmlPrice .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$htmlPrice .= str_replace("\n", '', '<label is="jform_featured-lbl"> '.JText::_('COM_JOMCOMDEV_FIELDSET_PRICE_GROUP').'</label>'.JHtml::_('select.genericlist', JHtml::_('jdcategory.options', 'com_jomestate.price', array('onlyroot' => 0)), $this->name.'[type_id][]',"", 'value', 'text', null, true));
$htmlPrice .= '</div>';
$htmlPrice .= '</div>';
$link = JURI::root()."index.php?option=com_jomcomdev&format=raw&task=ajax.price&name=first&id=";
$runScript = "
window.addEvent('domready', function() {
var options = {htmlPrice: '".$htmlPrice."', link: '".$link."', selector: $$('#".$this->id."')};
Comdev.price.init(options);
});
";
$document = JFactory::getDocument();
$document->addScriptDeclaration($runScript);
JText::script('COM_JOMCOMDEV_JS_BUTTON_ADD');
JText::script('COM_JOMCOMDEV_JS_BUTTON_DELETE');
JText::script('COM_JOMCOMDEV_JS_BUTTON_OPTION');
JText::script('COM_JOMCOMDEV_FIELD_PRICE_NETTO');
$html = '';
$html .= '<div id="'.$this->id.'">';
if(!empty($id)) {
$data = Main_Price::get($id, (string) $this->element['extension']);
foreach($data AS $d) {
$html .= '<div class="jomcomdevPriceRow">';
$html .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$html .= '<label is="jform_featured-lbl"> '.JText::_('COM_JOMCOMDEV_FIELD_PRICE_NETTO').'</label><input type="text" name="' . $this->name.'[price_netto][]" id="' . $this->id . 'ValueNetto"' . ' value="'.$d->price_netto.'" />';
$html .= '</div>';
$html .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$html .= '<label is="jform_featured-lbl"> '.JText::_('COM_JOMCOMDEV_FIELDSET_PRICE_GROUP').'</label>'.JHtml::_('select.genericlist', JHtml::_('jdcategory.options', 'com_jomestate.price', array('onlyroot' => 0)), $this->name.'[type_id][]', 'value', null, 'text', $d->type_id, true);
$html .= '</div>';
$html .= '<div class="control-group" style="padding-top: 17px;">';
$html .= '<label></label>'.JText::_('COM_JOMCOMDEV_JS_BUTTON_DELETE').'';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="clr"></div>';
}
}
$html .= '</div>';
return $html;
}
}