Author Topic: Disabble or remove shipping address ***SOLVED***  (Read 35926 times)

meldmeaan

  • Beginner
  • *
  • Posts: 21
Disabble or remove shipping address ***SOLVED***
« on: June 21, 2012, 10:26:00 am »
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

  • Jr. Member
  • **
  • Posts: 114
Re: Disabble or remove shipping address
« Reply #1 on: June 24, 2012, 02:24:17 am »
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 http://www.1place4ads.nl for all you graphic webdesign and joomla websites.

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28303
  • Always on vacation
    • Jenkin Hill Internet
Re: Disabble or remove shipping address
« Reply #2 on: June 24, 2012, 11:51:30 am »
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VirtueMart 3.8.9.10473 on Joomla 3.9.28 PHP 7.4.14

Renata

  • Jr. Member
  • **
  • Posts: 114
Re: Disabble or remove shipping address
« Reply #3 on: June 24, 2012, 13:01:30 pm »
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:

Code: [Select]
<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 http://www.1place4ads.nl for all you graphic webdesign and joomla websites.

enricocerica

  • Beginner
  • *
  • Posts: 16
Re: Disabble or remove shipping address
« Reply #4 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) :

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

  • Jr. Member
  • **
  • Posts: 114
Re: Disabble or remove shipping address
« Reply #5 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:

Code: [Select]
{
    echo $this->loadTemplate('addshipto');
  }

And problem is solved.

Kind regards and thanks for your help.

Renata
Please visit my website http://www.1place4ads.nl for all you graphic webdesign and joomla websites.

enricocerica

  • Beginner
  • *
  • Posts: 16
Re: Disabble or remove shipping address
« Reply #6 on: June 24, 2012, 22:22:07 pm »
Thumbs up Renata  ;)
It works perfectly.

Renata

  • Jr. Member
  • **
  • Posts: 114
Re: Disabble or remove shipping address
« Reply #7 on: June 25, 2012, 10:29:56 am »
Thumbs up Renata  ;)
It works perfectly.

 8) 8)  ;D thanks! (no blush smiley available unfortunately lol)
Please visit my website http://www.1place4ads.nl for all you graphic webdesign and joomla websites.

meldmeaan

  • Beginner
  • *
  • Posts: 21
Re: Disabble or remove shipping address
« Reply #8 on: June 28, 2012, 16:24:13 pm »
Manny Manny thanks !!
This works great !!!
Put status to solved !!

Greetings
Meldmeaan

16ibs29

  • Beginner
  • *
  • Posts: 2
Re: Disabble or remove shipping address
« Reply #9 on: July 06, 2012, 16:33:01 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:

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

  • Jr. Member
  • **
  • Posts: 114
Re: Disabble or remove shipping address ***SOLVED***
« Reply #10 on: July 06, 2012, 16:39:02 pm »
hello

this file:

\components\com_virtuemart\views\user\tmpl\edit_address.php
Please visit my website http://www.1place4ads.nl for all you graphic webdesign and joomla websites.

16ibs29

  • Beginner
  • *
  • Posts: 2
Re: Disabble or remove shipping address ***SOLVED***
« Reply #11 on: July 06, 2012, 21:10:10 pm »
Thank you.

letsneck

  • Beginner
  • *
  • Posts: 10
Re: Disabble or remove shipping address
« Reply #12 on: July 08, 2012, 09:59:19 am »
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) :

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

  • Jr. Member
  • **
  • Posts: 114
Re: Disabble or remove shipping address ***SOLVED***
« Reply #13 on: July 08, 2012, 11:31:40 am »
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 http://www.1place4ads.nl for all you graphic webdesign and joomla websites.

letsneck

  • Beginner
  • *
  • Posts: 10
Re: Disabble or remove shipping address ***SOLVED***
« Reply #14 on: July 08, 2012, 20:15:06 pm »
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?