How to take two div side by side in wordpress - php

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.

Related

How to make Bootstrap Tab dynamic PHP?

I have a problem for making TAB dynamically. When I click Tab 2 (when class="tab-pane fade"), a tab content was duplicated from Tab 1 and so do to another tab.This is a screenshot
And this is my php code :
$sql1 = "SELECT * FROM pur_supp WHERE pn = '$id_p' and pn_interchange = '$id_a'";
$hasil1= mysqli_query($connect2,$sql1);
//$rowp = mysqli_fetch_assoc($hasil1);
$tab_menu = '';
$tab_content = '';
$i = 0;
while($row1 = mysqli_fetch_array($hasil1))
{
if($i == 0)
{
$tab_menu .= '
<li class="active">Priority '.$row1["priority"].'</li>
';
$tab_content .= '
<div id="priority'.$row1["priority"].'" class="tab-pane fade in active">
';
}
else
{
$tab_menu .= '
<li>Priority '.$row1["priority"].'</li>
';
$tab_content .= '
<div id="priority'.$row1["priority"].'" class="tab-pane fade">
';
}
$sql2 = "SELECT * FROM pur_supp WHERE pn = '$id_p' and pn_interchange = '$id_a' and priority = '".$row1["priority"]."' GROUP BY pn,pn_interchange";
$hasil2= mysqli_query($connect2,$sql2);
while($rowp = mysqli_fetch_array($hasil2))
{
$tab_content .= '<div class="panel-heading" align="center">';
$tab_content .= '<h2 >Selected Vendor Information</h2>';
$tab_content .= '<div class="panel-heading" align="center">';
$tab_content .= '<h5 >PURCHASE SUPPLIER</h5>';
$tab_content .= '<p style="font-weight: bold">Part Number';
$tab_content .= '<input style="text-align:center;margin-left: 90px" class="form-control" type="text" name="pn1" value="'. $rowp['pn'].'" readonly> </p>';
$tab_content .= ' <p style="font-weight: bold; text-align: left">Selected Vendor Information : Priority '.$rowp['priority'].'</p>';
}
$i++;
}

Googlerecaptcha always return false

