News:

Looking for documentation? Take a look on our wiki

Main Menu

Can't get Guest Checkout to Work in VM4

Started by smusselm, January 30, 2024, 23:06:17 PM

Previous topic - Next topic

smusselm

I used the following code on my cart default template override in VM3 to accomplish guest checkout along with a note that shipping won't be calculated without entering an address.

//CUSTOMIZATION - Display Buttons if not Logged In
    if($userID ==0 && empty($this->cart->BTaddress['fields']['email']['value'])){?><div class="tocheckout">To Checkout</div><a href="#" class="button cart-login">Sign In</a> <a href="<?php echo JRoute::('index.php?option=com_virtuemart&view=user'$this->useXHTML$this->useSSL?>" rel="nofollow" class="button cart-register">Register</a> <a href="<?php echo JRoute::('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT'$this->useXHTML$this->useSSL?>" rel="nofollow" class="button cart-guest">Continue as Guest</a><?php 
    if(
$userID ==&& !empty($this->cart->BTaddress['fields']['email']['value'])){?>
<div class="tocheckout">You are currently checking out as a guest. If you'd like to create an online account </div><a href="<?php echo JRoute::('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT'$this->useXHTML$this->useSSL?>" rel="nofollow" class="button cart-register">Register</a></a><?php //print_r($this->cart->BT);


The issue is that with the J4 router, I can't get the Guest checkout page to appear.  It goes to /vm-account/user/editaddresscartbt.html, which displays some sort of account page, but without a guest checkout button. However, if I turn off SEF URLs across the entire site, everything works perfectly, which isn't an option.

The non-sef URL that works: /index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT&Itemid=1701

What am I missing? I don't need this particular URL to be an SEF URL, I just need guest checkout to work. Even if I hardcode the itemid in the URL, it still doesn't work.

Thanks!