VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: apj.louwerse on October 27, 2013, 11:38:27 AM

Title: Login first before selecting shipping
Post by: apj.louwerse on October 27, 2013, 11:38:27 AM
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
Title: Re: Login first before selecting shipping
Post by: jenkinhill on October 27, 2013, 13:15:36 PM
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.
Title: Re: Login first before selecting shipping
Post by: apj.louwerse on October 30, 2013, 09:50:01 AM
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
Title: Re: Login first before selecting shipping
Post by: jenkinhill on October 30, 2013, 10:37:46 AM
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.
Title: Re: Login first before selecting shipping
Post by: AH on October 30, 2013, 10:47:39 AM
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


<?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 ?>