День добрый, уважаемые!
Есть идея совместить 2 модуля: Корзину и Авторизацию. Смысл в том, что бы иметь в едином модуле все функции управления юзера:
- Управление учетной записью
- Возможность ведения блогов
- Ну и корзина
Вот модуль корзины:
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
// Load the VirtueMart main parse code
if( file_exists(dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' )) {
require_once( dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' );
} else {
require_once( dirname(__FILE__).'/../components/com_virtuemart/virtuemart_parser.php' );
}
//Start of routine output correct div to enable AJAX update to display correctly
echo '<div class="vmCartModule">';
global $VM_LANG, $sess, $mm_action_url;
$_SESSION['vmUseGreyBox'] = $params->get( 'vmEnableGreyBox');
$_SESSION['vmCartDirection'] = $params->get( 'vmCartDirection');
include (PAGEPATH.'shop.basket_short.php') ;
echo "</div>";
?>
Вот модуль авторизации (нестандартный):
<?php
/**
* TemplatePlazza
* TemplatePlazza.com
**/
defined('_JEXEC') or die('Restricted access');
global $mosConfig_absolute_path, $mosConfig_allowUserRegistration;
require_once JPATH_SITE . DS . "components" . DS . "com_virtuemart" . DS . "virtuemart_parser.php";
global $mm_action_url, $sess, $VM_LANG;
$user = & JFactory::getUser();
$type = (!$user->get('guest'))? 'logout' : 'login';
if( $type == 'login' ) {
// Redirect type
$redirect = $params->get('login');
// Lost password
$reset_url = JRoute::_( 'index.php?option=com_user&view=reset' );
// User name reminder (Joomla 1.5 only)
$remind_url = JRoute::_( 'index.php?option=com_user&view=remind' );
// Set the validation value
$validate = JUtility::getToken();
} else {
// Redirect type
$redirect = $params->get('logout');
// Return URL
$uri = JFactory::getURI();
$url = $uri->toString();
$return_url = base64_encode( $url );
// Set the greeting name
$user =& JFactory::getUser();
$name = ( $params->get( 'name') )? $user->name : $user->username;
}
// Post action
$action = $mm_action_url. 'index.php?option=com_user&task='.$type;
// Set the redirection URL
if( $redirect == 'home' ) {
// The Joomla! home page
$menu = &JSite::getMenu();
$default = $menu->getDefault();
$uri = JFactory::getURI( $default->link );
$url = $uri->toString();
} elseif( $redirect == 'vmhome' ) {
// The VirtueMart home page
$url = JRoute::_( 'index.php?option=com_virtuemart&page='.HOMEPAGE.'&Itemid='.$sess->getShopItemid(), false );
} else {
// The same page
$uri = JFactory::getURI();
$url = $uri->toString();
}
$return_url = base64_encode( $url );
$registration_url = $sess->url( SECUREURL.'index.php?option=com_virtuemart&page=shop.registration' );
//logout
if( $type == 'logout' ) :
?>
<div class="customerlogout">
<form action="<?php echo $action ?>" method="post" name="login" id="login">
<?php if( $params->get('greeting') ) : ?>
<div><?php echo $VM_LANG->_('HI'). ' ' . $name ?></div>
<?php endif; ?>
<?php if( $params->get('accountlink') || ENABLE_DOWNLOADS == '1' ) : ?>
<ul>
<li><a href="http://auto-maxus.ru/index.php?option=com_virtuemart&page=shop.cart"><strong><?php echo $VM_LANG->_('PHPSHOP_CART_SHOW')?></strong></a></li>
<?php if( $params->get('accountlink') ) : ?>
<li><a href="<?php echo $sess->url(SECUREURL . "index.php?page=account.index");?>"><?php echo $VM_LANG->_('PHPSHOP_ACCOUNT_TITLE')?></a></li>
<?php endif; ?>
<?php if( ENABLE_DOWNLOADS == '1' ) : ?>
<li><a href="<?php $sess->purl(SECUREURL . "index.php?page=shop.downloads");?>"><?php echo $VM_LANG->_('PHPSHOP_DOWNLOADS_TITLE')?></a></li>
<?php endif; ?>
</ul>
<?php endif; ?>
<input type="submit" name="Submit" class="button" value="<?php echo $VM_LANG->_('BUTTON_LOGOUT')?>" />
<br /><br />
<input type="hidden" name="op2" value="logout" />
<input type="hidden" name="return" value="<?php echo $return_url ?>" />
<input type="hidden" name="lang" value="english" />
<input type="hidden" name="message" value="0" />
</form>
</div>
<?php else : ?>
<div class="customerlogin">
<form action="<?php echo $action ?>" method="post" name="login" id="login">
<?php echo ($params->get('pretext'))? "<div class='pretext'>" . $params->get('pretext'). "</div>" : "" ; ?>
<div class="wrap-text login-field">
<input class="inputbox" type="text" id="username_vmlogin" size="25" name="username" value="<?php echo $VM_LANG->_('USERNAME')?>" onblur="if(this.value=='') this.value='<?php echo $VM_LANG->_('USERNAME'); ?>';" onfocus="if(this.value=='<?php echo $VM_LANG->_('USERNAME'); ?>') this.value='';" />
</div>
<div class="wrap-text password-field">
<input type="password" class="inputbox" id="password_vmlogin" size="25" name="passwd" value="<?php echo $VM_LANG->_('PASSWORD')?>" onblur="if(this.value=='') this.value='<?php echo $VM_LANG->_('PASSWORD'); ?>';" onfocus="if(this.value=='<?php echo $VM_LANG->_('PASSWORD'); ?>') this.value='';" />
</div>
<?php if( @VM_SHOW_REMEMBER_ME_BOX == '1' ) : ?>
<br/><label for="remember_vmlogin"><?php echo $VM_LANG->_('REMEMBER_ME')?></label>
<input type="checkbox" name="remember" id="remember_vmlogin" value="yes" checked="checked" />
<?php else : ?>
<input type="hidden" name="remember" value="yes" />
<?php endif; ?>
<input type="submit" value="<?php echo $VM_LANG->_('BUTTON_LOGIN')?>" id="submit_vmlogin" class="button" name="Login" />
<ul>
<li><a href="<?php echo $reset_url ?>"><?php echo $VM_LANG->_('LOST_PASSWORD')?></a></li>
<?php if( $remind_url ) : ?>
<li><a href="<?php echo $remind_url ?>"><?php echo $VM_LANG->_('FORGOT_YOUR_USERNAME')?></a></li>
<?php endif; ?>
<?php if( $mosConfig_allowUserRegistration == '1' ) : ?>
<li><?php echo $VM_LANG->_('NO_ACCOUNT')?> <a href="<?php echo $registration_url ?>"><?php echo $VM_LANG->_('CREATE_ACCOUNT')?></a></li>
<?php endif; ?>
</ul>
<input type="hidden" value="login" name="op2" />
<input type="hidden" value="<?php echo $return_url ?>" name="return" />
<input type="hidden" name="<?php echo $validate; ?>" value="1" />
<?php echo ($params->get('posttext'))? "<div class='posttext'>" . $params->get('posttext'). "</div>" : ""; ?>
</form>
</div>
<?php endif; ?>
Кто может, помогите, пожалуйста!
Заранее спасибо!