Author Topic: Customize Billing Details Address Format  (Read 567 times)

kenryanjr

  • Beginner
  • *
  • Posts: 8
  • Newby
  • VirtueMart Version: 3.8.4
Customize Billing Details Address Format
« on: November 09, 2020, 23:42:19 pm »
How do I change the way the Billing & Shipping addresses are displayed in the cart?  I would like them to look more like you would see in the United States. I am using version 3.8.4 over Joomla 3.9.22. I have seen a little on this topic but it was very confusing. Thank you for any help you can give me.

Like This:
FirstName LastName
Address 1
Address 2
City, State Zip
Country

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27950
  • Always on vacation
    • Jenkin Hill Internet
Re: Customize Billing Details Address Format
« Reply #1 on: November 10, 2020, 09:31:58 am »
You can re-order them in the shopper fields list. Far right columns on that page.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 3.8.7 10374 on Joomla 3.9.23 PHP 7.4.12

kenryanjr

  • Beginner
  • *
  • Posts: 8
  • Newby
  • VirtueMart Version: 3.8.4
Re: Customize Billing Details Address Format
« Reply #2 on: November 10, 2020, 14:36:25 pm »
I tried that and didn't see any difference in the cart page.

kenryanjr

  • Beginner
  • *
  • Posts: 8
  • Newby
  • VirtueMart Version: 3.8.4
Re: Customize Billing Details Address Format
« Reply #3 on: November 10, 2020, 14:44:11 pm »
I want to Americanize the Name and Address. I need to explode the data and out it back together.

FirstName Last Name
Address 1
Address 2
City, State Zip

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9901
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Customize Billing Details Address Format
« Reply #4 on: November 10, 2020, 16:08:01 pm »
on the standard template this is already being done

         foreach ($this->cart->BTaddress['fields'] as $item) {
            if(in_array($item['name'],$cartfieldNames)) continue; ?>
         <span class="values vm2<?php echo '-' . $item['name'] ?>"><?php echo $item['value'] ?></span>
         <?php if ($item['name'] != 'title' and $item['name'] != 'first_name' and $item['name'] != 'middle_name' and $item['name'] != 'zip') { ?>
            <br class="clear"/>
         <?php
            }
         } ?>

not on your template??
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27950
  • Always on vacation
    • Jenkin Hill Internet
Re: Customize Billing Details Address Format
« Reply #5 on: November 10, 2020, 16:39:53 pm »
In case you have not worked it out the code GJC refers to is in /components/com_virtuemart/views/user/tmp/edit_address_userfields.php

If you already use overrides look in /templates/[your-Joomla-template]/html/com_virtuemart/users/edit_address_userfields.php
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 3.8.7 10374 on Joomla 3.9.23 PHP 7.4.12

kenryanjr

  • Beginner
  • *
  • Posts: 8
  • Newby
  • VirtueMart Version: 3.8.4
Re: Customize Billing Details Address Format
« Reply #6 on: November 10, 2020, 16:59:48 pm »
I am using JD Servx template from JoomDev and realized that the override template for default_address.php is different than the VirtueMart default_address.php. As stated before I tried to reorder in shopper fields and I said it didn't work. Tried again and it actually did. But it comes out like this.

first_name last_name
address_1
City
State
Zip Country
phone
email address

What I would like is

first_name last_name
address_1
City, State Zip
Country
phone
email address

Can I change that with GJCs recommnedation?

Code: [Select]
<?php
/**
*
* Layout for the shopping cart and the mail
* shows the chosen adresses of the shopper
* taken from the cart in the session
*
* @package VirtueMart
* @subpackage Cart
* @author Max Milbers
*
* @link https://virtuemart.net
* @copyright Copyright (c) 2004 - 2014 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.
*
*/

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

<div class="billto-shipto row">
<div class="col-sm-12 col-md-12 col-lg-6">

<span><span class="vmicon vm2-billto-icon"></span>
<?php echo vmText::('COM_VIRTUEMART_USER_FORM_BILLTO_LBL'); ?></span>
<?php // Output Bill To Address ?>
<div class="output-billto">
<?php
$cartfieldNames = array();
foreach( $this->userFieldsCart['fields'] as $fields){
$cartfieldNames[] = $fields['name'];
}

