| Project: | Ubercart Contributions |
| Component: | Code |
| Category: | |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (needs review) |
Jump to:
Description
Project:
Ubercart This patch adds a "note" field that shipping quote callbacks can use to display additional information to the user. This can be something like "Estimated delivery date is October 31st". It only shows up under the shipping option_label on the shipping pane, and when the item is selected, the note doesn't get copied to the totals pane.
Index: shipping/uc_quote/uc_quote.js
===================================================================
--- shipping/uc_quote/uc_quote.js (revision 13)
+++ shipping/uc_quote/uc_quote.js (working copy)
@@ -89,12 +89,16 @@
else{
if (data[i].rate != undefined){
if (numQuotes > 1 && page != 'cart'){
- quoteDiv.append("<div class=\"form-item\">\n"
+ var item = "<div class=\"form-item\">\n"
+ "<input type=\"hidden\" name=\"rate[" + i + "]\" value=\"" + Number(data[i].rate).toFixed(2)
+ "\" />\n"
+ "<label class=\"option\">"
+ "<input type=\"radio\" class=\"form-radio\" name=\"quote-option\" value=\"" + i + "\" />\n"
- + label + ": " + data[i].format + "</label>\n</div>\n"
- );
+ + label + ": " + data[i].format + "</label>\n";
+ if (data[i].notes) {
+ item += "<div class=\"quote-notes\">" + data[i].notes + "</div>\n";
+ }
+ item += "</div>\n";
+ quoteDiv.append(item);
if (page == "checkout"){
quoteDiv.find("input:radio[@value=" + i +"]").click(function(){
var i = $(this).val();
@@ -105,11 +109,15 @@
}
}
else{
- quoteDiv.append("<div>\n"
+ var item = "<div>\n"
+ "<input type=\"hidden\" name=\"quote-option\" value=\"" + i + "\" />\n"
+ "<input type=\"hidden\" name=\"rate[" + i + "]\" value=\"" + Number(data[i].rate).toFixed(2) + "\" />\n"
- + "<label class=\"option\">" + label + ": " + data[i].format + "</label>\n</div>\n"
- );
+ + "<label class=\"option\">" + label + ": " + data[i].format + "</label>\n";
+ if (data[i].notes) {
+ item += "<div class=\"quote-notes\">" + data[i].notes + "</div>\n";
+ }
+ item += "</div>\n";
+ quoteDiv.append(item);
if (page == "checkout"){
if (label != "" && set_line_item != undefined){
set_line_item("shipping", label, Number(data[i].rate).toFixed(2), 1);
Index: shipping/uc_quote/uc_quote.css
===================================================================
--- shipping/uc_quote/uc_quote.css (revision 13)
+++ shipping/uc_quote/uc_quote.css (working copy)
@@ -19,3 +19,7 @@
margin-right: 2px;
cursor: pointer;
}
+
+.quote-notes {
+ margin-left: 25px;
+}
