News:

Looking for documentation? Take a look on our wiki

Main Menu

CheckOut Button after adding product to cart

Started by urzh12, June 16, 2016, 03:01:33 AM

Previous topic - Next topic

urzh12

I want to add the "checkout button" once after I add a product to my cart.

Behavior: Click on Menu item to linked product -> Add to cart -> Popup shows options "continue shopping" and "show cart". I want to add a 3rd button for "checkout now".

The show cart is misleading as to just check whats in your cart, even though there is a checkout option presented when you click show cart. I want users to be able to checkout immediately upon adding an item to a cart.


jenkinhill

Make an override for components/com_virtuemart/views/cart/tmpl/padded.php with a link to the page you want to use for checkout.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

urzh12

Thank you for the reply.

Screenshot is attached - I want to add a 3rd button for checkout. Can you tell me the override please? Also attached my padded file

MagikCommerce

#3
Hello urzh12,

You need to create html for checkout button with form in your expected file (e.g. /templates/selected_template/html/com_virtuemart/cart/padded.php) as given follow.

<?php
if (!class_exists('VirtueMartCart')) require(VMPATH_SITE DS 'helpers' DS 'cart.php');
$cart VirtueMartCart::getCart();

if (
$cart->getDataValidated()) {
if($cart->_inConfirm){

$text vmText::_('COM_VIRTUEMART_CANCEL_CONFIRM');
$checkout_task 'cancel';
} else {

$text vmText::_('COM_VIRTUEMART_ORDER_CONFIRM_MNU');
$checkout_task 'confirm';
}
} else {

$text vmText::_('COM_VIRTUEMART_CHECKOUT_TITLE');
$checkout_task 'checkout';
}

$dynUpdate '';
if( VmConfig::get('oncheckout_ajax',false)) {
$dynUpdate=' data-dynamic-update="1" ';
}
$taskRoute '';
?>


<form method="post" id="checkoutForm" name="checkoutForm" action="<?php echo JRoute::('index.php?option=com_virtuemart&view=cart' $taskRoute$this->useXHTML$this->useSSL); ?>">
            <?php
              echo '<br /><button type="submit" id="checkoutFormSubmit" name="'.$checkout_task.'" value="1" class="vm-button-correct" '.$dynUpdate.'><span>' . $text . '</span> </button>';
           ?>

<input type='hidden' name='order_language' value='<?php echo $this->order_language?>'/>
<input type='hidden' name='task' value='updatecart'/>
<input type='hidden' name='option' value='com_virtuemart'/>
<input type='hidden' name='view' value='cart'/>
</form>



Enjoy Virtuemart !  EnJoy MagikCommerce!

Regards,
MagikCommerce

urzh12

Hello!

This worked GREAT! I added <center> attribute so button aligned. See attached. Thanks so much!