foreach ($this->cart->BTaddress['fields'] as $item) {
if(in_array($item['name'],$cartfieldNames)) continue;
if (!empty($item['value'])) {
if ($item['name'] === 'agreed') {
$item['value'] = ($item['value'] === 0) ? vmText::('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_NO') : vmText::('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_YES');
}
?>
<!-- span class="titles"><?php echo $item['title'?></span -->
<span class="values vm2<?php echo '-' $item['name'?>"><?php echo $item['value'?></span>
<?php if ($item['name'] != 'title' and $item['name'] != 'first_name' and $item['name'] != 'middle_name' and $item['name'] != 'zip') { ?>
<br class="clear"/>
<?php
}
}
?>

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

<?php
if($this->pointAddress){
$this->pointAddress 'required invalid';
}

?>

<a class="details <?php echo $this->pointAddress ?>" href="<?php echo JRoute::('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT'$this->useXHTML$this->useSSL?>" rel="nofollow">
<?php echo vmText::('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_LBL'); ?>
</a>

<input type="hidden" name="billto" value="<?php echo $this->cart->lists['billTo']; ?>"/>
</div>

<div class="col-sm-12 col-md-12 col-lg-6">

<span><span class="vmicon vm2-shipto-icon"></span>
<?php echo vmText::('COM_VIRTUEMART_USER_FORM_SHIPTO_LBL'); ?></span>
<?php // Output Bill To Address ?>
<div class="output-shipto">
<?php
if($this->cart->user->virtuemart_user_id==0){

echo vmText::('COM_VIRTUEMART_USER_FORM_ST_SAME_AS_BT');
echo VmHtml::checkbox ('STsameAsBT'$this->cart->STsameAsBT,1,0,'id="STsameAsBTjs" data-dynamic-update=1') . '<br />';
} else if(!empty($this->cart->lists['shipTo'])){
echo $this->cart->lists['shipTo'];
}

if(empty($this->cart->STsameAsBT) and !empty($this->cart->ST) and !empty($this->cart->STaddress['fields'])){ ?>

<div id="output-shipto-display">
<?php
foreach ($this->cart->STaddress['fields'] as $item) {

if($item['name']=='shipto_address_type_name') continue;
if (!empty($item['value'])) {
?>

<!-- <span class="titles"><?php echo $item['title'?></span> -->
<span class="values vm2<?php echo '-' $item['name'?>"><?php echo $item['value'?></span>
<?php if ($item['name'] != 'title' and $item['name'] != 'shipto_first_name' and $item['name'] != 'shipto_middle_name' and $item['name'] != 'shipto_zip') { ?>
<br class="clear"/>
<?php
}
}
}
?>

</div>
<?php
}
?>

<div class="clear"></div>
</div>
<?php if (!isset($this->cart->lists['current_id'])) {
$this->cart->lists['current_id'] = 0;

?>

<a class="details" href="<?php echo JRoute::('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=ST&virtuemart_user_id[]=' $this->cart->lists['current_id'], $this->useXHTML$this->useSSL?>" rel="nofollow">
<?php echo vmText::('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'); ?>
</a>

</div>

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

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9901
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Customize Billing Details Address Format
« Reply #7 on: November 10, 2020, 17:16:43 pm »
something like

<?php if ($item['name'] != 'title' and $item['name'] != 'first_name' and $item['name'] != 'middle_name' and $item['name'] != 'state' and $item['name'] != 'city') { ?>
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27950
  • Always on vacation
    • Jenkin Hill Internet
Re: Customize Billing Details Address Format
« Reply #8 on: November 10, 2020, 18:16:49 pm »
Can I add that if you want to use a rearranged layout on the order emails then this thread may help:  http://forum.virtuemart.net/index.php?topic=117954
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 3.8.7 10374 on Joomla 3.9.23 PHP 7.4.12

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 812
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Customize Billing Details Address Format
« Reply #9 on: November 10, 2020, 18:19:39 pm »
the best option is send your question to JoomDev if you have a subscription
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds from products, orders and database table
Virtuemart Email Manager - customs email templates

kenryanjr

  • Beginner
  • *
  • Posts: 8
  • Newby
  • VirtueMart Version: 3.8.4
Re: Customize Billing Details Address Format
« Reply #10 on: November 10, 2020, 19:16:50 pm »
something like

<?php if ($item['name'] != 'title' and $item['name'] != 'first_name' and $item['name'] != 'middle_name' and $item['name'] != 'state' and $item['name'] != 'city') { ?>

This worked. Sort of...And I now know why. I don't know how to fix it...But at least I have a place to start. Thank you. What I have now, using your code and changing the order of the shopper fields is this..

first_name last_name
address_1
address_2
City State
Zip
Country
phone_1
email

I would like to add a comma between city and state and would like to get the zip up one line. However if you set the zip as the same order number as city and state it goes in front of those two because the id is lower than those two. So...redoing shopper fields maybe the answer.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9901
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Customize Billing Details Address Format
« Reply #11 on: November 10, 2020, 20:35:44 pm »
Quote
However if you set the zip as the same order number as city and state

why?

set them in sequence

for comma u need an if($item['name'] == 'city') { echo ',';}

somewhere .. you need to experiment
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kenryanjr

  • Beginner
  • *
  • Posts: 8
  • Newby
  • VirtueMart Version: 3.8.4
Re: Customize Billing Details Address Format
« Reply #12 on: November 10, 2020, 21:30:38 pm »
Even if you set them in sequence it throws in the line break and won't put them all on the same line as I would like.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9901
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Customize Billing Details Address Format
« Reply #13 on: November 10, 2020, 23:32:08 pm »
then u need to adjust your code .. you've been shown the technique ... it is of course do-able with some trial and error but u can't expect to get the code written for you here
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kenryanjr

  • Beginner
  • *
  • Posts: 8
  • Newby
  • VirtueMart Version: 3.8.4
Re: Customize Billing Details Address Format
« Reply #14 on: November 11, 2020, 00:11:08 am »
Agreed, I am working on it. Not having too much luck as of yet. But still working it. No matter what I do it throws the line break in at the end of the state. And that is where I am having issues. That has to be coming from somewhere else and not on the default_address page.