Announcement

Collapse
No announcement yet.

Email shopping cart

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    A P.S. If I go to Design Mode and select Shopping Cart my CPU utilization goes high and it's incredibly slow to scroll the Preview Pane. Are you seeing this too?
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #17
      Code that puts a link on each item and has better grammar.
      Code:
      <script type="text/javascript">
      function mailpage() {
          var prodrows = $( "tr.cartprodlinerow" );
          var lines = "I thought you might like "
              + (prodrows.length < 2 ? "this" : "these")
              + "\n\n";
          prodrows.each(function(){
              lines    += $( ".cpdname", $(this) ).text() 
                      + $( ".cpdprice", $(this) ).text().replace('£', 'GBP') 
                      + " Qty: " + $( ".cpdqty", $(this) ).find('input').val() 
                      + "\n("    + $( ".cpdname", $(this) ).find('a').attr('href') + ")"
                      + "\n\n";
          });
          mail_str = "mailto:?subject=" + escape ("Have a look at this: ");
          mail_str += "&body=" + escape (lines) + "\n\n";
          location.href = mail_str;
      };
      </script>
      <a class="btn btn-secondary" href="javascript:mailpage()"><i class="fa fa-envelope"></i>&nbsp;Email the basket</a>
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #18
        Thank you very much Norman

        It is all working now with this code (including #13 above) and a print option added.

        Code:
        <script language="javascript">
        function mailpage() {
            var lines = "I thought you might like this \n\n ";
            $( "tr.cartprodlinerow" ).each(function(){
                lines += $( ".cpdname", $(this) ).text() + ' ' + $( ".cpdprice", $(this) ).text().replace("£", "GBP") + ' Qty: ' + $( ".cpdqty", $(this) ).val() + "\n\n";
            });
            mail_str = "mailto:?subject=" + escape ("Have a look at this: ");
            mail_str += "&body=" + escape(lines + "\n\n");
            mail_str += escape (". You can see it at <actinic:variable name="WebSiteURL" />");
            location.href = mail_str;
        };
        
        function prntjc(){
        var printlines = "<h2>Basket contents </h2>";
            $( "tr.cartprodlinerow" ).each(function(){
                printlines += "<p>" + $( ".cpdname", $(this) ).text() + ' ' + $( ".cpdprice", $(this) ).text() + ' Qty: ' + $( ".cpdqty", $(this) ).val() + "</p>";
            });
        myHTML = printlines;
          myWin = window.open("about:blank", "_blank");
          myWin.document.write(myHTML);
          myWin.print();
        }
          </script>
        
        <!--<button class="btn btn-secondary" type="button" value="Click Me" onclick="prntjc()"><i class="fa fa-print"></i> Print basket</button>-->
        <a class="btn btn-secondary" style="margin-bottom:1em;" href="javascript:prntjc()"><i class="fa fa-print"></i> Print the basket</a>&nbsp;
        <a class="btn btn-secondary" style="margin-bottom:1em;" href="javascript:mailpage()"><i class="fa fa-envelope"></i> Email the basket</a>
        Jonathan Chappell
        Website Designer
        SellerDeck Website Designer
        Actinic to SellerDeck upgrades
        Graphicz Limited - www.graphicz.co.uk

        Comment

        Working...
        X