VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: AH on January 06, 2014, 23:20:42 PM

Title: 2.0.26b and a bug Shipto when only BT is added cart.php
Post by: AH on January 06, 2014, 23:20:42 PM
In vm 2.0.26a  fine in 2.0.26

default_pricelist.php and helpers/cart.php

Using OPC checkout configuration.

The template modifies the shipping address message based on their being ST data populates, allowing any added ST address to be ignored (nice function!)

However I noticed that in 2.0.26a , after completing the billing address and refreshing the page, the checkout displays the message and tick box as though I had completed a different ST address.

"Tick to ignore this Shipping address" and the tick box.


On closer inspection I can see that on completion of the BT address $this->cart->STaddress['fields'] is populated with the BT fields,

This causes the test for a different ST to BT address to trigger on page refresh (e.g.  selecting and saving a shipping or payment method)


<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');
}



IN addition

When the user tries to enter a different shipping address the fields are already populated with the BT data

Looks like the cause of this is some small changes to helpers/cart.php


Title: Re: 2.0.26a bug? in display of Shipto when only BT is added default_pricelist.php
Post by: GJC Web Design on January 06, 2014, 23:24:48 PM
Can confirm what you found - discovered this today as well with a fresh install
Title: Re: 2.0.26b/a bug in display of Shipto when only BT is added cart.php
Post by: AH on January 07, 2014, 00:21:29 AM
Using kdiff3 to identify the changes from 2.0.26 to 2.0.26a/b

There are a couple of tiny change to the code one of which is around line 881 in helpers/cart.php

if($this->STsameAsBT!==0){
if($validUserDataBT!==-1){
$this->ST = $this->BT;
} else {
$this->ST = 0;
}



IN 2.0.26  (which did not have this issue:-)

if($validUserDataBT!=-1){

if($this->STsameAsBT!==0){
if($validUserDataBT!=-1){
$this->ST = $this->BT;
} else {
$this->ST = 0;
}



If I change the code it works fine and the ST address data is not populated with the BT details

However there area couple of times where the test has changed from !=-1  to !==-1

Milbo or Alatak?
Title: Re: 2.0.26b and a bug Shipto when only BT is added cart.php
Post by: AH on January 08, 2014, 22:06:56 PM
Fixed by Max, should be sorted in next release!
Title: Re: 2.0.26b and a bug Shipto when only BT is added cart.php
Post by: ocsalb on April 10, 2014, 16:50:48 PM
Thanks!