How does one change "Order Now" button to "Submit" for a single catalog item that has no cart layout?

Kristian Johns3
Tera Expert

What's the best way to change the label for the "Order Now" button to "Submit" for a single catalog item where there is no cart layout. The old document.getElementById("oi_order_now_button").innerHTML='Submit'; catalog client on load script solution doesn't seem to work anymore, and neither do a few other document solutions. This is in Jakarta.

1 ACCEPTED SOLUTION

Kristian Johns3
Tera Expert

I copied the catalog_cart_default UI Macro and disabled the original, and then created a custom field called u_show_submit and created an orderLabel variable to contain the "Submit" text.

 

<g:evaluate var="jvar_orderLabel" object="true">
    var orderLabel = "Order Now";
    <j:if test="${sc_cat_item.u_show_submit == true}">
        orderLabel = "submit";
    </j:if>
	orderLabel;
</g:evaluate>

Then wherever the label is written as "Order Now" it can be switched out with the variable:

<j:if test="${sc_cat_item.no_order_now != true}">
    <g:sc_button img="images/button_cursor.gifx" classes="request_catalog_button_with_icon" id="order_now" onclick="if ($$('.order_buttons .disabled_order_button').length == 0) { orderNow(); } else { alert('${gs.getMessage('Please wait - price being updated')}'); }" label="${jvar_orderLabel}" title="Order Now" isPrimary="true"/>
</j:if>

View solution in original post

13 REPLIES 13

Thanks much Mark!

FYI, we are at New York version and it works fine for us. I unchecked the 'Isolate Script' option in the On Load Catalog Client Script and used below code in the script:

document.getElementById('order_now').innerHTML = 'Submit Request';

Kristian Johns3
Tera Expert

I copied the catalog_cart_default UI Macro and disabled the original, and then created a custom field called u_show_submit and created an orderLabel variable to contain the "Submit" text.

 

<g:evaluate var="jvar_orderLabel" object="true">
    var orderLabel = "Order Now";
    <j:if test="${sc_cat_item.u_show_submit == true}">
        orderLabel = "submit";
    </j:if>
	orderLabel;
</g:evaluate>

Then wherever the label is written as "Order Now" it can be switched out with the variable:

<j:if test="${sc_cat_item.no_order_now != true}">
    <g:sc_button img="images/button_cursor.gifx" classes="request_catalog_button_with_icon" id="order_now" onclick="if ($$('.order_buttons .disabled_order_button').length == 0) { orderNow(); } else { alert('${gs.getMessage('Please wait - price being updated')}'); }" label="${jvar_orderLabel}" title="Order Now" isPrimary="true"/>
</j:if>

Hi Kristian,

seeing your solution to change the "Order Now" button on an order guide to "Submit".  So did you just added these 2 code snippets to your copied "catalog_cart_default" UI Macro?  Do these code snippets need to go in a specific spot in the macro script?  Did you remove any script?  thank in advance!  Patrick

Ivar Donado
Mega Sage

A few months late, but I'd like to add that the script you mention is not working anymore because the id of the "Order now" button was changed, instead of "oi_order_now_button" it is now just called "order_now".

I had the same requirement today to change that button to "Submit" for a single catalog item, I saw your script and started to search through the browser inspector for that order now button, found the id was different. I changed your script with the new id and it worked.

Ps: I did this in a London instance

function onLoad() {
   document.getElementById("order_now").innerHTML='Submit';
}