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

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.

GJC Web Design

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

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

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

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

restodo

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?

GJC Web Design

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>";
}
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 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.


GJC Web Design

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

Milbo

$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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

restodo

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!