Hello,
I'm using VM 2.6.6 & Joomla 2.5.20.
In the maintenance account page when a user add the first shipping address the form opens empty, this is good.
The user filled all the fields and finally save. With this procedure I've one shipping address.
Now If the same user wants to add another shipping address from maintenance account page, when he clicked on Add/Edit shipment address link, the form opens with last information of the other shipping address.
Could you tell me how can I solved it?
I think in some part of the code is missing some "clear form"
Greets from Argentina.
afaik this is how it works - if you then scroll down you will see a link 'Add/Edit shipment address' where you add a "further" shipping address
these will collect at the bottom as links for later use
perhaps not the best scheme - the link could be better worded and moved too the top etc
[attachment cleanup by admin]
Quote from: GJC Web Design on June 12, 2014, 11:49:27 AM
afaik this is how it works - if you then scroll down you will see a link 'Add/Edit shipment address' where you add a "further" shipping address
these will collect at the bottom as links for later use
perhaps not the best scheme - the link could be better worded and moved too the top etc
Hello, yes that's fine.
My problem happens when a user clicked on 'Add/Edit shipment address' after he left a shipping address registered. The form to enter e new shipping address has the information of the first he entered (all the fields of this form are filled).
that's what I mean - the same happens here - that is why it says 'Add/Edit shipment address'
and offers you the last one to edit or click the link to add a new one - it has been like this in VM2 for as long as I can remember
Quote from: GJC Web Design on June 12, 2014, 15:47:26 PM
that's what I mean - the same happens here - that is why it says 'Add/Edit shipment address'
and offers you the last one to edit or click the link to add a new one - it has been like this in VM2 for as long as I can remember
Oh I'm sorry, now I understand.
Do you know how can I create a function to Add (only) Shipping address ? similar to editaddressST ?
It would need coding and testing - all things are possible given enough effort and therefore time and therefore money.. ;)
Quote from: GJC Web Design on June 12, 2014, 17:10:05 PM
It would need coding and testing - all things are possible given enough effort and therefore time and therefore money.. ;)
Thanks for your offer but I'm looking for some support of official virtuemart forum.
Besides the function Add/Edit Shipping Address comes from the earlies VM2 version, I think it's a bug because it's a requirement to have a possibility to add a new shipping address with all fields empties.
But it isn't a bug - afaik this has always been so in VM - you may not like it but that doesn't mean it's a bug
you click Add/Edit shipment address
form opens with the last ST address - you edit it and save under a new Address Nickname and there it is...
Thought I had better check as I ma just working on "tidying" up the look and feel of this part of my checkout
If the account holder is logged in then the shipping address is blank
If you add a shipping address, it uses this in current checkout until another one is chosen
That behaviour is logical for most customers
What is not so easy to see is that you can click a link to add another address see my image
(I have styled this section so yours will look different)
[attachment cleanup by admin]
Yes, you've styled your Add/Edit Shipping Address but I understand what you're saying.
I'm still thinking that the way VM 2 works on Add/Edit Shipping Address is wrong and it's a bug.
Every e-commerce platform has an option to Add a Shipping Address and other to Edit, not the same function like VM 2.
My solution was to edit one file of my template override files (edit_address.php) and add the following script at the end.
<script type="text/javascript">
var loc = window.location.href;
var palabra = 'new';
if (loc.indexOf(palabra) >= 0) {
setTimeout(function(){
resetForm();
}, 0);
}
function resetForm(){
$(':input','#userForm')
.not(':button, :submit, :reset, :hidden')
.val('')
.removeAttr('checked')
.removeAttr('selected');
}
</script>
Then when a user select Add/Edit Shipping Address will erase all the fields of the userForm and when select any registered Shipping Address will not.
It's not the best way but helps.
Yep I can see that will work for you.
The only problem I have with that is, it does not clear the session data and the original shipto address is still stored
If the user clicks cancel the original address is therefore still shown.
I have to say that I prefer the VM workflow
Quote from: Hutson on June 14, 2014, 11:05:32 AM
Yep I can see that will work for you.
The only problem I have with that is, it does not clear the session data and the original shipto address is still stored
If the user clicks cancel the original address is therefore still shown.
I have to say that I prefer the VM workflow
Yes, you're right. If the user clicks Cancel the original address still shows but I'm using tabs in user account so I see for a second and then dissappear.
Do you know a way to clear session of Shipping Address ?
No I have never tried to clear session data
Maybe someone else has an idea.
As I said, I like the workflow provided, so do not need to clear session data myself.
if (empty($cartData)) {
$session = JFactory::getSession($options);
$cartSession = $session->get('vmcart', 0, 'vm');
} else {
$cartSession=$cartData;
}
$sessionCart = unserialize( $cartSession );
unset($sessionCart->lists['shipTo']);
Thanks GJC
I wonder why the devs did not do this in place of that (very odd looking IMHO) "Forget this address" tick box on the current implementation.
Quote from: GJC Web Design on June 15, 2014, 11:22:01 AM
if (empty($cartData)) {
$session = JFactory::getSession($options);
$cartSession = $session->get('vmcart', 0, 'vm');
} else {
$cartSession=$cartData;
}
$sessionCart = unserialize( $cartSession );
unset($sessionCart->lists['shipTo']);
Thanks for you answer but it doesn't work on my site because I'm trying to do in maintenance account not in cart page.
$session = JFactory::getSession($options);
$cartSession = $session->get('vmcart', 0, 'vm');
$sessionCart = unserialize( $cartSession );
unset($sessionCart->ST);
Thanks again but it doesn't work.
I've tried to add your lines to /controllers/user.php and /views/user/view.html.php without any success.
put it in the template!!!!
does work...
Quote from: GJC Web Design on June 19, 2014, 20:48:21 PM
put it in the template!!!!
does work...
I've put in edit_address.php of my template and it doesn't work.
Do you think I have to put in other file of my template?
Quote from: GJC Web Design on June 19, 2014, 09:19:16 AM
$session = JFactory::getSession($options);
$cartSession = $session->get('vmcart', 0, 'vm');
$sessionCart = unserialize( $cartSession );
unset($sessionCart->ST);
no this wont work. use getCart, set the ST to 0, then use the function to store the cart in the session.
Quote from: Milbo on June 20, 2014, 08:45:27 AM
Quote from: GJC Web Design on June 19, 2014, 09:19:16 AM
$session = JFactory::getSession($options);
$cartSession = $session->get('vmcart', 0, 'vm');
$sessionCart = unserialize( $cartSession );
unset($sessionCart->ST);
no this wont work. use getCart, set the ST to 0, then use the function to store the cart in the session.
I've tried to do the following without luck.
$cart = VirtueMartCart::getCart(false);
$sessionCart = unserialize( $cart );
unset($sessionCart->ST);
$cart->setCartIntoSession();
Could you tell me what's wrong?
why not
$addrtype = JRequest::getVar('addrtype');
if($addrtype=='ST'){
echo "<script type='text/javascript'>
jQuery(document).ready(function(){
jQuery('.adminForm.user-details input').val('');
});
</script>";
}
Quote from: GJC Web Design on June 20, 2014, 21:56:48 PM
why not
$addrtype = JRequest::getVar('addrtype');
if($addrtype=='ST'){
echo "<script type='text/javascript'>
jQuery(document).ready(function(){
jQuery('.adminForm.user-details input').val('');
});
</script>";
}
Works better than my script but final result is the same. When a user clics Cancel, the form fields are filled with session address.
I really don't understand what your trying to achieve???
I thought u wanted a blank form when they are in their account management and want to add a new shipping address????
If they then click Cancel why does it matter if the session ST address appears????
It then just goes back to the index.php?option=com_virtuemart&view=user&Itemid=165 - isn't life far too short to be spent on things like this????
Just off to polish my roof tiles... ;)
$cart = VirtueMartCart::getCart();
$cart->ST = 0;
$cart->STsameAsBT = 1;
$cart->setCartIntoSession();
no unserialize or somethign like that. If you do something like that, you do not use the provided VM API.
Quote from: Milbo on June 21, 2014, 02:11:04 AM
$cart = VirtueMartCart::getCart();
$cart->ST = 0;
$cart->STsameAsBT = 1;
$cart->setCartIntoSession();
no unserialize or somethign like that. If you do something like that, you do not use the provided VM API.
Thanks Milbo, I put your code in edit.php of my template and works perfect!