News:

Support the VirtueMart project and become a member

Main Menu

Disabble or remove shipping address ***SOLVED***

Started by meldmeaan, June 21, 2012, 10:26:00 AM

Previous topic - Next topic

meldmeaan

Hi,
I want to disable of remove the shipping adrress in VM 2.
This because the invoice adress is ALWAYS the same as the shipping adress
Now i have configured VM so that i dont have to fill in the shipping adress and i can process an order.
But...
Why let customers see an option that they will never use ?
So i have tried to modify /components/com_virtuemart/views/cart/tmpl/shopper_adresses.
I have deleted the next section :
<td width="50%">
         <?php
         if(!empty($this->STaddress['fields'])){
            foreach($this->STaddress['fields'] as $item){
               if(!empty($item['value'])){
                  echo $item['title'].': '.$this->escape($item['value']).'<br/>';
               }
            }
         } else {
         foreach($this->BTaddress['fields'] as $item){
            if(!empty($item['value'])){
               echo $item['title'].': '.$this->escape($item['value']).'<br/>';
            }
         }
      } ?>
</td>

But that does not work.
I still see an option for filling in a STadress....
What am i doing wrong ??

Greetings,

Meldmeaan

Renata

#1
Dear all

I would like to remove the possibility of adding a shipping address too. I have purchased this plug-in: Shipment for Virtual Products

So all the products of our webshop will be downloaded and there is no need to ask for a shipment address anymore.

As we would like to make the steps as easy as possible for our clients and because of that we would like to have no unrelated questions in the cart, could you please advise how to remove this question?

I have tried to change a lot of ""views" and searched for answers but with no success

I hope to hear from you soon.

Kind regards
Renata
Please visit my website https://responsivewebsitemaken.nl for all your graphic webdesign and Joomla websites.

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Renata

Dear jenkinhill

Thank you so much! (you helped me often for which i want to give you my special thanks!)

For everybody who wants to remove shipping address, pls remove following code from /components/com_virtuemart/views/cart/tmpl/default_pricelist.php. I tested it and everything else still works in good order:


<div class="width50 floatleft">

<span><span class="vmicon vm2-shipto-icon"></span>
<?php echo JText::_('COM_VIRTUEMART_USER_FORM_SHIPTO_LBL'); ?></span>
<?php // Output Bill To Address ?>
<div class="output-shipto">
<?php
if(empty($this->cart->STaddress['fields'])){
echo JText::sprintf('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_EXPLAIN',JText::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL') );
} else {
if(!class_exists('VmHtml'))require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'html.php');
echo JText::_('COM_VIRTUEMART_USER_FORM_ST_SAME_AS_BT'). VmHtml::checkbox('STsameAsBT',$this->cart->STsameAsBT).'<br />';
foreach($this->cart->STaddress['fields'] as $item){
if(!empty($item['value'])){ ?>

<!-- <span class="titles"><?php echo $item['title'?></span> -->
<?php
if ($item['name'] == 'first_name' || $item['name'] == 'middle_name' || $item['name'] == 'zip') { ?>

<span class="values<?php echo '-'.$item['name'?>" ><?php echo $this->escape($item['value']) ?></span>
<?php } else { ?>
<span class="values" ><?php echo $this->escape($item['value']) ?></span>
<br class="clear" />
<?php
}
}
}
}
 
?>

<div class="clear"></div>
</div>
<?php if(!isset($this->cart->lists['current_id'])) $this->cart->lists['current_id'] = 0?>
<a class="details" href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=ST&cid[]='.$this->cart->lists['current_id'],$this->useXHTML,$this->useSSL?>">
<?php echo JText::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'); ?>
</a>

</div>


only when you want to change ""bill to" address, so you click on that, than in that case still at the bottom of that page is showing: add/alter shipping address. I will look into this and hope to find a solution for that too. (however i am already very happy with the result right now)

Kind regards
Renata 

Please visit my website https://responsivewebsitemaken.nl for all your graphic webdesign and Joomla websites.

enricocerica

Thanks Renata, exactly what I was looking for  ;)

Here is my contribution, to remove the link "add/alter shipping address" when changing the "bill to address" just remove the following code in \components\com_virtuemart\views\user\tmpl\edit_address.php (at the end of the code) :

<?php // }
if ($this->userDetails->JUser->get('id')) {
    echo 
$this->loadTemplate('addshipto');
  } 
?>

<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="user" />
<input type="hidden" name="controller" value="user" />
<input type="hidden" name="task" value="<?php echo $this->fTask// I remember, we removed that, but why?   ?>" />
<input type="hidden" name="address_type" value="<?php echo $this->address_type?>" />
<?php if(!empty($this->virtuemart_userinfo_id)){
echo '<input type="hidden" name="shipto_virtuemart_userinfo_id" value="'.(int)$this->virtuemart_userinfo_id.'" />';
}
echo 
JHTML::_('form.token');
?>


