Jump to content

Add a custom TPL on Cart


felipefkk

Recommended Posts

Hey guys!

 

We are trying to add a new .TPL file inside our Cart Template, we already did everything but when we try acessing:

 

site.com/cart?a=newfile

 

It does not work, is there any way to make WHMCS see the new file as part of the template in question?

 

Thank you

Link to comment
Share on other sites

Hey Brian! Thanks for the answer! I though it would not be possible...

 

The reason why I need to add a new .tpl is to make a register page separated from the checkout page. I want to use the checkout only for payment and have the users registering before going there.

 

My solution so far is to send the user to the register.php after they go into cartview, but I don't know how to redirect the user to the checkout after that without making him having to put all products on the cart again.

Link to comment
Share on other sites

Hey Brian! Thanks for the answer! I though it would not be possible...

 

The reason why I need to add a new .tpl is to make a register page separated from the checkout page. I want to use the checkout only for payment and have the users registering before going there.

i'm tempted to ask why as it makes the order process much longer - and that's never a good idea...:?:

 

if I wanted to order a product/service from your site, and then realised that I need to register first (even though I know registration is automatically accepted), I might not continue with the order and look elsewhere.

 

I could understand it if you are using a third-party addon to confirm account registrations - but if you're not, I don't really see the point.

 

My solution so far is to send the user to the register.php after they go into cartview, but I don't know how to redirect the user to the checkout after that without making him having to put all products on the cart again.

the items should still be in the cart - so a link to cart.php?a=checkout should work.

 

depending on which order-form template you're using (some might be more flexible than others), there may be alternatives...

 

one might be to modify the templates so that only logged in users could visit the cart pages... e.g as a very basic example, if you add the following to the top of products.tpl, it will prevent the display of products to non clients (i'm using Standard Cart in my example)...

 

{if !$loggedin}
go to register.php to create an account with us, and then login! 
{else}
... rest of template...
{/if}

you may then need to make similar changes to the other templates in the order-form.... and test thoroughly!

 

I can think of other options, but they'd all make it more awkward for the user...

 

New question:

Can I decide to which page the user will go after registration? For example, after he submits his new register on my site he is redirected to cart.php?a=checkout ?

it's hard-coded that it redirects to clientarea.php after registration - so it can't be modified in the template or through admin area settings.

 

you would need to use an action hook, specifically ClientAreaRegister to redirect the user to a different url.

 

to do this, you would need to create a file in the includes/hooks folder, call it regredirect.php (or anything you want .php) and add the following code to it...

 

<?php

function hook_ClientRegistrationRedirection($vars){
$redirecturl = 'http://demo.whmcs.com'; 
echo '<meta http-equiv="refresh" content="0; url='.$redirecturl.'">';
exit;
}
add_hook("ClientAreaRegister", 1, "hook_ClientRegistrationRedirection");
?>

now after a user registers, they'll be redirected to the URL specified in the hook code - in the above example, it's to the WHMCS demo site; for you, it might be to viewcart, checkout, cart.php or elsewhere.

 

however, if I were you, i'd have a serious think about whether you want to go down the road of modifying the order process in this way, by splitting the registering/ordering pages.

Link to comment
Share on other sites

Hey Brian! Thank you so much for all your help :)

 

I didn't especify about my problem since most people would not bother to read it lol.

 

But we made a fully custom theme and cart, everything is alot different from the WHMCS concept, the user only goes to the registration page after selecting the product and adding it to the cart, we made only required to the user to register before going to the checkout as in our theme all the information is showed upon the checkout screen with the data of the client and his choices.

 

I tried using the action hook, but it wasnt working, I think it may be something related to be using ina localmachine, but I will give your script a try!

 

Thank you again for all your help :)

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