kod Posted May 7, 2019 Share Posted May 7, 2019 Hi, in shipping cart i see my cart, I would like créate button générate pdf cart quick without order. i dump the cart: How i cant get the data cart to PDF ? is possible to genarate this dump top pdf ? thank's for reply Link to comment Share on other sites More sharing options...
kod Posted May 7, 2019 Author Share Posted May 7, 2019 I try this: <div id="_desktop_cart"> <script type="text/javascript" src="https://mydomain.com/themes/classic/modules/ps_shoppingcart/jsPDF/examples/js/jquery/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="https://mydomain.com/themes/classic/modules/ps_shoppingcart/jsPDF/examples/js/jquery/jquery-ui-1.8.17.custom.min.js"></script> <script type="text/javascript" src="https://mydomain.com/themes/classic/modules/ps_shoppingcart/jsPDF/dist/jspdf.debug.js"></script> <script type="text/javascript" src="https://mydomain.com/themes/classic/modules/ps_shoppingcart/jsPDF/examples/js/basic.js"></script> <script> function genPDF(panier){ console.log("kkk"); var doc = new jsPDF(); doc.text(20, 20, 'Hello world!'); doc.text(20, 30, 'ytoto'); doc.addPage(); doc.text(20, 20, panier); // Save the PDF doc.save('monpdf.pdf'); } </script> <div class="blockcart cart-preview {if $cart.products_count > 0}active{else}inactive{/if}" data-refresh-url="{$refresh_url}"> <div class="header"> {if $cart.products_count > 0} <a rel="nofollow" href="{$cart_url}"> {/if} <i class="material-icons shopping-cart">shopping_cart</i> <span class="hidden-sm-down">{l s='Cart' d='Shop.Theme.Checkout'}</span> <span class="cart-products-count">({$cart.products_count})</span> <br/> <a href="javascript:genPDF('$cart')" class="button">Run Code</a></p> {if $cart.products_count > 0} </a> {/if} panier is not here Link to comment Share on other sites More sharing options...
kod Posted May 7, 2019 Author Share Posted May 7, 2019 (edited) I try this <div id="_desktop_cart"> <div class="blockcart cart-preview {if $cart.products_count > 0}active{else}inactive{/if}" data-refresh-url="{$refresh_url}"> <div class="header"> {if $cart.products_count > 0} <a rel="nofollow" href="{$cart_url}"> {/if} <i class="material-icons shopping-cart">shopping_cart</i> <span class="hidden-sm-down">{l s='Cart' d='Shop.Theme.Checkout'}</span> <span class="cart-products-count">({$cart.products_count})</span> <div id="panier"> {$cart nofilter} </div> <script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script> <script>console.log(cart)</script> <script> var pdf = new jsPDF('p', 'pt', 'letter'); pdf.html(document.getElementById('panier'), { callback: function (pdf) { var iframe = document.createElement('iframe'); iframe.setAttribute('style', 'position:absolute;right:0; top:0; bottom:0; height:100%; width:500px'); document.body.appendChild(iframe); iframe.src = pdf.output('datauristring'); } }); </script> <!-- {$cart|dump} --> {if $cart.products_count > 0} </a> {/if} </div> </div> </div> I have a pdf but the $car is array, how cant easy to have html deploy array ? is use this lib: https://github.com/eKoopmans/html2pdf.js Edited May 7, 2019 by kod (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now