News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

[ SOLVED ] How to add an account maintenance link to the Login Module in VM2.0

Started by Lorrein, March 27, 2012, 20:24:00 PM

Previous topic - Next topic

Lorrein

It took me some time to figure this one out, so I wille share it with you. VM version 1.x came with a VM login module containing a link to account maintenance. VM 2.0.3 doesn't have that. So you have to use the Joomla Login module. If you want to have an account maintenance link in the login module you have to do the following:
Go to the mod_login directory and find default.php.
Somewhere around line 31, you will find
</form>
<?php else : ?>

Add the following before </form>
<?php
    echo '<a href="index.php?option=com_virtuemart&view=user&layout=editaddress">Account maintenance</a>.';
?>

amanda mc donald

Thank you!!! 

This is exactly what I was struggling to do. 
Works great. 

Thank you for sharing!

Lorrein

If you also want to see your historic orders, the link should be
index.php?option=com_virtuemart&view=user&layout=edit&Itemid=132&lang=nl-NL

Bruce Morgan

I have been seeking a solution for this too and mentioned it in separate thread I started.  I tried modifying the file as you syuggested and it did not work.  Were you referring to the file located in "root/modules/mod_login/tmpl/default.php"?  It was also unclear how to add the link for past orders.

One other thing that is missing compared to the ols VM is the link to the shopping cat within the login module.  That would also be a useful addtion.  My last commnet is that there is supposed to be a way to customize a module without hacking the core files so that update will not overwrite the hacks.  Would you happen to know how to do this for this mod?

Bruce

Lorrein

Nope Bruce,

Can't help you. Your status is SR member. My status is beginner ;D

donow

KLH

To override a module view without editing core files you need to add a template overrides folder to the root folder for your default template. Joomla looks in this folder for the corresponding view first before checking the core locations.

The overrides folder has to be called "html". Module overrides must be placed in a sub folder with the same name as that module's corresponding folder in the "modules" folder of your Joomla installation. For example, if you are trying to override the joomla core login module layout, which is located in /modules/mod_login, you must place your layout override in the<my_template> /html/mod_login folder.

The layout override file must have the same name as the corresponding layout you are trying to override. If you are trying to override the default layout, for example, located in /modules/mod_login/tmpl/default.php, your override file must be named default.php and placed in the corresponding template override folder mentioned above.

Just copy the contents of the layout you want to override into the override file and make whatever alterations you want. You will thank yourself for going to all of this extra trouble next time you update your Joomla installation!

Bruce Morgan

Lorrein, I am "SR" member because of my longevity using VM/PHP shop, almost 9 years now, not because i know anything about programming.  My php knowledge is almost nil and my knowlwdge of HTML and SQL are basic at best.

KLH your explanation of overrides is the best i have seen so far.  Unfortunately, it seems that to make this work, you need to be able to generate the code that would be (used/substituted/added?) to the base code and that is the fatal flaw.  What i used to be able to accomplish using a user interface or simple HTML coding now requires  rather extensive knowledge of PHP.  What was once a show oners sofware has become a programmers toy or maybe nightmare.

This may be a little off topic but with VM it has become a platofmr that is so "flexible" that is does almost nothing right out of the box.  That was not the case in ther past.  Furthermore, it has become difficult if not impossible to port over a VM 1.1 site to 2.0 with a similar look and functionality.  I tried for a month and finally gave up.  My live site is relatively simple but it did require a few hacks to get it working correctly (such as tax calculations for WA state).  Now it appears thast this is causing some javascript conflicts and some users are unable to order from my site at all.

I notice that the Joomla Extensions Directory has dropped VM as one of its Editors Choices.  I agree.  The virtues of this mart have largely disappeared as it has evolved.  This is not a fine wine maturing but a mishmash of code that is nightmarish for the average shop owwner.

For this reason I am working with a new business partner who will be porting over my site to use Open Cart.  I am trusting that it cannot be any worse than VM 2.0 to learn and implement and it actually has some working sites that look good.  I have resisted this move for as long time but I need a shopping cart that work and is something that I can actually control from a user friendly interface.

Bruce

ivus


WebStuff

