Jump to content

[Help] - cart count outside of WHMCS


hostsupport

Recommended Posts

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!

Link to comment
Share on other sites

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. :idea:

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated