VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: concap on February 09, 2014, 21:06:31 PM

Title: Add/Edit shipment address not pulling data from database
Post by: concap on February 09, 2014, 21:06:31 PM
Joomla 2.5.17, VM 2.0.26d
I have found bug in wrong link generation, which resolves as empty Shipment Address even though we have stored data in database.

File /templates/xxx/html/com_virtuemart/cart/default_pricelist.php
Wrong Link:
<a class="details" href="<?php echo JRoute::('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=ST&virtuemart_user_id[]=' $this->cart->user->_id$this->useXHTML$this->useSSL?>">

Correct Link:
<a class="details" href="<?php echo JRoute::('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=ST&virtuemart_user_id[]=' $this->cart->user->_id$this->useXHTML$this->useSSL).'&virtuemart_userinfo_id='.$virtuemart_userinfo_id ?>">

To get $virtuemart_userinfo_id:
        foreach($this->cart->user->_data->userInfo as $value){
            if($value->address_type == 'ST'){
                $virtuemart_userinfo_id = $value->virtuemart_userinfo_id;
            }
        }





Title: Re: Add/Edit shipment address not pulling data from database
Post by: Pejo on February 11, 2014, 14:20:19 PM
I have the same problem. Shipping address is changed and saved, but in my cart won't show it. Shipping address is always empty.

Can you please tell me where to insert $virtuemart_userinfo_id:?
(I found link and replace it, but I don't know where to insert code to get $virtuemart_userinfo_id:
Title: Re: Add/Edit shipment address not pulling data from database
Post by: concap on February 11, 2014, 15:09:02 PM
You can put it just above href link. Your template is probably different from mine, but it should work.

        <?php

        
foreach($this->cart->user->_data->userInfo as $value){
            if(
$value->address_type == 'ST'){
                
$virtuemart_userinfo_id $value->virtuemart_userinfo_id;
            }
        }
        
?>


<a class="details" href="<?php echo JRoute::('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=ST&virtuemart_user_id[]=' $this->cart->user->_id$this->useXHTML$this->useSSL).'&virtuemart_userinfo_id='.$virtuemart_userinfo_id ?>">
<?php echo JText::('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'); ?>
</a>
Title: Re: Add/Edit shipment address not pulling data from database
Post by: Pejo on February 11, 2014, 15:15:47 PM
Thanks. But noup, doesn't work. Still showing like there is no shipping address. :(

When I press "Change delivery address" inside cart, it goes to page where I can edit my delivery address. In fields for edit there is address, everything is already there, but when I enter cart, it only shows my home address (address on the left side of the cart).
Title: Re: Add/Edit shipment address not pulling data from database
Post by: concap on February 12, 2014, 11:22:24 AM
Do you have there a button to show shipping address. Have a look at your source code to see if shipping address is there and is hidden just by javascript/css
Title: Re: Add/Edit shipment address not pulling data from database
Post by: Pejo on February 12, 2014, 11:32:38 AM
Well yeah, there is still button to add shipping address. Sorry, I am not so good in coding, where to look for code? In same .php file or somewhere in template .css files?
Title: Re: Add/Edit shipment address not pulling data from database
Post by: concap on February 12, 2014, 11:46:05 AM
By Source code, I meant mouse right click and View Page Source (in chrome) then you should search for your Shipping address. If you can see it there then all you need to do is modify template /templates/xxx/com_virtuemart/cart/default_pricelist.php
Title: Re: Add/Edit shipment address not pulling data from database
Post by: Pejo on February 12, 2014, 12:15:03 PM
OK, I have tested something and registrated as new user. So I insert normal address and then I have inserted address for delivery/shipping.

Then I have log-out and again log-in, put some items in my cart and went to cart. There was normal address show on the left side, but under shipping address (rigt side if cart) was only button again (not listed or shown saved shipping address).

when I pressed button to add shipping address, it redirect me to shipping address form, but there was my shipping address I have already enter earlier. So I just pressed save and shipping address was again shown in my cart.

Is this normal? Or should shipping address meant to be immediately show in my cart as soon as I enter?
Title: Re: Add/Edit shipment address not pulling data from database
Post by: concap on February 12, 2014, 16:37:03 PM
I am not VirtueMart developer either and I don't see much into VM guts. So it's hard to say if it right or not.
However totally agree that this process is bit clunky.