News:

Support the VirtueMart project and become a member

Main Menu

Order button does not respond

Started by sylwekb, November 03, 2015, 14:45:01 PM

Previous topic - Next topic

sylwekb

Joomla! 3.4.5, Virtuemart 3.0.10, php version 5.3.28

Order button does not respond, why? If you refresh the page works. How do I fix this error?

jenkinhill

Looks like a non-default checkout page? Most likely a JavaScript issue, http://forum.virtuemart.net/index.php?topic=119638.0
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

sylwekb

#2
I can not solve this problem. Can you look at what could be the problem?
Please add product to cart and go to the order.
It's probably something wrong in the code template file bottom
templates/my_template/html/com_virtuemart/cart/default.php

<?php
/**
 *
 * Layout for the shopping cart
 *
 * @package    VirtueMart
 * @subpackage Cart
 * @author Max Milbers
 *
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: cart.php 2551 2010-09-30 18:52:40Z milbo $
 */

// Check to ensure this file is included in Joomla!
defined ('_JEXEC') or die('Restricted access');
if (!empty (
$this->cart->products)) {
vmJsApi::jPrice();
JHtml::('behavior.formvalidation');
vmJsApi::addJScript('vm.STisBT',"
jQuery(document).ready(function($) {

if ( $('#STsameAsBTjs').is(':checked') ) {
$('#output-shipto-display').hide();
} else {
$('#output-shipto-display').show();
}
$('#STsameAsBTjs').click(function(event) {
if($(this).is(':checked')){
$('#STsameAsBT').val('1') ;
$('#output-shipto-display').hide();
} else {
$('#STsameAsBT').val('0') ;
$('#output-shipto-display').show();
}
var form = jQuery('#checkoutFormSubmit');
//document.checkoutForm.submit();
});
});
"
);

vmJsApi::addJScript('vm.checkoutFormSubmit','
jQuery(document).ready(function($) {
jQuery(this).vm2front("stopVmLoading");
jQuery("#checkoutFormSubmit").bind("click dblclick", function(e){
jQuery(this).vm2front("startVmLoading");
e.preventDefault();
jQuery(this).attr("disabled", "true");
jQuery(this).removeClass( "vm-button-correct" );
jQuery(this).addClass( "vm-button" );
jQuery(this).fadeIn( 400 );
var name = jQuery(this).attr("name");
$("#checkoutForm").append("<input name=\""+name+"\" value=\"1\" type=\"hidden\">");
$("#checkoutForm").submit();
});
});
'
);

$this->addCheckRequiredJs();
?>


<div class="cart-view">

<div class="vm-cart-header-container">
<div class="vm-continue-shopping pull-right margin-top-15">
<?php // Continue Shopping Button
if (!empty($this->continue_link_html)) { ?>

<a class="continue_link btn btn-default btn-xs" href="<?php echo $this->continue_link?>"><?php echo vmText::('COM_VIRTUEMART_CONTINUE_SHOPPING'); ?></a>
<?php ?>
</div>
<h1 class="page-header"><?php echo vmText::('COM_VIRTUEMART_CART_TITLE'); ?></h1>
    <div class="payments-signin-button"></div>
<?php if (VmConfig::get ('oncheckout_show_steps'1) && $this->checkout_task === 'confirm') { ?>
<div class="checkoutStep alert alert-info" id="checkoutStep4"><?php echo vmText::('COM_VIRTUEMART_USER_FORM_CART_STEP4'); ?></div>
<?php ?>

</div>

<?php

echo 
shopFunctionsF::getLoginForm ($this->cartFALSE);

// This displays the form to change the current shopper
if ($this->allowChangeShopper){
echo $this->loadTemplate ('shopperform');
}

$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
if(VmConfig::get('multixcart')=='byselection'){
if (!class_exists('ShopFunctions')) require(VMPATH_ADMIN DS 'helpers' DS 'shopfunctions.php');
echo shopFunctions::renderVendorFullVendorList($this->cart->vendorId);
?>

<input type="submit" name="updatecart" title="<?php echo vmText::_('COM_VIRTUEMART_SAVE'); ?>" value="<?php echo vmText::_('COM_VIRTUEMART_SAVE'); ?>" class="btn btn-default"/>
<?php
}

if ( VmConfig::get('oncheckout_opc',true) ){
echo $this->loadTemplate ('address');
    }

// This displays the pricelist MUST be done with tables, because it is also used for the emails
echo $this->loadTemplate ('pricelist');

if ( !VmConfig::get('oncheckout_opc',true) ){
echo $this->loadTemplate ('address');
    }

    
?>

    <hr>
<?php
if (!empty($this->checkoutAdvertise)) {
?>

<div id="checkout-advertise-box">
<?php
foreach ($this->checkoutAdvertise as $checkoutAdvertise) {
?>

<div class="checkout-advertise">
<?php echo $checkoutAdvertise?>
</div>
<?php
}
?>

</div>
<?php
}

echo $this->loadTemplate ('cartfields');

?>

    <hr>
<div class="checkout-button-top text-right">
<?php
echo $this->checkout_link_html;
?>

</div>

<?php // Continue and Checkout Button END ?>
<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>
<script>
jQuery('#checkoutFormSubmit').addClass('btn-success btn-lg btn-block');
</script>

</div>

<?php } else { ?>

<div class="cart-view text-center">
<h1 class="page-header"><?php echo vmText::('COM_VIRTUEMART_EMPTY_CART'); ?></h1>
<?php
// Continue Shopping Button
if (!empty($this->continue_link_html)) { ?>


<a class="continue_link btn btn-primary" href="<?php echo $this->continue_link?>"><?php echo vmText::('COM_VIRTUEMART_CONTINUE_SHOPPING'); ?></a>

<?php ?>
</div>

<?php ?>


sylwekb

#3
I corrected the above code and button works properly.
templates/my_template/html/com_virtuemart/cart/default.php
Following code

<?php
/**
 *
 * Layout for the shopping cart
 *
 * @package    VirtueMart
 * @subpackage Cart
 * @author Max Milbers
 *
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: cart.php 2551 2010-09-30 18:52:40Z milbo $
 */

// Check to ensure this file is included in Joomla!
defined ('_JEXEC') or die('Restricted access');

JHtml::('behavior.formvalidation');

?>


<div id="cart-view" class="cart-view">
<div class="vm-cart-header-container">
<div class="width50 floatleft vm-cart-header">
<h1><?php echo vmText::('COM_VIRTUEMART_CART_TITLE'); ?></h1>
<div class="payments-signin-button" ></div>
</div>
<?php if (VmConfig::get ('oncheckout_show_steps'1) && $this->checkout_task === 'confirm') {
echo '<div class="checkoutStep" id="checkoutStep4">' vmText::('COM_VIRTUEMART_USER_FORM_CART_STEP4') . '</div>';
?>

<div class="continue_link btn btn-default btn-xs">
<?php // Continue Shopping Button
if (!empty($this->continue_link_html)) {
echo $this->continue_link_html;
?>

</div>
<div class="clear"></div>
</div>

<?php
$uri vmURI::getCleanUrl();
$uri str_replace('&tmpl=component','',$uri);
echo shopFunctionsF::getLoginForm ($this->cartFALSE,$uri);

// This displays the form to change the current shopper
if ($this->allowChangeShopper){
echo $this->loadTemplate ('shopperform');
}


$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
if(VmConfig::get('multixcart')=='byselection'){
if (!class_exists('ShopFunctions')) require(VMPATH_ADMIN DS 'helpers' DS 'shopfunctions.php');
echo shopFunctions::renderVendorFullVendorList($this->cart->vendorId);
?>
<input type="submit" name="updatecart" title="<?php echo vmText::_('COM_VIRTUEMART_SAVE'); ?>" value="<?php echo vmText::_('COM_VIRTUEMART_SAVE'); ?>" class="button"  style="margin-left: 10px;"/><?php
}
echo $this->loadTemplate ('address');
// This displays the pricelist MUST be done with tables, because it is also used for the emails
echo $this->loadTemplate ('pricelist');

if (!empty($this->checkoutAdvertise)) {
?>
<div id="checkout-advertise-box"> <?php
foreach ($this->checkoutAdvertise as $checkoutAdvertise) {
?>

<div class="checkout-advertise">
<?php echo $checkoutAdvertise?>
</div>
<?php
}
?>
</div><?php
}

echo $this->loadTemplate ('cartfields');

?>
<div class="checkout-button-top"> <?php
echo $this->checkout_link_html;
?>
</div>

<?php // Continue and Checkout Button END ?>
<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>
<script>
jQuery('#checkoutFormSubmit').addClass('btn-success btn-lg btn-block');
</script>

<?php

if(VmConfig::get('oncheckout_ajax',false)){
vmJsApi::addJScript('updDynamicListeners',"
if (typeof Virtuemart.containerSelector === 'undefined') Virtuemart.containerSelector = '#cart-view';
if (typeof Virtuemart.container === 'undefined') Virtuemart.container = jQuery(Virtuemart.containerSelector);

jQuery(document).ready(function() {
if (Virtuemart.container)
Virtuemart.updDynFormListeners();
}); "
);
}


vmJsApi::addJScript('vm.checkoutFormSubmit',"
Virtuemart.bCheckoutButton = function(e) {
e.preventDefault();
jQuery(this).vm2front('startVmLoading');
jQuery(this).attr('disabled', 'true');
jQuery(this).removeClass( 'vm-button-correct' );
jQuery(this).addClass( 'vm-button' );
jQuery(this).fadeIn( 400 );
var name = jQuery(this).attr('name');
var div = '<input name=\"'+name+'\" value=\"1\" type=\"hidden\">';

jQuery('#checkoutForm').append(div);
//Virtuemart.updForm();
jQuery('#checkoutForm').submit();
}
jQuery(document).ready(function($) {
jQuery(this).vm2front('stopVmLoading');
var el = jQuery('#checkoutFormSubmit');
el.unbind('click dblclick');
el.on('click dblclick',Virtuemart.bCheckoutButton);
});
"
);

vmJsApi::addJScript('vm.STisBT',"
jQuery(document).ready(function($) {

if ( $('#STsameAsBTjs').is(':checked') ) {
$('#output-shipto-display').hide();
} else {
$('#output-shipto-display').show();
}
$('#STsameAsBTjs').click(function(event) {
if($(this).is(':checked')){
$('#STsameAsBT').val('1') ;
$('#output-shipto-display').hide();
} else {
$('#STsameAsBT').val('0') ;
$('#output-shipto-display').show();
}
var form = jQuery('#checkoutFormSubmit');
form.submit();
});
});
"
);

$this->addCheckRequiredJs();



echo 
vmJsApi::writeJS();

?>

</div>

jenkinhill

I presume you will let Spyros, the template developer, know about that?
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

muddauber


sylwekb