Weird question about modifying a label in checkout

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 anos atrás
So, on one page checkout, I would like to add a label, caption, whatever, to the billing address email that says something like "Software products are delivered to this email" preferably without touching the core. We've done alot of CSS, Javascript, C#, and HTML customizations (I'm mostly CSS and HTML and I would prefer not to bother our actual developer with this) to our store, but this one has me stumped.

I've tried:
- Using CSS content-before etc, but there is no id or classes to feed off of with this. The <input> is a self-closing element, so the content stuff doesn't work with it, according to the internet.
- Seeing if I could get to it in the HTML views and partial views, can't seem to get close enough to it to change it.
- Using Javascript to look for the for="BillingNewAddress_Email" and replace or add on to contents of said <label>

The last one seems the most promising, but my Javascript Fu isn't quite where it needs to be. If it helps, here is what I have so far: (I'm using the CSS color change to just see if I can get something to happen)

        $(function () {
            $("label").each(function (index) {
                if ($(this)for() === "BillingNewAddress_Email") $(this).css("color", "red");
            });
        });
9 anos atrás
wallace11bravo wrote:
So, on one page checkout, I would like to add a label, caption, whatever, to the billing address email that says something like "Software products are delivered to this email" preferably without touching the core. We've done alot of CSS, Javascript, C#, and HTML customizations (I'm mostly CSS and HTML and I would prefer not to bother our actual developer with this) to our store, but this one has me stumped.

I've tried:
- Using CSS content-before etc, but there is no id or classes to feed off of with this. The <input> is a self-closing element, so the content stuff doesn't work with it, according to the internet.
- Seeing if I could get to it in the HTML views and partial views, can't seem to get close enough to it to change it.
- Using Javascript to look for the for="BillingNewAddress_Email" and replace or add on to contents of said <label>

The last one seems the most promising, but my Javascript Fu isn't quite where it needs to be. If it helps, here is what I have so far: (I'm using the CSS color change to just see if I can get something to happen)

        $(function () {
            $("label").each(function (index) {
                if ($(this)for() === "BillingNewAddress_Email") $(this).css("color", "red");
            });
        });


If you want to change label by javascript then code will be

$('label[for="BillingNewAddress_Email"]').css("color", "red");
9 anos atrás
Can't seem to get that to work.
9 anos atrás
you have to call this function on document on ready

$(document).ready(function()
{
$('label[for="BillingNewAddress_Email"]').css("color", "red");
});
9 anos atrás
If you want to ADD A LABEL to the OPC, you'll find what you're looking for under \Themes\(yourtheme)\Views\Checkout\BillingAddress.cshtml -
specifically here:

<li class="email">
    <label>@T("Address.Fields.Email"):</label>
    <span>@item.Email</span>
</li>
9 anos atrás
anik1991 wrote:
you have to call this function on document on ready

$(document).ready(function()
{
$('label[for="BillingNewAddress_Email"]').css("color", "red");
});


Thanks, that worked. I ended up using .append

Here is my final thing, in case anyone else finds a need for it:

        $(document).ready(function () {
            $('label[for="BillingNewAddress_Email"]').append("<br /><special>Software products are sent to this email.<special>");
        });
        

special {
    font-size: 11px;
    color: red;
}
9 anos atrás
DannyO wrote:
If you want to ADD A LABEL to the OPC, you'll find what you're looking for under \Themes\(yourtheme)\Views\Checkout\BillingAddress.cshtml -
specifically here:

<li class="email">
    <label>@T("Address.Fields.Email"):</label>
    <span>@item.Email</span>
</li>


I actually couldn't find this under that filepath, and what I did find (store/veiws/checkout) didn't seem to change anything. That was one of the first things I tried.
9 anos atrás
wallace11bravo wrote:
If you want to ADD A LABEL to the OPC, you'll find what you're looking for under \Themes\(yourtheme)\Views\Checkout\BillingAddress.cshtml -
specifically here:

<li class="email">
    <label>@T("Address.Fields.Email"):</label>
    <span>@item.Email</span>
</li>


I actually couldn't find this under that filepath, and what I did find (store/veiws/checkout) didn't seem to change anything. That was one of the first things I tried.

You go to views->shared->_CreateOrUpdateAddress.cshtml
you found

<div class="inputs">
        @Html.LabelFor(model => model.Email, new { }, ":")
            @Html.EditorFor(model => model.Email)
        @Html.RequiredHint()
        @Html.ValidationMessageFor(model => model.Email)
    </div>

Here you can add  <label>@T("Address.Fields.Email"):</label>.
But if you add here it will be added in every address from.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.