News:

Looking for documentation? Take a look on our wiki

Main Menu

Remove Bill To Add/Edit and Ship To Add/Edit from Guest Shopping Cart

Started by naescent, June 14, 2012, 18:59:29 PM

Previous topic - Next topic

naescent

Hi,

I have done a search on Google and here and cant find anything related, so I hope I'm not wasting anyone's time.

I am setting up a shopping cart for selling clothes (so no downloads etc.) and on the guest shopping cart (i.e no user logged in) it shows the Add/Edit section for Bill To and Ship To. As they've not created an account or logged in yet this could be confusing. Is there a way of disabling this?

I was thinking of hacking the back end at some point and finding where this code is (if I have to go this way any pointers would be good) and adding an if logged in line to it.

Although I'm hoping I dont have to :)

Any thoughts,

Adam

sadrem

Hello, You may override views in your template
look in components/virtuemart/views  .
p.s. Do not forget to change message icon to Solved.

naescent

Will do, thanks.

Just to confirm though there is no way of doing this without an over ride?

sadrem

You have no configuration to disable it only customization of view
p.s. Do not forget to change message icon to Solved.

naescent

OK thanks mate, I dont suppose you know where I can find it do you?

sadrem

p.s. Do not forget to change message icon to Solved.

naescent

Sorry I meant do you know where I can find the lines of code to over ride :)

Ok so I've cracked it. The file is in com_virtuemart->views->cart->tmpl->default_pricelist.php

On line 28 I've added
<?php 
$user 
=& JFactory::getUser();
if (!
$user->guest) {
?>


before
<div class="billto-shipto">

and at line 98 I've added
<?php ?>

between
<div class="clear"></div>
</div>


and

<fieldset>
<table
class="cart-summary"
cellspacing="0"
cellpadding="0"
border="0"
width="100%">


I have uploaded the file to my_template/com_virtuemart/cart/ so that I can take my edit with my template and not have to worry about core files needed to be hacked and its all working perfectly.

Thanks for the help, I hope this is useful to others,
Adam

pjsban


StormIT

Quote from: naescent on June 14, 2012, 21:32:19 PM
Sorry I meant do you know where I can find the lines of code to over ride :)

Ok so I've cracked it. The file is in com_virtuemart->views->cart->tmpl->default_pricelist.php

On line 28 I've added
<?php 
$user 
=& JFactory::getUser();
if (!
$user->guest) {
?>


before
<div class="billto-shipto">

and at line 98 I've added
<?php ?>

between
<div class="clear"></div>
</div>


and

<fieldset>
<table
class="cart-summary"
cellspacing="0"
cellpadding="0"
border="0"
width="100%">


I have uploaded the file to my_template/com_virtuemart/cart/ so that I can take my edit with my template and not have to worry about core files needed to be hacked and its all working perfectly.

Thanks for the help, I hope this is useful to others,
Adam

Brilliant! Thanks very much for posting

www.sp3media.com

Hope this helps...


File Path:
/public_html/components/com_virtuemart/views/cart/tmpl

File to be edited:
default_pricelist.php

---------

Remove this code ("bill to"):

<div class="width50 floatleft">

      <span><span class="vmicon vm2-billto-icon"></span>
         <?php echo JText::_ ('COM_VIRTUEMART_USER_FORM_BILLTO_LBL'); ?></span>
      <?php // Output Bill To Address ?>
      <div class="output-billto">
         <?php

         foreach ($this->cart->BTaddress['fields'] as $item) {
            if (!empty($item['value'])) {
               if ($item['name'] === 'agreed') {
                  $item['value'] = ($item['value'] === 0) ? JText::_ ('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_NO') : JText::_ ('COM_VIRTUEMART_USER_FORM_BILLTO_TOS_YES');
               }
               ?><!-- span class="titles"><?php echo $item['title'] ?></span -->
               <span class="values vm2<?php echo '-' . $item['name'] ?>"><?php echo $this->escape ($item['value']) ?></span>
               <?php if ($item['name'] != 'title' and $item['name'] != 'first_name' and $item['name'] != 'middle_name' and $item['name'] != 'zip') { ?>
                  <br class="clear"/>
                  <?php
               }
            }
         } ?>
         <div class="clear"></div>
      </div>

      <a class="details" href="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT', $this->useXHTML, $this->useSSL) ?>">
         <?php echo JText::_ ('COM_VIRTUEMART_USER_FORM_EDIT_BILLTO_LBL'); ?>
      </a>

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


------------





REMOVE THIS (" Ship to"):


<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');
            echo VmHtml::checkbox ('STsameAsBTjs', $this->cart->STsameAsBT) . '<br />';
            ?>
            <div id="output-shipto-display">
               <?php
               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>
            <?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&virtuemart_user_id[]=' . $this->cart->lists['current_id'], $this->useXHTML, $this->useSSL) ?>" rel="nofollow">
         <?php echo JText::_ ('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'); ?>
      </a>

   </div>

steikkia

Hello everybody, i have the same problem with Virtuemart 3.0, even modifying that file nothing is gonna change...do you know where i should look?
thanks