How to change Price in the Catalog Item form?

Danny Sun
Tera Guru

Hello,

        I need to add a text field called Order Quantity in the catalog item form, this form just numeric only, if this field changes, I need to update the "Price" to multiply the entire cost of the catalog item by the number in the "Order Quantity" field, and the new price will be update date to the "Shopping Cart" when the catalog item be checked out.

        I don't know how to get the "Price" in the catalog item using the Client Script? How to update the "Price" when the "Order Quantity" field changes? And how to update the "Price" to the "Shopping Cart" when the when the catalog item be checked out?

        Do you have any suggestions?

        See the picture below:

New Bitmap Image.bmp

Best Regards,

Danny

1 ACCEPTED SOLUTION

Hi Jessica,



Not sure you would want to do this using the below approach, i have replaced the 'dropdown box' with a 'text box' like below



find_real_file.png



changes done:



macro name: sc_order_item_price_quantiy   ( this is under maintain cart layouts--> Target type: Browser Widget (3)--> Item Ordering Widget)



Original lines:



  <span id="quantity_span">


                                      <g:evaluate expression="var choice_list = GlideScriptChoiceList.getChoiceList('sc_cart_item', 'quantity');" />


                                      <select id="quantity" onchange="orderItemWidget.calcPrice()">


                                              <g:options choiceList="${choice_list}" choiceValue="${jvar_cart_item.quantity}" />


                                      </select>


    </span>




replaced lines:



  <span id="quantity_span">


                                      <g:evaluate expression="var choice_list = GlideScriptChoiceList.getChoiceList('sc_cart_item', 'quantity');" />



  <div class="select-editable">



  <input type="text" id="quantity" name="quantity" onchange="orderItemWidget.calcPrice();"/>



  </div>


  </span>



<style>


  .select-editable {


        position:relative;


        background-color:white;


        border:solid grey 1px;


        width:120px;


        height:18px;


}


.select-editable select {


        position:absolute;


        top:0px;


        left:0px;


        font-size:14px;


        border:none;


        width:120px;


        margin:0;


}


.select-editable input {


        position:absolute;


        top:0px;


        left:0px;


        width:100px;


        padding:1px;


        font-size:12px;


        border:none;


}


.select-editable select:focus, .select-editable input:focus {


        outline:none;


}


</style>





Note: This macro is read only as this is OOTB one, you will have to create   a new one over here:( maintain cart layouts--> Target type: Browser Widget (3)--> Item Ordering Widget)) and delete the original macro from here (not the macro record))



Disclaimer: Any changes made to the OOTB macros or any other objects will not be upgraded during version upgrades, its our sole responsibility to do so.





In case you dont wanna follow the above approach!   you may refer this link: Re: Overwriting CatalogPriceCalculator script include




Please make answer as appropriate or correct!, if it helped!



Regards


Yogish


View solution in original post

19 REPLIES 19

ProbirDas
Tera Expert

Hello Danny,



We have the 'Quantity' field as part of the catalog item. Not sure whether you really need to create a variable for this purpose. Based on the price and the quantity, the total would be calculated



If you really need 'Quantity' variable, then on change of 'Quantity', you might have to query your cart (sc_cart), find your catalog item and update the quantity field.



Regards,


Probir


Hi Probir,



Thanks for your answer. We really need 'Quantity' field with the Single line text variable type, because we need input different large numbers to the Quantity field. Such as 100,150,500 and so on.



I don't know how to update the Price when the Order Quantity field changes. I will try to working on this.



Regards,


Danny


Hi Danny,



Any luck with this? We are looking to do something similar.



1. Quantity single line text field where customers can enter 1 or more (5000 if they really want)


2. The Quantity would then get multiplied by the base price and the sub-total would get updated automagically as well



Matthew


Hey Danny,



Like I suggested in a similar post, I think your best course of action would be to omit price and quantity from the UI Macro on the right and simply have a read-only variable on the form itself with the subtotal. Then in the workflow you can just generate the individual requests in the same manner as the multiple quantity from the cart.



The reason for this suggestion is to avoid changing OOB tools and functionality, which can cause issues with continuity and upgrading down the line.



Hope this helps.