• Total price not recalculated when changing quantity

    By Valesca van Gelderen 2 decades ago

    When changing the quantity of a product in the shopping cart, the total price is not recalculated. In the agent "Update Cart" I added the line "Call itemdoc.ComputeWithForm(True, False)" before "Call itemdoc.save(True,True)" to fix this problem.

    • I found this as well (Full Code Provided)

      By Andrew Luke 2 decades ago

      Here's the full code fyi.


      Dim ns As New NotesSession<br/>
      Dim src As NotesDocument, db As NotesDatabase, view As NotesView<br/>
      Set src = ns.DocumentContext<br/>
      Set db = ns.CurrentDatabase<br/>
      Set view = db.GetView(&quot;(CartItemsLookup)&quot;)<br/>
      <br/>
      Dim argsArray As Variant, arguments List As String, argName As String, argValue As String, idxEq As Integer<br/>
      Dim SessionID As String, sess As String, docKey As String, itemdoc As NotesDocument<br/>
      <br/>
      argsArray = explode(src.Request_Content(0), &quot;&amp;&quot;)<br/>
      SessionID = src.HTTP_Cookie(0)<br/>
      sess = Strright(SessionId, &quot;DominoECommerce=&quot;)<br/>
      'sess = Strright(SessionId, &quot;=&quot;)<br/>
      <br/>
      Forall arg In argsArray <br/>
          idxEq = Instr(arg, &quot;=&quot;)<br/>
          If (idxEq &gt; 0) Then<br/>
              argName = Left(arg, idxEq - 1)<br/>
              argValue = Mid(arg, idxEq + 1)<br/>
              arguments(Lcase(argName)) = argValue<br/>
              If Instr(argName,&quot;Remove&quot;) = 0 Then   <br/>
                  docKey = argName<br/>
                  Set itemdoc = view.GetDocumentByKey(sess &amp; &quot;~&quot; &amp; docKey)<br/>
                  If argValue = &quot;0&quot; Then<br/>
                      itemdoc.remove(False)<br/>
                  Else<br/>
                      itemdoc.Qty = argValue<br/>
                      Call itemdoc.ComputeWithForm(True, False) 'THIS LINE ADDED<br/>
                      Call itemdoc.save(True,True)    <br/>
                  End If<br/>
              Else<br/>
                  itemdoc.remove(False)<br/>
              End If<br/>
          End If  <br/>
      End Forall<br/>
      <br/>
      Print(&quot;[&quot; &amp; getDBRelativeURL() &amp; &quot;Cart?OpenForm]&quot;)