Jump to content

Shopping Cart in a Subdomain?


Annaleria

Recommended Posts

Is this add on still available? I've tried to download the free copy several times now to evaluate it but I never receive the download link and I've even tried to use different email addresses.

 

If not can someone please advise on displaying a WHMCS shopping cart in a subdomain?

 

Thanks in advance.

Link to comment
Share on other sites

The issue isn't installing WHMCS in a subdomain as that is what we have done, however we want to be able to display the contents of the basket on our main site which is installed on the main domain. These domains are all on the same server btw.

 

So we have WHMCS installed on account.mysite.com and the main site is http://www.mysite.com and we wish to be able to display the contents of the basket in a mini cart in the header of http://www.mysite.com

Link to comment
Share on other sites

This is the link to the addon as it appears in the appstore, but as I mentioned I've not been able to actually download the addon to try it.

took me a couple of attempts, but eventually managed to download it from the site - have you checked your spam folder? I just used a temporary email address though as I won't be needing the hook.

 

I can't tell you if it works with v6.3.1 as it caused an Ioncube error message when I installed it! :roll:

 

it seems to have been updated last in July 2015, so might be v6 compatible... unsure if the cart changes in v6.2, and its new templates, would affect this hook though... i'm not even sure if it's needed if you're using the Six template. :?:

Link to comment
Share on other sites

I have now managed to download it, but I had to create an account first. Looking at the readme.txt there are instructions for template five and six, but it would appear that this will not solve the issue that I wanted the addon for :(

 

Thank you for taking a look Brian, if you've any further ideas about displaying the basket details in the domain where WHMCS is installed in a subdomain I'd be very keen to hear them.

Link to comment
Share on other sites

I have now managed to download it, but I had to create an account first. Looking at the readme.txt there are instructions for template five and six, but it would appear that this will not solve the issue that I wanted the addon for :(

if memory serves, the hook just does what's there by default in v6 which is to show the cart total and number of items in the cart in WHMCS itself - when it was originally written in 2013, those features wouldn't have been available in WHMCS - hence why the hook was written... as of v6, I think it's pretty much redundant.

 

Thank you for taking a look Brian, if you've any further ideas about displaying the basket details in the domain where WHMCS is installed in a subdomain I'd be very keen to hear them.

as far as i'm aware, the simplest way to display the basket details on an external site would be to use a Data Feed.

 

although they are not specifically mentioned in the above documentation, WHMCS has two built-in data feeds that you can use on your external site to show a) the number of items in the cart and b) the total value of the cart.

 

on your external site, to show the number of items in the WHMCS cart, you would add the following code to your page...

 

<script language="javascript" src="feeds/cartnumitems.php"></script>

and to show the cart total...

 

<script language="javascript" src="feeds/carttotal.php"></script>

as long as you get the paths to your WHMCS installations feeds directory correct in the above URLs, they should work. :idea:

Link to comment
Share on other sites

That's great information about the feeds, thank you Brian, I'll look into that. Is this the only data available by the feeds? Would it be possible to get the cart item details, say via AJAX on a button click for example using some method?

Link to comment
Share on other sites

if it's available to the $_session variable, then you should be able to pass the information in a data feed... if memory serves, though it's been a while since I checked so it might have changed, I think the session array includes any domain names in the cart, but doesn't include products by name - only their PID value... so if you wanted a feed to pass a product name, you'd probably have to query the database in the feed code.

 

remember that the code within these data feeds is not encrypted and can be edited - though if you do need to modify them, it's safer to create a new data feed file in order to prevent it from being overwritten during a WHMCS update.

 

I believe that data feeds would be the only reliable method of getting cart info to an external site... i'm fairly sure that there isn't a way to access the WHMCS session directly externally, so you're reliant on using WHMCS to access the session for you and to output it's values (which is what these data feeds do).

Link to comment
Share on other sites

Thanks Brian, this was just what I needed, after you pointed me in the direction of the feeds I took a look at the scripts and started to create our own version with to return the data we need. As you said I was aware that the data was in the $_SESSION['cart'] but I just didn't know how to access it, the feeds are the missing step I was looking for :)

Link to comment
Share on other sites

  • 4 months later...

Unfortunately, this is not working for us. We have WHMCS installed on a subdomain. If a user adds something to his shopping cart, it correctly displays the number of items in the cart. When he moves away from a WHMCS page, the counter is reset to 0 items. Going back to WHMCS shows the correct number of items.

 

We're using the correct path to the feed, seems like another session is created when switching from WHMCS to a non WHMCS page.

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