News:

Looking for documentation? Take a look on our wiki

Main Menu

Login first before selecting shipping

Started by apj.louwerse, October 27, 2013, 11:38:27 AM

Previous topic - Next topic

apj.louwerse

Hello,

Last week I implemented VM2.

When I go to Checkout, I cannot select shippingmethod when I'm not logged in.
When I want to select a shippingmethod, I get an error.

Is it possible to force login first, before displaying shipping and payment methods (i.e. on next screen)?

thanx.
Arthur

jenkinhill

If the shopper has not registered/logged in then the shipping plugins don't know which country/state the goods are to be shipped to so cannot be selected.
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

apj.louwerse

Thanx for your Reply Jenkinhill!

Now I understand why shipment can't be selected, of pre-selected.

But then it would be better to only have a login at the first screen, which forces you to register or login before continuing, and then have the other options like shipment and payment at a next screen.
Do you have any idea if this is possible?

Arthur

jenkinhill

The cart template can be edited to do that if you require it, an alternative is to have a pre-register/login before being able to add to cart.
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

AH

Yes I agree with both of you

So we can check to see if a Billing address exists and then display the shipping

Set the configuration for OPC checkout in admin.

Then do an override to the template to determine what to show to the customer:-

\templates\yourtemplate\html\com_virtuemart\cart\default_pricelist.php

Old code

<tr class="sectiontableentry1" valign="top">
<?php if (!$this->cart->automaticSelectedShipment) { ?>

<?php /* <td colspan="2" align="right"><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING'); ?> </td> */ ?>
<td colspan="4" align="left">
<?php echo $this->cart->cartData['shipmentName']; ?>
<br/>
<?php
if (!empty(
$this->layoutName) && $this->layoutName == 'default' && !$this->cart->automaticSelectedShipment) {
if (VmConfig::get('oncheckout_opc'0)) {
$previouslayout $this->setLayout('select');
echo $this->loadTemplate('shipment');
$this->setLayout($previouslayout);
} else {
echo JHTML::_('link'JRoute::_('index.php?view=cart&task=edit_shipment'$this->useXHTML$this->useSSL), $this->select_shipment_text'class=""');
}
} else {
echo JText::('COM_VIRTUEMART_CART_SHIPPING');
}?>

</td>
<?php
} else {
?>

<td colspan="4" align="left">
<?php echo $this->cart->cartData['shipmentName']; ?>
</td>
<?php ?>

<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"><?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('shipmentTax'''$this->cart->pricesUnformatted['shipmentTax'], FALSE) . "</span>"?> </td>
<?php ?>
<td align="right"><?php if($this->cart->pricesUnformatted['salesPriceShipment'] < 0) echo $this->currencyDisplay->createPriceDiv ('salesPriceShipment'''$this->cart->pricesUnformatted['salesPriceShipment'], FALSE); ?></td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('salesPriceShipment'''$this->cart->pricesUnformatted['salesPriceShipment'], FALSE); ?> </td>
</tr>



New code

  • Checks to see if there is a BT address (there will not be one unless logged in or one has been entered and saved
    Displays a message until a BT address exists (hard coded in this example , but could easily be made a language variable)


<?php if (empty($this->cart->BT)){ ?>
    <tr class="sectiontableentry1" valign="top">
        <td colspan="7" align="left">
            Login or Complete your Billing details for shipping options
        </td>
    </tr>
<?php
} else {
?>

    <tr class="sectiontableentry1" valign="top">
        <?php if (!$this->cart->automaticSelectedShipment) { ?>
   
        <?php /* <td colspan="2" align="right"><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_SHIPPING'); ?> </td> */ ?>
                    <td colspan="4" align="left">
                    <?php echo $this->cart->cartData['shipmentName']; ?>
        <br/>
        <?php
        
if (!empty($this->layoutName) && $this->layoutName == 'default' && !$this->cart->automaticSelectedShipment) {
            if (
VmConfig::get('oncheckout_opc'0)) {
                
$previouslayout $this->setLayout('select');
                echo 
$this->loadTemplate('shipment');
                
$this->setLayout($previouslayout);
            } else {
                echo 
JHTML::_('link'JRoute::_('index.php?view=cart&task=edit_shipment'$this->useXHTML$this->useSSL), $this->select_shipment_text'class=""');
            }
        } else {
            echo 
JText::('COM_VIRTUEMART_CART_SHIPPING');
        }
?>

        </td>
    <?php
    
} else {
        
?>

        <td colspan="4" align="left">
            <?php echo $this->cart->cartData['shipmentName']; ?>
        </td>
        <?php ?>
   
        <?php if (VmConfig::get ('show_tax')) { ?>
        <td align="right"><?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('shipmentTax'''$this->cart->pricesUnformatted['shipmentTax'], FALSE) . "</span>"?> </td>
        <?php ?>
        <td align="right"><?php if($this->cart->pricesUnformatted['salesPriceShipment'] < 0) echo $this->currencyDisplay->createPriceDiv ('salesPriceShipment'''$this->cart->pricesUnformatted['salesPriceShipment'], FALSE); ?></td>
        <td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('salesPriceShipment'''$this->cart->pricesUnformatted['salesPriceShipment'], FALSE); ?> </td>
    </tr>
<?php ?>
Regards
A

Joomla 3.10.11
php 8.0