Всем добрава утра!
у мена стоит Joomla 1.5.14? virtmart 1.1.4.
после вывода содержимого корзины добавила вывод способа доставки и логина-регистрации:
файл
www\administrator\components\com_virtuemart\html\shop.cart.php принял вид
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
*
* @version $Id: shop.cart.php 1095 2007-12-19 20:19:16Z soeren_nb $
* @package VirtueMart
* @subpackage html
* @copyright Copyright (C) 2004-2007 soeren - 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.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName( __FILE__ );
require_once( CLASSPATH . "ps_checkout.php" );
$ship_to_info_id = vmGet( $_REQUEST, 'ship_to_info_id');
$shipping_rate_id = urldecode(vmGet( $_REQUEST, "shipping_rate_id", null ));
$payment_method_id = vmGet( $_REQUEST, 'payment_method_id');
$Itemid = $sess->getShopItemid();
/* Decide, which Checkout Step is the next one
* $checkout_this_step controls the step thru the checkout process
* we have the following steps
* -CHECK_OUT_GET_SHIPPING_ADDR
* let the user choose a shipto address
* -CHECK_OUT_GET_SHIPPING_METHOD
* let the user choose a shipto metho for the ship to address
* -CHECK_OUT_GET_PAYMENT_METHOD
* let the user choose a payment method
* -CHECK_OUT_GET_FINAL_CONFIRMATION
* shows a total summary including all payments, taxes, fees etc. and let the user confirm
*/
$current_stage = ps_checkout::get_current_stage();
$checkout_steps = ps_checkout::get_checkout_steps();
// Get the zone quantity after it has been calculated in the basket
$zone_qty = vmGet( $_REQUEST, 'zone_qty');
$theme = new $GLOBALS['VM_THEMECLASS']();
$next_page = 'checkout.index';
$theme->set_vars( // Import these values into the template files
array( 'zone_qty' => $zone_qty,
'ship_to_info_id' => $ship_to_info_id,
'shipping_rate_id' => $shipping_rate_id,
'payment_method_id' => $payment_method_id,
'weight_total' => $weight_total,
'Itemid' => $Itemid
)
);
$manufacturer_id = vmGet( $_REQUEST, 'manufacturer_id');
$mainframe->setPageTitle( $VM_LANG->_('PHPSHOP_CART_TITLE') );
$mainframe->appendPathWay( $VM_LANG->_('PHPSHOP_CART_TITLE') );
$continue_link = '';
if( !empty( $category_id)) {
$continue_link = $sess->url( $_SERVER['PHP_SELF'].'?page=shop.browse&category_id='.$category_id );
}
elseif( empty( $category_id) && !empty($product_id)) {
$db->query( 'SELECT `category_id` FROM `#__{vm}_product_category_xref` WHERE `product_id`='.intval($product_id) );
$db->next_record();
$category_id = $db->f('category_id');
$continue_link = $sess->url( $_SERVER['PHP_SELF'].'?page=shop.browse&category_id='.$category_id );
}
elseif( !empty( $manufacturer_id )) {
$continue_link = $sess->url( $_SERVER['PHP_SELF'].'?page=shop.browse&manufacturer_id='.$manufacturer_id );
}
$show_basket = true;
$tpl = new $GLOBALS['VM_THEMECLASS']();
$tpl->set('show_basket', $show_basket );
$tpl->set('continue_link', $continue_link );
$tpl->set('category_id', $category_id );
$tpl->set('product_id', $product_id );
$tpl->set('manufacturer_id', $manufacturer_id );
$tpl->set('cart', $cart );
echo '<h2>'. $VM_LANG->_('PHPSHOP_CART_TITLE').'</h2><br/>
<!-- Cart Begins here -->
';
include(PAGEPATH. 'basket.php');
//echo $basket_html;
//echo '<!-- End Cart --><br /><br />';
//echo $tpl->fetch( "pages/$page.tpl.php" );
if ($cart["idx"] > 0) {
// We have something in the Card so move on
// if ($perm->is_registered_customer($auth['user_id'])) { // user is logged in and a registered customer
$basket_html .= '<form action="'. SECUREURL.basename($_SERVER['PHP_SELF']).'" method="post" name="adminForm">
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="Itemid" value="'. $Itemid .'" />
<input type="hidden" name="user_id" value="'. $auth['user_id'] .'" />
<input type="hidden" name="page" value="'. $next_page .'" />
<input type="hidden" name="func" value="checkoutProcess" />
<input type="hidden" name="zone_qty" value="'. $zone_qty .'" />
<input type="hidden" name="ship_to_info_id" value="'. $ship_to_info_id .'" />
<input type="hidden" name="shipping_rate_id" value="'. urlencode($shipping_rate_id).'" />
<input type="hidden" name="payment_method_id" value="'. $payment_method_id .'" />
<input type="hidden" name="checkout_last_step" value="'. $current_stage .'" />';
$theme->set( 'basket_html', $basket_html );
// CHECK_OUT_GET_SHIPPING_METHOD
// Let the user pick a shipping method
echo '<a name="CHECK_OUT_GET_SHIPPING_METHOD"></a>';
echo $theme->fetch( 'checkout/get_shipping_method.tpl.php');
$theme->set('basket_html', '');
?>
<br /><?php
echo '<input type="hidden" name="checkout_this_step[]" value="CHECK_OUT_GET_SHIPPING_METHOD" />';
if ($perm->is_registered_customer($auth['user_id'])) { // user is logged in and a registered customer
; }
else {
if (!empty($auth['user_id'])) {
// USER IS LOGGED IN, BUT NO REGISTERED CUSTOMER
// WE NEED SOME ADDITIONAL INFORMATION HERE,
// SO REDIRECT HIM TO shop/shopper_add
$vmLogger->info( $VM_LANG->_('PHPSHOP_NO_CUSTOMER',false) );
include(PAGEPATH. 'checkout_register_form.php');
}
else {
// user is not logged in
echo $theme->fetch( 'checkout/login_registration.tpl.php' );
}
}
// Close the Checkout Form, which was opened in the first checkout template using the variable $basket_html
}
echo $tpl->fetch( "pages/$page.tpl.php" );
if ($cart["idx"]) {
?>
<input class="button" type="submit" name="formSubmit" value="<?php echo $VM_LANG->_('PHPSHOP_CHECKOUT_NEXT');?> >>" onclick="return( submitregistration());"/>
<?php
echo '</form>';
if( !in_array('CHECK_OUT_GET_FINAL_CONFIRMATION', $checkout_steps[$current_stage]) ) {
echo "<script type=\"text/javascript\"><!--
function submit_order( form ) { return true; }
--></script>";
}
}
?>
Тип регистрации пользователя - опциональное создание учетной записи.
и теперь вопрос - если я логинюсь, при нажатии на кнопку "вход", я остаюсь на этой же странице, и могу перейти к подтверждению заказа через submit,
но если я ввожу данные для регистрации и нажимаю "Регистрация" то автоматом перехожу на страницу подтверждения заказа, причем метод доставки - пустое значение, т.е. данные с формы о доставке не передаются.
где подправить обработку "Регистрации", чтобы оставаться на этой же странице?
надеюсь, понятно все описала. может что где криво. очень надеюсь на вашу помощь. третий день бьюсь...