You can add an "Acount Maintenance" link to the Login form like so:
1/. Navigate to [YOUR_SITE_ROOT]/modules/mod_login/tmpl
2/. Copy the the file default.php
3/. Navigate to [YOUR_SITE_ROOT]/templates/[YOUR_TEMPLATE]/html (if html doesn't exist just create it and set permissions)
4/. Create a folder called mod_login
5/. Set any permissions for the folder so it is readable by the web user.
6/. Paste the default.php here (and set it's permissions too).
7/. Open the file and add the following code to it where you would like it to appear:
<div>
<a href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=user&layout=edit'); ?>">
<?php echo JText::_('Account Maintenance'); ?></a>
</div>

It must be in the <form> at the top denoted by:<?php if ($type == 'logout') : ?>
Otherwise it will appear before anyone has logged in.

If you also want a "Order History" link then you can add this (though there is a view order link on the account maintenance page) :
<div>
<a href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=orders&layout=list'); ?>">
<?php echo JText::_('Order History'); ?></a>
</div>


Hope this helps.

Christopher

To add a "Create an Account" link, do the following:

In [site root]/language/en-GB/en-GB.mod_login.ini look for the following at around line 24:

MOD_LOGIN_REGISTER="Create an Account"

... Remove the words between the quote marks, so it reads:

MOD_LOGIN_REGISTER=""

Next, add the following to [site root]/templates/[template name]/html/mod_login/default.php  just before the final </form> element:

   <div>
      <a href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=user&layout=edit'); ?>">
      <?php echo JText::_('Create an Account'); ?></a>
   </div>

... This will create a link marked "Create an Account" on the login form area, when someone is not logged in - clicking it takes the user to the 'Account Maintenance' screen, but as a non-logged-in user, they are presented with a login form and a registration form for VM
There are 10 types of people in the world:
Those who understand binary and those who don't

Christopher

Update...

This is the code for 'default.php' which you should put in the following folder:

[site root]/templates/[template name]/html/mod_login/default.php




<?php
/**
 * @package Joomla.Site
 * @subpackage mod_login
 * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
?>

<?php if ($type == 'logout') : ?>
<form action="<?php echo JRoute::_('index.php'true$params->get('usesecure')); ?>" method="post" id="login-form">
<?php if ($params->get('greeting')) : ?>
<div class="login-greeting">
<?php if($params->get('name') == 0) : {
echo JText::sprintf('MOD_LOGIN_HINAME'htmlspecialchars($user->get('name')));
} else : {
echo JText::sprintf('MOD_LOGIN_HINAME'htmlspecialchars($user->get('username')));
} endif; ?>

<div>
<a href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=user&layout=edit'); ?>">
<?php echo JText::_('Account Maintenance'); ?></a>
</div>
</div>
<?php endif; ?>
<div class="logout-button">
<input type="submit" name="Submit" class="button" value="<?php echo JText::_('JLOGOUT'); ?>" />
<input type="hidden" name="option" value="com_users" />
<input type="hidden" name="task" value="user.logout" />
<input type="hidden" name="return" value="<?php echo $return?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
<?php else : ?>
<form action="<?php echo JRoute::_('index.php'true$params->get('usesecure')); ?>" method="post" id="login-form" >
<?php if ($params->get('pretext')): ?>
<div class="pretext">
<p><?php echo $params->get('pretext'); ?></p>
</div>
<?php endif; ?>
<fieldset class="userdata">
<p id="form-login-username">
<label for="modlgn-username"><?php echo JText::_('MOD_LOGIN_VALUE_USERNAME'?></label>
<input id="modlgn-username" type="text" name="username" class="inputbox"  size="18" />
</p>
<p id="form-login-password">
<label for="modlgn-passwd"><?php echo JText::_('JGLOBAL_PASSWORD'?></label>
<input id="modlgn-passwd" type="password" name="password" class="inputbox" size="18"  />
</p>
<?php if (JPluginHelper::isEnabled('system''remember')) : ?>
<p id="form-login-remember">
<label for="modlgn-remember"><?php echo JText::_('MOD_LOGIN_REMEMBER_ME'?></label>
<input id="modlgn-remember" type="checkbox" name="remember" class="inputbox" value="yes"/>
</p>
<?php endif; ?>
<input type="submit" name="Submit" class="button" value="<?php echo JText::_('JLOGIN'?>" />
<input type="hidden" name="option" value="com_users" />
<input type="hidden" name="task" value="user.login" />
<input type="hidden" name="return" value="<?php echo $return?>" />
<?php echo JHtml::_('form.token'); ?>
</fieldset>
<ul>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=reset'); ?>">
<?php echo JText::_('MOD_LOGIN_FORGOT_YOUR_PASSWORD'); ?></a>
</li>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=remind'); ?>">
<?php echo JText::_('MOD_LOGIN_FORGOT_YOUR_USERNAME'); ?></a>
</li>
<?php
$usersConfig JComponentHelper::getParams('com_users');
if ($usersConfig->get('allowUserRegistration')) : ?>


<?php endif; ?>
</ul>
<?php if ($params->get('posttext')): ?>
<div class="posttext">
<p><?php echo $params->get('posttext'); ?></p>
</div>
<?php endif; ?>
<div>
<ul>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=user&layout=edit'); ?>">
<?php echo JText::_('Create an Account'); ?></a>
</li>
</ul>
</div>

</form>
<?php endif; ?>



... I hope this helps
There are 10 types of people in the world:
Those who understand binary and those who don't