I have developped this class and include inside my page but the return is always false. It seems the value $_POST of the recaptcha is not inserted process page.
Can you look ?
Thank
my class:
namespace Sites\Shop;
use Core\Registry;
use Core\HTML;
class GoogleRecaptcha {
const API = 'https://www.google.com/recaptcha/';
const SECRET_KEY = MODULES_CONTACT_US_GOOGLE_RECAPTCHA_SECRET_KEY;
const SITE_KEY = MODULES_CONTACT_US_GOOGLE_RECAPTCHA_SITE_KEY;
public function script() {
$Template = Registry::get('Template');
$footer ='<!-- contact_us google captcha end -->' . "\n";
$footer .= '<script src="' . self::API . 'api.js" async defer></script>' . "\n";
$footer .='<!-- contact_us google captcha end -->' . "\n";
return Template->addBlock($footer, 'footer_scripts');;
}
public function html($includeNoScript = false) {
$return = '<div class="g-recaptcha" data-sitekey="' . self::SITE_KEY . '"></div>';
if($includeNoScript == true) {
$return .= $this->noScript();
}
). "\n";
return $return;
}
private function noScript() {
$output = '<noscript>';
$output .= '<div style="width: 302px; height: 352px;">';
$output .='<div style="width: 302px; height: 352px; position: relative;">';
$output .= '<div style="width: 302px; height: 352px; position: absolute;">';
$output .= '<iframe src="' . self::API . 'api/fallback?k=' . self::SITE_KEY . '" frameborder="0" scrolling="no" style="width: 302px; height:352px; border-style: none;"></iframe>';
$output .= '</div>';
$output .= '<div style="width: 250px; height: 80px; position: absolute; border-style: none; bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;">';
$output .= HTML::textAreaField('g-recaptcha-response','', '250px', '80px', 'id="g-recaptcha-response" class="g-recaptcha-response" style="border: 1px solid #c1c1c1; margin: 0px; padding: 0px; resize: none;"');
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</noscript>';
return $output;
}
public function check($response) {
$url = self::API . 'api/siteverify?secret=' . self::SECRET_KEY . '&response=' . $response . '&remoteip=' . $_SERVER['REMOTE_ADDR'];
$response = file_get_contents($url);
if($response->success===true) {
return true;
} else {
return false;
}
}
public function display() {
$output = '<!-- contact_us secret google captcha start -->'. "\n";
$output .= $this->script();
$output .= $this->html(true);
return $output;
}
}
my html page (simplified)
<?php
$GoogleRecaptcha = Registry::get('GoogleRecaptcha');
$contact_us_form .= $form;
$contact_us_form .= $OSCOM_GoogleRecaptcha->display();
$contact_us_form .= HTML::button(IMAGE_BUTTON_CONTINUE, null, null, 'primary', null, null, null, 'submit');
$contact_us_form .= $endform;
?>
result of my htmlpage
<form name="contact" action="http://boutique/index.php?Info&Contact&Process&action=process" method="post" id="contact"><input type="hidden" name="formid" value="a1e5d99fc7361f2c4ed4169a2ff6ae8b" />
<!-- contact_us secret google captcha start -->
<div class="g-recaptcha" data-sitekey=".................."></div>
<button id=submit type="submit" class="btn btn-primary">Continuer</button>
</form>
<!-- contact_us google captcha end -->
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<!-- contact_us google captcha end -->
<!-- contact_us_form end -->
my process (simplified)
if (isset($_GET['action']) && ($_GET['action'] == 'process') && isset($_POST['formid']) && ($_POST['formid'] == $_SESSION['sessiontoken'])) {
$error = false;
$google_captcha = HTML::sanitize($_POST['g-recaptcha-response']);
var_dump($google_captcha);
var_dump($OSCOM_GoogleRecaptcha->check($google_captcha));
exit;
}
result of var_dump : string(0) "" bool(false)
This will return false in every case:
$response = file_get_contents($url);
if($response->success===true) {
return true;
} else {
return false;
}
You need to parse the Json Response from the Recaptcha API:
$response = file_get_contents($url);
$response = json_decode($response , true);
//reCaptcha success check
if($response ['success']){
return true;
} else {
return false;
}
http://php.net/manual/de/function.json-decode.php

Loop CSV data from multiple rows in PHP

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!';
}

Get individual form collection elements ZF2

I need to use collections to make dynamic inputs, but needed to pull out the individual elements to integrate them into a Bootstrap layout.
Unfortunately I can't find any documented way of doing this.
Could someone help-me?
Here is my form: http://pastebin.com/JGy7JEJk Fieldset used in form:
http://pastebin.com/VBbG1yyb
Form HTML: http://pastebin.com/HHaZZKsB
Form View Helper: http://pastebin.com/x7B9aPWG
You can see this in action http://protesto21.com.br/cadastro/encargo-vigencia/atualizar/2/
User admin, password p21
Thanks for all and sorry for my english
Problem solved
public function renderCollection($element)
{
$return = '';
if (count($element->getMessages()) > 0) {
$return .= '<div class="form-group has-error">';
} else {
$return .= '<div class="form-group">';
}
foreach ($element->getIterator() as $field) {
$label = ($this->isView) ? '<strong>' . $element->getLabel() . '</strong>' : $element->getLabel();
$return .= '<label class="col-md-3 control-label">' . $label . '</label>';
$return .= '<div class="col-md-8" style="margin-bottom: 20px;">';
foreach ($field->getElements() as $inputs) {
$return .= '<div style="float: left; margin-right: 20px;">';
$return .= $inputs->getLabel();
$return .= $this->renderInput($inputs);
$return .= '<div style="min-width: 265px;">';
foreach ($inputs->getMessages() as $mensagem) {
$return .= "<span class='help-block'>" . $mensagem . "</span>";
}
$return .= '</div>';
$return .= '</div>';
}
$return .= '</div>';
$element->setLabel('');
}
$return .= '</div>';
return $return;
}

PHP Change default value for Select list

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;
}
}

Categories