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

Change the shipTo section below billTo address and shipTo address

Started by StefanSTS, October 29, 2013, 09:36:36 AM

Previous topic - Next topic

StefanSTS

Hello,

I would like to change the appearance of the last part of the form for the billing and shipping address.

Below the billing address you can find a section for entering your shipping address. The last fieldset.

There is an echo: <?php echo $this->lists['shipTo']; ?>

This loads the contents of the fieldset, but I cannot find the function, that is producing the link to call a form for a new shipping address and the following unordered list (ul) with the existing shipping addresses.

I would like to give this part a better structure, and don't mind sharing it later. It should have two sections, two DIVs with different classes or IDs, so that it can be arranged nicely.
1. Add a new shipping address
2 Use one of the existing addresses

Any help to find the file, where this section is build, is most welcome. :-)

Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

Stonedfury

No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

StefanSTS

Thanks Stonedfury,

just realized, I don't get mails in this forum, when replies come in. So I am a little late with my thanks.

All the best
Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

StefanSTS

To get the styling done, I changed some code and put an override.
..\template_name\html\com_virtuemart\user\edit_address.php

I added and changed some things, mainly putting classes, so I could apply the CSS.

The file was from 2.0.22c, but it didn't change to 2.0.26d, so it should be still good, if somebody wants to use it.
For future use, just run a diff on the old and new file.

Code of the edit_address.php follows:


