Page 1 of 1

Hide shipping if there is only one shipping option

PostPosted: Fri Oct 14, 2016 10:56 pm
by fototapeti@.....bg
Hide shipping if there is only one shipping option
There is such option for payments... why not for shipment too..?

Re: Hide shipping if there is only one shipping option

PostPosted: Mon Oct 17, 2016 1:55 pm
by admin
hello, you can disable shipping at all if that is an option for you.

here in slovakia and many other EU countries, it is not allowed to set any specific shipping method by default even when it's free. the customer must click the specific shipping method and the default should be "select a shipping method..."

you can however hide the shipping html by wrrapping it in your onepage.unlogged+logged.tpl.php with something like <div style="display: none;">... </div>

example per:
\components\com_onepage\themes\threecolumn_special_blue_css3\onepage.unlogged.tpl.php

Code: Select all
<div class="op_inside" <?php if (!empty($no_shipping) || ($shipping_inside_basket)) echo 'style="display: none;"'; ?>>

   
      
<?php

if ((empty($no_shipping)) && (empty($shipping_inside_basket)))
{

$iter++; echo '<h4>'.$iter.'. '; echo OPCLang::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING_LBL').'</h4>';
}
?>   
                           
                        <!-- shipping methodd -->
                        <div id="ajaxshipping">
                        <?php echo $shipping_method_html; // this prints all your shipping methods from checkout/list_shipping_methods.tpl.php ?>
                        </div>
                        <br />
                        
                        <!-- end shipping methodd -->

                     
   
   

</div>


with the new wrap:

Code: Select all
<div style="display: none;">
<div class="op_inside" <?php if (!empty($no_shipping) || ($shipping_inside_basket)) echo 'style="display: none;"'; ?>>

   
      
<?php

if ((empty($no_shipping)) && (empty($shipping_inside_basket)))
{

$iter++; echo '<h4>'.$iter.'. '; echo OPCLang::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING_LBL').'</h4>';
}
?>   
                           
                        <!-- shipping methodd -->
                        <div id="ajaxshipping">
                        <?php echo $shipping_method_html; // this prints all your shipping methods from checkout/list_shipping_methods.tpl.php ?>
                        </div>
                        <br />
                        
                        <!-- end shipping methodd -->

                     
   
   

</div>
</div>


pls do not delete any parts of OPC themes which include "IDs" otherwise the scripts may not work properly. it's always better to hiden them with the display: none;

other OPC themes use similar html, but with different wrappers to style the surrounding html.

best regards, stan, rupostel.com