Cannot find how to remove payment method from woocommerce admin email.
Searched through the files for Payment Method, but no luck
First of all, if you haven't done so, copy your woocommerce template files to your themes root as described in http://docs.woothemes.com/document/template-structure/.
Then, open a file that is responsible for building the email template. In my case it was (after copying it over) /wp-content/themes/MY_THEME/woocommerce/emails/admin-new-order.php
Find the following lines of code
<tfoot>
<?php
if ( $totals = $order->get_order_item_totals() ) {
$i = 0;
foreach ( $totals as $total ) {
$i++;
?><tr>
<th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
<td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
</tr><?php
}
}
?>
</tfoot>
And add a condition to check if one of the labels contains Payment Method, like so
<tfoot>
<?php
if ( $totals = $order->get_order_item_totals() ) {
$i = 0;
foreach ( $totals as $total ) {
$i++;
if ( $total['label'] != 'Payment Method:' ){
?><tr>
<th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
<td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
</tr><?php
}
}
}
?>
</tfoot>
You can use this for other fields also
Related
I'm currently a C# dotnet automation engineer. One of my tests results output is via email. My tests results output goes through powershell. I'm fairly new to email templates and HTML in general.
It's a simple HTML body with variables that I replace with $EmailBody= $EmailBody.Replace("PassedTests",$Passed) function etc
The whole premise: my script replaces Total tests/Passed/Failed/Skipped with data that I extract from a .trx file after the test run.
My extraction code:
$PassedTests = $testResultsXml.TestRun.ResultSummary.Counters.Passed
$FailedTests = $testResultsXml.TestRun.ResultSummary.Counters.Failed
$SkippedTests = $testResultsXml.TestRun.ResultSummary.Counters.Skipped
$OnlyFailed = $testResultsXml.TestRun.Results.UnitTestResult | Where-Object { $_.outcome -eq "Failed" }
$FailedTestsName = $OnlyFailed.TestName
I have the "Error list" table (picture below) that shows test names if there are any failed tests that in the HTML body
#</td>
</tr>
<!--end img-->
<tr>
<td height="15"></td>
</tr>
<!--title-->
<tr align="center">
<td align="center" style="font-family:
'Open Sans', Arial, sans-serif; font-size:16px;color:#3b3b3b;font-weight: bold;">**ERROR LIST**</td>
</tr>
<!--end title-->
<tr>
<td height="10"></td>
</tr>
<!--content-->
<tr align="center">
<td align="center" style="font-family: 'Open Sans', Arial, sans-serif; font-size:12px;color:#7f8c8d;line-height: 24px;">NoErrors</td>
</tr>
<!--end content-->
</table>
</td>
</tr>
<tr>
<td height="30"></td>
</tr>
</table>
Now the main question is: is it somehow possible to ONLY show the "Error list" table only IF there are any failed tests? If there are no failed tests it would be great for that table not to be shown at all.
Any kind of help would be greatly appreciated. Thanks!
$EmailBody= $EmailBody.Replace("PassedTests",$Passed)
$EmailBody= $EmailBody.Replace("FailedTests",$Failed)
$EmailBody= $EmailBody.Replace("SkippedTests",$Skipped)
$EmailBody= $EmailBody.Replace("ErrorList",$FailedTestsName)
$Emailattachment = "\TestResults.trx"
You are on the good path.
You just need to extend what you are doing.
Remove the thing that might or might not be in the email (The "errors list" section as it won't be there if there are no error)
Put the section your removed in its own variable
Add a placeholder in your main html template at the location where it is supposed to be (just like you do already so we can do a replace in the html template.
From there, the logic is :
If there are 0 errors, you replace the placeholder from the main template by an empty string (you don't want that placeholder to appear in the final email)
If there are 1 or more error, instead of replacing by your error list, you build a new variable that contain the section you want to append, then you replace its loop by the errors content and finally you replace the placeholder by that section (which contains the error loop)
That would look something like this.
$EmailBody = #'
</td>
</tr>
<!--end img-->
<tr>
<td height="15"></td>
</tr>
**ErrorsTable**
'#
$ErrorListBody = #'
<!--title-->
<tr align="center">
<td align="center" style="font-family:
'Open Sans', Arial, sans-serif; font-size:16px;color:#3b3b3b;font-weight: bold;">**ERROR LIST**</td>
</tr>
<!--end title-->
<tr>
<td height="10"></td>
</tr>
<!--content-->
<tr align="center">
<td align="center" style="font-family: 'Open Sans', Arial, sans-serif; font-size:12px;color:#7f8c8d;line-height: 24px;">NoErrors</td>
</tr>
<!--end content-->
</table>
</td>
</tr>
<tr>
<td height="30"></td>
</tr>
</table>
'#
if ($FailedTests.Count -gt 0) {
# inserting errors to the `$ErrorListBody` html segment
$ErrorsHtml = $ErrorListBody.Replace("ErrorList", $FailedTestsName)
# inserting the html segment into the main email
$EmailBody = $EmailBody.Replace("**ErrorsTable**", $ErrorsHtml)
} else {
# Removing the placeholder from the main template.
$EmailBody = $EmailBody.Replace("**ErrorsTable**", '')
}
I think it's quite simple to realize but i really dont know where to start. What i would like is an option in the form where people can add an image or other file.
Ive added this in my bootstrap form:
<!--attachments-->
<div class="form-group">
<label for="attachment">Attachment</label>
<input type="file" class="form-control-file" name="attachmentFile" id="attachmentFile">
</div>
So far so good i guess. But it wont send because there has to be something added in my phpmailer / send.php file. This is the script which i use now:
<?php
require 'PHPMailerAutoload.php';
// Controleren of het formulier is verzonden dmv submit
if (isset($_POST['submitted'])) {
$errors = array(); // Initialize error array.
// Geef hier zoveel mogelijk vereiste velden voor validatie
//Add attachment
if(is_array($_FILES)) {
$mail->AddAttachment($_FILES['attachmentFile']
['tmp_name'],$_FILES['attachmentFile']['name']);
}
// Controleer naam
if (!preg_match("/^[a-zA-Z]+[a-zA-Z[:space:]]{2,}$/", $_POST['naam'])) {
$errors[] = 'Naam';
}
// Controleer adres
if (!preg_match("/^[a-zA-Z[:space:]]{1,}$/", $_POST['straat'])) {
$errors[] = 'Adres';
}
// Controleer huisnummer
if (!preg_match("/^[0-9]{1,4}$/", $_POST['huisnummer'])) {
$errors[] = 'Huisnummer';
}
// Controleer postcode
if (!preg_match("/^[0-9]{4}$/", $_POST['postcode'])) {
$errors[] = 'Postcode (Cijfers)';
}
// Controleer postcode letters
if (!preg_match("/^[a-zA-Z]{2}$/", $_POST['letters'])) {
$errors[] = 'Postcode (Letters)';
}
// Controleer woonplaats
if (!preg_match("/^[a-zA-Z]+[a-zA-Z[:space:]]{2,}$/", $_POST['woonplaats'])) {
$errors[] = 'Woonplaats';
}
// Controleer Kengetal
if (!preg_match("/^[0]{1}[0-9]{1,3}$/", $_POST['kengetal'])) {
$errors[] = 'Kengetal';
}
// Controleer telefoonnummer
if (!preg_match("/^[0-9]{6,8}$/", $_POST['telefoon'])) {
$errors[] = 'Telefoonnummer';
}
// Controleer e-mail adres
if (!preg_match("/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*#([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,})$/", $_POST['email'])) {
$errors[] = 'E-mail adres';
}
// Controleer tekstvak
if (empty($_POST['bericht'])) {
$errors[] = 'Bericht';
}
if (empty($errors)) {
// Voer hier de gegevens in
$mailFrom = "myEmail";
$mailTo = "myEmail";
$senderNaam = $_POST['naam'];
$senderEmail = $_POST['email'];
$subject = 'mySubject';
$okMessage = '<p>blablabla</p>';
$errorMessage = '<p>blablabla</p>';
$emailText .= "Naam: " . $_POST['titel']." ". $_POST['naam']. "\n";
$emailText .= "Bedrijfsnaam: " . $_POST['bedrijfsnaam']. "\n";
$emailText .= "Adres: " . $_POST['straat']." ". $_POST['huisnummer']." ". $_POST['toevoeging']. "\n";
$emailText .= "Postcode: " . $_POST['postcode']." ". $_POST['letters']. "\n";
$emailText .= "Woonplaats: " . $_POST['woonplaats']. "\n";
$emailText .= "Telefoonnummer: " . $_POST['kengetal']." ". $_POST['telefoon']. "\n";
$emailText .= "E-mailadres: " . $_POST['email']. "\n";
$emailText .= "Bericht: " . $_POST['bericht']. "\n";
$mail = new PHPMailer;
$mail->CharSet = 'UTF-8';
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'SMTP SERVER'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'User'; // SMTP username
$mail->Password = 'Pass'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->Sender = $mailFrom;
$mail->SetFrom($senderEmail, $senderNaam);
$mail->AddReplyTo($senderEmail, $senderNaam);
$mail->Subject = $subject;
$mail->MsgHTML($emailText);
$mail->AddAddress($mailTo, $mailTo);
$mail->addAttachment($uploadfile, 'My uploaded file'); **// ADDED THIS HERE**
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
$mail->Body = "<table>
<tr><td style='padding-left: 10px; padding-right: 10px; background: #eee;'>Naam:</td><td style='padding-left: 10px; font-weight: bold;'>".$_POST['titel']." ".$_POST['naam']."</td></tr>
<tr><td style='padding-left: 10px; padding-right: 10px; background: #eee;'>Bedrijfsnaam:</td><td style='padding-left: 10px; font-weight: bold;'>".$_POST['bedrijfsnaam']."</td></tr>
<tr><td style='padding-left: 10px; padding-right: 10px; background: #eee;'>Adres:</td><td style='padding-left: 10px; font-weight: bold;'>".$_POST['straat']." ".$_POST['huisnummer']." ".$_POST['toevoeging']."</td></tr>
<tr><td style='padding-left: 10px; padding-right: 10px; background: #eee;'>Postcode:</td><td style='padding-left: 10px; font-weight: bold;'>".$_POST['postcode']." ".$_POST['letters']."</td></tr>
<tr><td style='padding-left: 10px; padding-right: 10px; background: #eee;'>Woonplaats:</td><td style='padding-left: 10px; font-weight: bold;'>".$_POST['woonplaats']."</td></tr>
<tr><td style='padding-left: 10px; padding-right: 10px; background: #eee;'>Telefoonnummer:</td><td style='padding-left: 10px; font-weight: bold;'>".$_POST['kengetal']." ".$_POST['telefoon']."</td></tr>
<tr><td style='padding-left: 10px; padding-right: 10px; background: #eee;'>E-mailadres:</td><td style='padding-left: 10px; font-weight: bold;'>".$_POST['email']."</td></tr>
<tr><td style='padding-left: 10px; padding-right: 10px; background: #eee;'>Bericht:</td><td style='padding-left: 10px; font-weight: bold;'>".$_POST['bericht']."</td></tr>
</table>";
$mail->AltBody = $emailText;
if(!$mail->send()) {
$responseArray = array('type' => 'danger', 'message' => $errorMessage);
} else {
$responseArray = array('type' => 'success', 'message' => $okMessage);
}
}
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$encoded = json_encode($responseArray);
header('Content-Type: application/json');
echo $encoded;
} else {
echo $responseArray['message'];
}
}
?>
Also added this to <form> enctype="multipart/form-data"
Edit #2: I also have a contact.js file with this:
data: $(this).serialize(),
I changed it in this:
data: new FormData(this),
Because i read somewhere that this could be the problem, but it didnt make sense.
Alright, the form is sending with attachments! There is only one little thing i hope someone can help me with that.. more about this later on. First the code.
In contact.js - I had to change data: $(this).serialize(), into data: new FormData(this),
$(function () {
$('#contact-form').validator();
$('#contact-form').on('submit', function (e) {
if (!e.isDefaultPrevented()) {
var url = "send.php";
$.ajax({
type: "POST",
url: url,
data: new FormData(this),
cache : false,
contentType : false,
processData : false,
success: function (data)
{
var messageAlert = 'alert-' + data.type;
var messageText = data.message;
var alertBox = '<div class="alert ' + messageAlert + ' alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' + messageText + '</div>';
if (messageAlert && messageText) {
$('#contact-form').find('.messages').html(alertBox);
$('#contact-form')[0].reset(); //Remove this line if form should not reset after submit
$('body, html').animate({scrollTop:$('#contact-form').offset().top}, 'fast'); //Remove this line if form should not scroll to top of the form after submit
}
}
});
return false;
}
})
});
Myform.html - 2 things: this enctype="multipart/form-data" in <form>, and this
<!--attachments-->
<div class="form-group">
<label for="attachment">Attachment</label>
<input type="file" class="form-control-file" name="attachmentFile" id="attachmentFile">
</div>
somewhere you want in the form.
Finally put this in your phpmailer file:
//Add attachment
if(is_array($_FILES)) {
$mail->AddAttachment($_FILES['attachmentFile']['tmp_name'],$_FILES['attachmentFile']['name']);
}
I did it below $mail->AddAddress($mailTo, $mailTo);
So far how to fix this. There is still one problem left i refer to in the beginning.
Without data: new FormData(this), I still get my okMessage (with markup) when i hit send and the form stays at the same page.
With data: new FormData(this), it goes to a new page and just give black on white plain text (without markup).
So its like FormData is overruling something. Hope someone can help me out with this.
EDIT: Seems i have fixed this too. Place this..
cache : false,
contentType : false,
processData : false,
..below data: new FormData(this),
I have a code that shows up in two different places, one is a browser html page, then the other is a downloaded PDF. On this page there is a line that says "print using the print button" but of course that isn't on the PDF model so I would like to remove it when the function printFilePdf is run. However I can't add (or I don't know how) a condition do the HTML that is in the method.
sub printHeader {
my ($outFH) = #_;
my ($sec, $min, $hour, $mday, $month, $year) = (localtime)[0, 1, 2, 3, 4, 5];
$month++;
$year += 1900;
my ($string) = scalar localtime(time());
print $outFH <<EOT;
<html>
<head>
<title>THIS IS A TITLE</title>
</head>
<body>
<table width="640" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="bold"> </td>
</tr>
<tr>
<td class="bold">
<div align="center" class="header">
I want to keep this line $string<br>
</div>
</td>
</tr>
<tr>
<td class="bold"> </td>
</tr>
<tr>
<td class="bold" style="color: red; text-align: center">
I also what to keep this line.
</td>
</tr>
<tr>
<td class="bold" style="color: red; text-align: center">
This line is not needed when the printFilePdf function is run.
</td>
</tr>
</table>
EOT
print $outFH qq(<p align="center"> </p>);
print $outFH <<EOT;
</td>
</tr>
</table>
EOT
}
Is there anyway to do this? Like add a name to the table row and in the method above say something like
if(!printFilePdf())
{
<tr>
<td class="bold" style="color: red; text-align: center">
This line is not needed when the printFilePdf function is run.
</td>
</tr>
}
You could check the caller. If caller is printFilePdf then search and replace to delete unneeded data.
perldoc -f caller
As a side note: If you are using some templating engine like HTML::Template then it'd be lot easier. In that case you can put conditionals in HTML.
<TMPL_IF NAME="NON_PDF">
Some text that only gets displayed if NON_PDF is true!
</TMPL_IF>
Just break the HTML into two parts: one is common to both the formats, one is HTML specific:
#!/usr/bin/perl
use warnings;
use strict;
sub printHeader {
my ($outFH, $goes_to_html) = #_;
print $outFH <<'__HTML__';
Here is the common text.
__HTML__
print $outFH <<'__HTML__' if $goes_to_html;
This doesn't go to PDF.
__HTML__
}
print "To HTML:\n";
printHeader(*STDOUT, 1);
print "To PDF:\n";
printHeader(*STDOUT, 0);
I'm trying to get an email to fire alerting me if a column in a Google Sheet =X.
I've tried using the notification system using using the EQ operator to turn on when a cell equals X, this changes a cell and the notification system is supposed to send an email right away. It's not working that way, the email never fires.
I'm think I need a script that would fire an email if a cell =X which would be nice because I could customize the email so it made more sense. (i.e. "The conference room your event is being held has reached capacity, you should remove it from the reservation form")
I am new to Google Scripts and could use a little help creating the email trigger if cell =X script.
Thanks,
Dave
You would need to add a script to run onEdit.
function onEdit() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("NameOfYourSheet");
var currentValue = sheet.getRange("A5").getValue();
if (currentValue == (whateverValueYoureLookingFor)) {
MailApp.sendEmail("youremail#domain.com", "ALERT: The cell in the sheet is equal to X!", "The message body that you want to send.");
}
}
function testSchemas() {
var htmlout = HtmlService.createTemplateFromFile('data').evaluate().getContent();
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('All Exams Tracker');
var range = sheet.getDataRange();
var values = range.getValues();
var last_row = sheet.getLastRow();
var today = new Date()
for (var i =3 ;i < last_row;i++) {
var temp = values[i][4];
var e_date = new Date(temp);
if ((( e_date - today)/(1000*60*60*24)) < 10 && e_date > today){
var cond = "done" }
break; }
Logger.log(cond);
if (cond == "done"){
MailAppv.sendEmail({
to: '*************************************************************',
subject: 'Exam Coming Next Week',
htmlBody: htmlout,
});
}}
This will html file data (given below) when triggered.
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
}
</style>
</head>
<table style = "border: 1px solid black; border-style: collapse;">
<? var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('All Exams Tracker');
var range = sheet.getDataRange();
var values = range.getValues();
var last_row = sheet.getLastRow();
var today = new Date();?>
<tr style="border: 1px solid black; padding: 10px;">
<th style="border: 1px solid black; padding: 10px;">Exam Name</th>
<th style="border: 1px solid black; padding: 10px;">Exam Date</th>
<th style="border: 1px solid black; padding: 10px;">Priority</th>
<th style="border: 1px solid black; padding: 10px;">College Predictor Status</th>
<th style="border: 1px solid black; padding: 10px;">Rank Predictor Status</th>
</tr>
<? for (var i =3 ;i < last_row;i++) {
var temp = values[i][4];
var e_date = new Date(temp);
if ((( e_date - today)/(1000*60*60*24)) < 10 && e_date > today) {
if (values[i][12] != ""){
var col_status = "Live"}
else
if (values[i][11] != ""){
col_status = "Uploaded and Tested"}
else
if (values[i][10] != ""){
col_status = "Data Processed"}
else
if (values[i][9] != ""){
col_status = "Template Ready"}
else
col_status = "Not initiated yet"
if (values[i][19] != ""){
var rank_status = "Live"}
else
if (values[i][18] != ""){
rank_status = "Uploaded and Tested"}
else
if (values[i][17] != ""){
rank_status = "Data Processed"}
else
rank_status = "Not Initiated yet"
?>
<tr>
<td style="border: 1px solid black; padding: 10px;"><?= values[i][2]?></td>
<td style="border: 1px solid black; padding: 10px;"><?= values[i][4]?></td>
<td style="border: 1px solid black; padding: 10px;"><?= values[i][8]?></td>
<td style="border: 1px solid black; padding: 10px;"><?= col_status?></td>
<td style="border: 1px solid black; padding: 10px;"><?= rank_status?></td>
</tr>
<? } }?>
</table>
<br><br>
<p>Click Here For More Details</p>
</html>
Below is my data in html file. I want to find the values in the html file using "HTML::TreeBuilder"
<table id="stats" cellpadding="0" cellspacing="0">
<tbody>
<tr class="row-even">
<td class="stats_left">Main Domain</td>
<td class="stats_right"><b>myabcab.com</b></td>
</tr>
<tr class="row-odd">
<td class="stats_left">Home Directory</td>
<td class="stats_right">/home/abc</td>
</tr>
<tr class="row-even">
<td class="stats_left">Last login from</td>
<td class="stats_right">22.32.232.223 </td>
</tr>
<tr class="row-odd">
<td class="stats_left">Disk Space Usage</td>
<td class="stats_right">30.2 / ∞ MB<br>
<div class="stats_progress_bar">
<div class="cpanel_widget_progress_bar" title="0%"
style="position: relative; width: 100%; height: 100%; padding: 0px; margin: 0px; border: 0px">
</div>
<div class="cpanel_widget_progress_bar_percent" style="display: none">0</div>
</div>
</td>
</tr>
<tr class="row-even">
<td class="stats_left">Monthly Bandwidth Transfer</td>
<td class="stats_right">0 / ∞ MB<br>
<div class="stats_progress_bar">
<div class="cpanel_widget_progress_bar" title="0%"
style="position: relative; width: 100%; height: 100%; padding: 0px; margin: 0px; border: 0px">
</div>
<div class="cpanel_widget_progress_bar_percent" style="display: none">0</div>
</div>
</td>
</tr>
</tbody>
</table>
How can I find "Disk Usage space" value using "HTML::TreeBuilder". I have many tds with same classes from above code,
Find the <td> with the matching content, in this case "Disk Space Usage" and then find the next <td>.
Once you have an element tree:
my $usage = $t->look_down(
_tag => 'td',
sub {
$_[0]->as_trimmed_text() =~ /^Disk Space Usage$/
}
)->right()->as_trimmed_text();
You may want to wrap that in an eval block in case look_down doesn't find a match.
The tree navigation methods in HTML::Element are a key part of making effective use of HTML::TreeBuilder effectively.
Mohini asks, "why doesn't this work?"
(formatting added by me)
use strict;
use warnings;
use HTML::TreeBuilder;
my $tree = HTML::TreeBuilder->new_from_file( "index.html");
my $disk_value; my $disk_space;
for ( $tree->look_down( _tag => q{tr}, 'class' => 'row-odd' ) ) {
$disk_space = $tree->look_down(
_tag => q{td},
'class' => 'stats_left'
)->as_trimmed_text;
if ( $disk_space eq 'Home Directory' ) {
$disk_value = $tree->look_down( _tag => q{td}, 'class' => 'stats_right' )
->right()
->as_trimmed_text();
}
}
print STDERR "my home value is $disk_space : $disk_value\n";
look_down starts from the root node you invoke it from, and looks down the element tree (these trees grow upside down) and returns either the list of matching nodes or the first matching node, depending on context.
Since all calls to look down are on tree, you repeatedly find the same nodes each time through the loop.
Your loop should look something more like this:
my %table_stuff;
for my $odd_row ( $tree->look_down( _tag => q{tr}, 'class' => 'row-odd' ) ) {
$heading = $odd_row->look_down(
_tag => q{td},
'class' => 'stats_left'
);
$table_stuff{ $heading->as_trimmed_text() } = $heading->right()->as_trimmed_text();
}
This populates a hash with table elements.
If you only want the one value, don't use a loop at all. look_down already acts as a loop.
my $heading = $t->look_down(
_tag => 'td',
sub {
$_[0]->as_trimmed_text() =~ /^Home Directory$/
}
);
my $value = $heading->right();
# Now $heading and $value have HTML::Element nodes that you can do whatever you want with.
my $disk_value = $value->as_trimmed_text();
my $disk_space = $heading->as_trimmed_text();