<?php
/**
 *
 * Enter address data for the cart, when anonymous users checkout
 *
 * @package    VirtueMart
 * @subpackage User
 * @author Oscar van Eijk, 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: edit_address.php 6406 2012-09-08 09:46:55Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined ('_JEXEC') or die('Restricted access');
// vmdebug('user edit address',$this->userFields['fields']);
// Implement Joomla's form validation
JHTML::('behavior.formvalidation');
JHTML::stylesheet ('vmpanels.css'JURI::root () . 'components/com_virtuemart/assets/css/');

if (
$this->fTask === 'savecartuser') {
$rtask 'registercartuser';
$url 0;
}
else {
$rtask 'registercheckoutuser';
$url JRoute::('index.php?option=com_virtuemart&view=cart&task=checkout'$this->useXHTML$this->useSSL);
}
?>


<div class="sts_login_form floatright">
  <?php
  
echo shopFunctionsF::getLoginForm (TRUEFALSE$url);
  
?>

</div>

<h1><?php echo $this->page_title ?></h1>

<script language="javascript">
function myValidator(f, t) {
f.task.value = t; //this is a method to set the task of the form on the fTask.
if (document.formvalidator.isValid(f)) {
f.submit();
return true;
} else {
var msg = '<?php echo addslashes (JText::('COM_VIRTUEMART_USER_FORM_MISSING_REQUIRED_JS')); ?>';
alert(msg + ' ');
}
return false;
}

function callValidatorForRegister(f) {

var elem = jQuery('#username_field');
elem.attr('class', "required");

var elem = jQuery('#name_field');
elem.attr('class', "required");

var elem = jQuery('#password_field');
elem.attr('class', "required");

var elem = jQuery('#password2_field');
elem.attr('class', "required");

var elem = jQuery('#userForm');

return myValidator(f, '<?php echo $rtask ?>');

}
</script>

<div class="sts_formular_wrap"> 
  <fieldset>
    <h2><?php
      
if ($this->address_type == 'BT') {
        echo 
JText::('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_LBL');
      }
      else {
        echo 
JText::('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL');
      }
      
?>

    </h2>

    <form method="post" id="userForm" name="userForm" class="form-validate">
      <!--<form method="post" id="userForm" name="userForm" action="<?php echo JRoute::('index.php'); ?>" class="form-validate">-->
      <div class="control-buttons">
        <?php
        
if (strpos ($this->fTask'cart') || strpos ($this->fTask'checkout')) {
          
$rview 'cart';
        }
        else {
          
$rview 'user';
        }
  
// echo 'rview = '.$rview;

        
if (strpos ($this->fTask'checkout') || $this->address_type == 'ST') {
          
$buttonclass 'sweb-button';
        }
        else {
          
$buttonclass 'sweb-button';
        }

        if (
VmConfig::get ('oncheckout_show_register'1) && $this->userId == && !VmConfig::get ('oncheckout_only_registered'0) && $this->address_type == 'BT' and $rview == 'cart') {
        
        
?>

        <div class="sts_reg_oder_gast">
          <?php
            
echo JText::sprintf ('COM_VIRTUEMART_ONCHECKOUT_DEFAULT_TEXT_REGISTER'JText::('COM_VIRTUEMART_REGISTER_AND_CHECKOUT'), JText::('COM_VIRTUEMART_CHECKOUT_AS_GUEST'));
          
?>

        </div>

        <?php
        
        
}
        
        else {
          
//echo JText::_('COM_VIRTUEMART_REGISTER_ACCOUNT');
        
}
        if (
VmConfig::get ('oncheckout_show_register'1) && $this->userId == && $this->address_type == 'BT' and $rview == 'cart') {
          
?>


          <button class="<?php echo $buttonclass ?>" type="submit" onclick="javascript:return callValidatorForRegister(userForm);"
                  title="<?php echo JText::('COM_VIRTUEMART_REGISTER_AND_CHECKOUT'); ?>"><?php echo JText::('COM_VIRTUEMART_REGISTER_AND_CHECKOUT'); ?></button>
          <?php if (!VmConfig::get ('oncheckout_only_registered'0)) { ?>
            <button class="<?php echo $buttonclass ?>" title="<?php echo JText::('COM_VIRTUEMART_CHECKOUT_AS_GUEST'); ?>" type="submit"
                    onclick="javascript:return myValidator(userForm, '<?php echo $this->fTask?>');"><?php echo JText::('COM_VIRTUEMART_CHECKOUT_AS_GUEST'); ?></button>
            <?php ?>
          <button class="sweb-button" type="reset"
                  onclick="window.location.href='<?php echo JRoute::('index.php?option=com_virtuemart&view=' $rview); ?>'"><?php echo JText::('COM_VIRTUEMART_CANCEL'); ?></button>


          <?php
        
}
        else {
          
?>


          <button class="<?php echo $buttonclass ?>" type="submit"
                  onclick="javascript:return myValidator(userForm, '<?php echo $this->fTask?>');"><?php echo JText::('COM_VIRTUEMART_SAVE'); ?></button>
          <button class="sweb-button" type="reset"
                  onclick="window.location.href='<?php echo JRoute::('index.php?option=com_virtuemart&view=' $rview); ?>'"><?php echo JText::('COM_VIRTUEMART_CANCEL'); ?></button>

          <?php ?>
      </div>


      <?php
      
if (!class_exists ('VirtueMartCart')) {
        require(
JPATH_VM_SITE DS 'helpers' DS 'cart.php');
      }

      if (
count ($this->userFields['functions']) > 0) {
        echo 
'<script language="javascript">' "\n";
        echo 
join ("\n"$this->userFields['functions']);
        echo 
'</script>' "\n";
      }
      echo 
$this->loadTemplate ('userfields');

      
?>

  </fieldset>
</div>

<div class="sts_add_shipto">
  <?php // }
  
if ($this->userDetails->JUser->get ('id')) {
    echo 
$this->loadTemplate ('addshipto');
  } 
?>

</div>

<input type="hidden" name="option" value="com_virtuemart"/>
<input type="hidden" name="view" value="user"/>
<input type="hidden" name="controller" value="user"/>
<input type="hidden" name="task" value="<?php echo $this->fTask// I remember, we removed that, but why?   ?>"/>
<input type="hidden" name="layout" value="<?php echo $this->getLayout (); ?>"/>
<input type="hidden" name="address_type" value="<?php echo $this->address_type?>"/>
<?php if (!empty($this->virtuemart_userinfo_id)) {
echo '<input type="hidden" name="shipto_virtuemart_userinfo_id" value="' . (int)$this->virtuemart_userinfo_id '" />';
}
echo 
JHTML::('form.token');
?>

</form>
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.