Renata

#5
Dear enricocerica

Thanks for your help! You have put me on the right way, but there was a problem:

If you are logged in and want to change your bill-to address indeed the shipping address has disappeared. But when you click on "save" you wont be able to return to the shoppingcart, but stay on the same page. Only if you click on cancel you are able to leave that page.

After testing i found the solution:

Just remove the following code from the concerning file:


{
    echo $this->loadTemplate('addshipto');
  }


And problem is solved.

Kind regards and thanks for your help.

Renata
Please visit my website https://responsivewebsitemaken.nl for all your graphic webdesign and Joomla websites.

enricocerica

Thumbs up Renata  ;)
It works perfectly.

Renata

Quote from: enricocerica on June 24, 2012, 22:22:07 PM
Thumbs up Renata  ;)
It works perfectly.

8) 8)  ;D thanks! (no blush smiley available unfortunately lol)
Please visit my website https://responsivewebsitemaken.nl for all your graphic webdesign and Joomla websites.

meldmeaan

Manny Manny thanks !!
This works great !!!
Put status to solved !!

Greetings
Meldmeaan

16ibs29

Quote from: Renata on June 24, 2012, 18:43:41 PM
Dear enricocerica

Thanks for your help! You have put me on the right way, but there was a problem:

If you are logged in and want to change your bill-to address indeed the shipping address has disappeared. But when you click on "save" you wont be able to return to the shoppingcart, but stay on the same page. Only if you click on cancel you are able to leave that page.

After testing i found the solution:

Just remove the following code from the concerning file:


{
    echo $this->loadTemplate('addshipto');
  }


And problem is solved.

Kind regards and thanks for your help.

Renata

Hello Renata!

Which file is this line found?

Thanks!!

RD

Renata

hello

this file:

\components\com_virtuemart\views\user\tmpl\edit_address.php
Please visit my website https://responsivewebsitemaken.nl for all your graphic webdesign and Joomla websites.


letsneck

Quote from: enricocerica on June 24, 2012, 14:00:42 PM
Thanks Renata, exactly what I was looking for  ;)

Here is my contribution, to remove the link "add/alter shipping address" when changing the "bill to address" just remove the following code in \components\com_virtuemart\views\user\tmpl\edit_address.php (at the end of the code) :

<?php // }
if ($this->userDetails->JUser->get('id')) {
    echo 
$this->loadTemplate('addshipto');
  } 
?>

<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="user" />
<input type="hidden" name="controller" value="user" />
<input type="hidden" name="task" value="<?php echo $this->fTask// I remember, we removed that, but why?   ?>" />
<input type="hidden" name="address_type" value="<?php echo $this->address_type?>" />
<?php if(!empty($this->virtuemart_userinfo_id)){
echo '<input type="hidden" name="shipto_virtuemart_userinfo_id" value="'.(int)$this->virtuemart_userinfo_id.'" />';
}
echo 
JHTML::_('form.token');
?>



This part of the solution did not work for me. I am working with Virtuemart 2.0.8 and Joomla 1.5.25. The first part of the solution by Renata removed most everything correctly, but I am still left with the following part .....

Ship To
Only in case shipment address is different from billing address,
click »Add/Edit shipment address« button below
   
      Add/Edit shipment address


Please will you help to solve this for me? Thank you

Renata

Dear letsneck

In my case if you change above two scripts all disappeared! perheps you did something wrong? 

If you want an easier way to remove all concerning shipment address, you might consider to buy OPC: one page checkout. With this extension there is a possibility to remove all concerning shipment address just by one click. But it is a commercial extension. (worth paying IMHO)

Kind regards
Renata
Please visit my website https://responsivewebsitemaken.nl for all your graphic webdesign and Joomla websites.

letsneck

Thank you for your reply Renata. I am not sure what I could have done wrong. Your contribution removed everything except the remaining "Ship to add edit" that was at the bottom of the section once you click on "add/edit Billing address". I removed the code exactly as it appeared in the Post by: enricocerica.

Perhaps it is a version issue. I am running virtuemart 2.0.8 with joomla 1.5.25. I did notice that I had an extra line in the code that wasn't in the code you posted for the first part of the fix. The line is as follows...

<input type="hidden" name="billto" value="<?php echo $this->cart->lists['billTo']; ?>"/>

I removed the line with the rest of the code, as it was just above the last line </div>.

I also noticed that I have a file called edit_address_addshipto.php and one called edit_address_addshipto.php.org. Should I be editing those files instead?