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] Add/edit shipping address always keep last entered even If I add a new

Started by restodo, June 12, 2014, 03:59:51 AM

Previous topic - Next topic

restodo

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.

GJC Web Design

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]
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

restodo

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).


GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

restodo

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 ?

GJC Web Design

It would need coding and testing - all things are possible given enough effort and therefore time and therefore money..  ;)
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

restodo

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.



GJC Web Design

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...

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

AH

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]
Regards
A

Joomla 3.10.11
php 8.0

restodo

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.


AH

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
Regards
A

Joomla 3.10.11
php 8.0

restodo

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 ?

AH

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.
Regards
A

Joomla 3.10.11
php 8.0

GJC Web Design



if (empty($cartData)) {
$session = JFactory::getSession($options);
$cartSession = $session->get('vmcart', 0, 'vm');
} else {
$cartSession=$cartData;
}
$sessionCart = unserialize( $cartSession );
unset($sessionCart->lists['shipTo']);


GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

AH

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.
Regards
A

Joomla 3.10.11
php 8.0