Author Topic: [SOLVED] Add/edit shipping address always keep last entered even If I add a new  (Read 4130 times)

restodo

  • Jr. Member
  • **
  • Posts: 77
Code: [Select]

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.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9050
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Code: [Select]
$session = JFactory::getSession($options);
$cartSession = $session->get('vmcart', 0, 'vm');
$sessionCart = unserialize( $cartSession );
unset($sessionCart->ST);
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

restodo

  • Jr. Member
  • **
  • Posts: 77
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.


GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9050
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
put it in the template!!!!

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

restodo

  • Jr. Member
  • **
  • Posts: 77
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?

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9919
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Code: [Select]
$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 should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

restodo

  • Jr. Member
  • **
  • Posts: 77
Code: [Select]
$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?

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9050
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
why not

Code: [Select]
$addrtype = JRequest::getVar('addrtype');

if($addrtype=='ST'){
echo "<script type='text/javascript'>
jQuery(document).ready(function(){
jQuery('.adminForm.user-details input').val('');
});
</script>";
}
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

restodo

  • Jr. Member
  • **
  • Posts: 77
why not

Code: [Select]
$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.


GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9050
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
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...  ;)
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

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9919
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
$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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

restodo

  • Jr. Member
  • **
  • Posts: 77
$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!