hostsupport Posted March 20, 2017 Share Posted March 20, 2017 Hi WHMCS community! We are using a custom HTML template for our site design and this is separate from our billing system which is located at client.xxxxdomain.com We would like to know how to display the cart count outside of the WHMCS directory and to display it on our HTML coded template. Is there a way to call the cart function? If so, can someone please provide the code? Thank you for your help! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 20, 2017 Share Posted March 20, 2017 http://docs.whmcs.com/Data_Feeds they're not listed on the above page, but in your /feeds directory, you'll have 2 data feeds - cartnumitems.php and carttotal.php - the first outputs the number of items in the cart; the second the cart total. e.g., outside of WHMCS, you could use the code below to output the number of items in the cart.. <script language="javascript" src="feeds/cartnumitems.php"></script> ... you may need to tweak the path to the feed, but once you get that right, then the output should work - same goes for carttotal too. 0 Quote Link to comment Share on other sites More sharing options...
hostsupport Posted March 20, 2017 Author Share Posted March 20, 2017 Brian, Thank you for taking the time to reply. Will this also display the cart image with "view cart" next to it? or does this just display the output of cart count and cart total (ie: (1) or (2) products in cart) ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 20, 2017 Share Posted March 20, 2017 Will this also display the cart image with "view cart" next to it? or does this just display the output of cart count and cart total (ie: (1) or (2) products in cart) ? cartnumitems will output... "You have 1 item in your basket" - but you can change that by editing the feed code... widgetoutput('You have <b>'.$cartitems.'</b> '.$items.' in your basket'); carttotal will just output the amount... "£14.95" in the used currency. you could modify the feed to output the cart image (fontawesome icon) and "View Cart", or you can do it in your HTML template yourself... whichever you feel most comfortable doing. 0 Quote Link to comment Share on other sites More sharing options...
hostsupport Posted March 20, 2017 Author Share Posted March 20, 2017 Hey Brian, Thanks again for all of your help. And to help others out that may have this issue in the future, I will share my code. You can use this code outside of the WHMCS directory and use an image next to the items in cart output. <a href="#(1) SOURCE TO CART IF YOU WANT LINK CLICKABLE#"><i class="#(2)image class#"><script language="javascript" src="#(3)full link to whmcs cart #"></script></i></a> (1) explanation: if you have an image and would like the entire code to be clickable put the link to your cart. IE: https://link.towhmcs.com/cart.php?a=view (2) explanation: this is the image class. You may be able to use img src "<img src="pic.jpg" , but I have not tried this so I cannot confirm that to be a substitute for i class predefined image. (3) explanation: this is the full path to your WHMCS. If you just use /path/to/whmcs/feeds/cartnumitems.php the cart will NOT update. You must use: http://link.towhmcs.com/feeds/cartnumitems.php Hope this helps someone else! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.