BUG. Not work delete additional shipping address (Virtuemart 2.0.8)

Started by serapol, July 20, 2012, 11:24:49 AM

Previous topic - Next topic

serapol

I noticed that B new version you can remove additional shipping address, but this option does not work.

The solution found in the file components/com_virtuemart/controllers/user.php on line 259
The name of the function does not correspond to the transferred task

Transmitted

task=deleteAddressST


The name of the function

function removeAddressST ()


The solution is simple to rename the function in

function deleteAddressST ()


By the way the query in the controller violates the specific MVC model, still need to remove the function itself to move into the model.

Plus it would be logical to add in the $msg language line so that you can use the translation

efocus

Maybe I missed something but I tried this fix and I still can't delete a user. Trying to do so just takes me to a blank content page. I tried clearing the cache but that didn't help either.

serapol

Quote from: efocus on July 21, 2012, 05:52:46 AM
Maybe I missed something but I tried this fix and I still can't delete a user. Trying to do so just takes me to a blank content page. I tried clearing the cache but that didn't help either.

specifically what you do not succeed, there is only need to rename the function

Milbo

no other way round, change the link in shopfunctions.php line 626 to &task=removeAddressST
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

ivus

Hmmmmm.

I have the latest version of both VM and J! and I'm just wondering if this "function removeAddressST ()" is a front end or a back end function?

I can see it in the front but I can't find it in the back? So changing the link still does nothing?


ivus

OK, so I fixed it myself. In case anyone needs to, here's what to do:




/administrator/components/com_virtuemart/helpers/shopfunction.php
line 626

Original


$_shipTo[] = '&nbsp;&nbsp;<a href="index.php?option=com_virtuemart&view=user&task=deleteAddressST&virtuemart_user_id[]=' . $_addressList[$_i]->virtuemart_user_id . '&virtuemart_userinfo_id=' . $_addressList[$_i]->virtuemart_userinfo_id . '" class="icon_delete">'.JText::_('COM_VIRTUEMART_USER_DELETE_ST').'</a></li>';



Change to


$_shipTo[] = '&nbsp;&nbsp;<a href="index.php?option=com_virtuemart&view=user&task=removeAddressST&virtuemart_user_id=' . $_addressList[$_i]->virtuemart_user_id . '&virtuemart_userinfo_id=' . $_addressList[$_i]->virtuemart_userinfo_id . '" class="icon_delete">'.JText::_('COM_VIRTUEMART_USER_DELETE_ST').'</a></li>';







/administrator/components/com_virtuemart/controller/user.php

Add


function removeAddressST(){

$db = JFactory::getDBO();

$virtuemart_user_id = JRequest::getVar('virtuemart_user_id');
$virtuemart_userinfo_id = JRequest::getVar('virtuemart_userinfo_id');

//Lets do it dirty for now
//$userModel = VmModel::getModel('user');
$msg = '';
if ( isset($virtuemart_userinfo_id) && $virtuemart_user_id != 0 ) {
//$userModel -> deleteAddressST();
$q = 'DELETE FROM #__virtuemart_userinfos  WHERE virtuemart_user_id="'. $virtuemart_user_id .'" AND virtuemart_userinfo_id="'. $virtuemart_userinfo_id .'"';
$db->setQuery($q);
$db->query();

$msg = vmInfo('Address has been successfully deleted.');
}
$layout = JRequest::getWord('layout','edit');
$this->setRedirect('index.php?option=com_virtuemart&view=user&task=edit&virtuemart_user_id[]='.$virtuemart_user_id, $msg);
}



You should now be able to delete Shipping Address in the admin.

Could a DevTeam member please verify this, I don't want this to get wiped on the next update?

I hope this helps.

ivus

Dammit... now I can't add a new SHIPPING ADDRESS.

Seems the required field for STATE/PROVINCE/REGION isn't populating when I select a COUNTRY...? I'm in Australia.

Anyone else getting this?

ivus

OK... got to the bottom of it, but not sure how to fix it.

So the NEW SHIPPING ADDRESS edit is done inside the SHIPMENT ADDRESS tab (tab 2)... however there's also a country and state fields in the ADDITIONAL INFORMATION tab (tab 1)... looks like when you select a country in tab 2, it updates that state field in tab 1... field name conflict.

Is there a fix for this?

serapol

Quote from: Milbo on July 23, 2012, 17:14:02 PM
no other way round, change the link in shopfunctions.php line 626 to &task=removeAddressST

it seemed easier to rename the function, but you can replace the link :)

ivus

Hi serapol,

Yes I saw that and raised with a:

QuoteI can see it in the front but I can't find it in the back? So changing the link still does nothing?

I also fixed it myself and found other issues which is what I'm waiting on now. I'm not sure if my update was incomplete or that this bug actually exists as no one else has gotten back to me about it yet. Since you've paid some interest, perhaps you could test it on your site to see if the issue exists for you too? and then get back to me so I can action it further.

I also wonder if VM has an SVN repository I can tap into... might go found out while I wait.

;)

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

seweryn

Hello,

This work, but I use SEO url's - then it not work.

It use for example: ".../editaddressBT?virtuemart_user_id[0]=889&virtuemart_userinfo_id=12"

I change in components/com_virtuemart/router.php in line 203:

"editaddressBT" to "deleteaddressST" - it work fine, but I don't know if I maybe injure the other functionality.

Could you help?

Sorry for my english.

Thanks a lot.
I use VirtueMart 2.0.22c & Joomla 2.5.14

Doeke Norg

I found out that there is a typo in router.php and this is why the delete link isn't working. It isn't a solution to the ability to remove the shipping address but at least the link will be correct.


else if($query['task']='editaddress'){

must be

else if($query['task']=='editaddress'){


The fix for actually removing the address must be changed in components/com_virtuemart/controllers/user.php.
function removeAddressST(){
must become
function deleteAddressST(){

Now you won't be able to CREATE a new address. Which needs to be fixed in components/com_virtuemart/views/user/view.html.php around line 154.
   $task = 'editAddressSt';
must become
   $task = 'editaddressST';



slinkybambi

Hi! I am using VM 2.0.12b  and the shipping address is stopping people from being able to place orders. It has been a week now and I am tearing my hair out, can anyone help me?  I have no idea how to fix this and urgently need to delete the shipping address part so that my customers cant see it. HELP!!!!!

mromstoeck

Same problem in VM2 2.0.24.

Fix: Edit line 275 in components/com_virtuemart/controllers/user.php in function removeAddressST():

$userModel->removeAddress($virtuemart_userinfo_id);