VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Pejo on December 20, 2013, 00:21:45 AM

Title: Turn off error report: "missing value for" in shoping cart
Post by: Pejo on December 20, 2013, 00:21:45 AM
Hi,

Joomla 2.5.17
VirtueMart 2.0.26

I know why this (lets call it error, but I know it isn't, it is some kind of report) is showing, because after registration, customer didn't enter all needed data, such as, Name, address, Country, etc.

So what is the problem? Problem is that a lot of customers after registration doesn't know that they have register under joomla, and that they have to enter their other data for VirtueMart check out.
Problem is when customer is entering cart. After entering cart, you got message such as:

Missing Value for first name
Missing Value for second name
Missing Value for Address 1
Missing Value for city
Missing Value for Country
Please, confirm that you agree with our Terms of conditions


This error/notification is OK after customer/buyer press "confirm order", because if buyer did not insert his address, he need to insert it first, so after pressing "confirm order" this error must be shown, but I don't wont it to be show immediately entering cart.

Is there way to hide this entering cart?
Thanks.
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: AH on December 20, 2013, 17:47:48 PM
THis is probably because you have a default country set in the country_id field

If you remove the default value I think you will be ok
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: rizecorp on December 23, 2013, 07:06:26 AM
Is there any alternate solution for the above missing value issue with joomla 2.0.26.
That issue will not repeat once you filled those fields by clicking on the "Add/Edit billing address information" and save.

Thanks in advance.
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: rizecorp on December 27, 2013, 06:02:44 AM
Hi All,

Joomla 2.5.16
VirtueMart 2.0.26

  Here we are using joomla registration and not virtuemart registration as some users are not necessarily shoopers. After registration and logged in from the front end to purchase the product and click on the "add to cart" button & click on the "show cart" then we have an issue like below screenshot:
 
(http://forum.virtuemart.net/index.php?action=dlattach;topic=121063.0;attach=57623;image)
 
 
  We have configured "Canada" and "United States" as the default countries for all the users.
  Please let me know the solution to avoid the issue.
 
Thanks
Rizecorp

[attachment cleanup by admin]
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: AH on December 27, 2013, 12:02:56 PM
Try to upgrade to 2.0.26a
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: rizecorp on December 28, 2013, 08:19:19 AM
Hi Hutson,

  Thank you for the reply.

I have upgraded the virtuemart to the latest version 2.0.26a and tested by registering the new user and tried to checkout. Still issue is not solved. Please let me know if any alternate solution.

Thanks
Rizecorp
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: AH on December 28, 2013, 12:01:33 PM
components\com_virtuemart\helpers\cart.php

When a default country is set in the userfield virtuemart_country_id

On entry to the Checkout

The process behaves as though the BT address has been completed


Try commenting out the code as per below :-


$addresstype = $type.'address';
$userFieldsBT = $userFieldsModel->getUserFieldsFor('cart',$type);
$this->$addresstype = $userFieldsModel->getUserFieldsFilled(
$userFieldsBT
,$data
,$preFix
);
//vmdebug('prepareAddressDataInCart',$this->$addresstype);
// if(empty($this->$type)){
// $tmp =&$this->$type ;
// $tmp = array();
// foreach($address['fields'] as $k =>$field){
// //vmdebug('prepareAddressDataInCart',$k,$field);
// if($k=='virtuemart_country_id'){
// if(isset($address['fields'][$k]['virtuemart_country_id']) and !isset($tmp['virtuemart_country_id'])){
// $tmp['virtuemart_country_id'] = $address['fields'][$k]['virtuemart_country_id'];
// }
// } else if($k=='virtuemart_state_id') {
// if(isset($address['fields'][$k]['virtuemart_state_id']) and !isset($tmp['virtuemart_state_id'])){
// $tmp['virtuemart_state_id'] = $address['fields'][$k]['virtuemart_state_id'];
// }
// } else if (!empty($address['fields'][$k]['value'])){
// if(!isset($tmp[$k])){
// $tmp[$k] = $address['fields'][$k]['value'];
// }
//
// }
// }
//$this->$type = $tmp;
// }
if(!empty($this->ST) && $type!=='ST'){
$data = (object)$this->ST;
if($new){
$data = null;
}
$userFieldsST = $userFieldsModel->getUserFieldsFor('cart','ST');
$this->STaddress = $userFieldsModel->getUserFieldsFilled(
$userFieldsST
,$data
,$preFix
);
}

}

Title: [Solved]Re: Turn off error report: "missing value for" in shoping cart
Post by: rizecorp on December 31, 2013, 05:23:38 AM
Hi Hutson,

    Thank you for your reply.

I have commented the code as per your suggestion and it worked out for me.
Many thanks dude..  :D   but the only thing is it is a core hack. every time i upgraded virtuemart to the latest version i have to apply this hack.

Thanks
Rizecorp
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: AH on December 31, 2013, 13:49:27 PM
You are welcome.

I have passed this on to the VM team and suggested they implement an configuration option that should prevent "auto" address field population prior to address input.

They are considering this for the future, at least you now know where the hack has to be placed.  Sometimes it is not possible to get away from a small hack, just try and make as few as possible.

Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: marco on February 12, 2014, 00:09:33 AM
Hi team. Not working for me, always "missing value" messages in not-pre-compilate-fields during cart checkout or user account.

Solution.

To turn off the "missing value" error report, open administration/components/com_virtuemart/models/user.php - locate the function validateUserData and go to the end, and comment as this:

if($i==$required) $return = -1;
   vmdebug('my i '.$i.' my data size '.$required,$return,$data);
   if(!$return){
      VmConfig::loadJLang('com_virtuemart_shoppers', true);
      foreach($missingFields as $fieldname){
      // vmInfo(JText::sprintf('COM_VIRTUEMART_MISSING_VALUE_FOR_FIELD',$fieldname) );
      vmdebug('');
   }
}
return $return;


I noticed this is the difference in the model from the previous vm version. You can even delete all the if(){} or just comment the line as me, and the "missing value" will be away, as in the past virtuemart version.

I !!PRAY!! the virtuemart team to review this ending part of function! This aler is not usefull, because even without you will be anyway redirect to fill the registration form, and if you forget some fields, there will be a javascript function to alert you for the requested fields.

But if you have joomla registration or you are using some social login, this "missing value" alert in the cart and in the user account are very bed for e.commerce users.

Many customers of the virtuemartrewardspoints.com website told me for that, they left the cart.
So I was forced to modify the model! Hope to be usefull for someone!!!
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: ottro on February 26, 2014, 23:23:33 PM
Hi I had the same problem. Thank you very much for your contribution. I used the solution that has been proposed Marco:

Solution.

To turn off the "missing value" error report, open administration/components/com_virtuemart/models/user.php - locate the function validateUserData and go to the end, and comment as this:

if($i==$required) $return = -1;
   vmdebug('my i '.$i.' my data size '.$required,$return,$data);
   if(!$return){
      VmConfig::loadJLang('com_virtuemart_shoppers', true);
      foreach($missingFields as $fieldname){
      // vmInfo(JText::sprintf('COM_VIRTUEMART_MISSING_VALUE_FOR_FIELD',$fieldname) );
      vmdebug('');
   }
}
return $return;


I also think this ad is the user does nothing, as you will need to fill in all fields in order to make the purchase. Would be nice if in the next updates Virtuemart team could remove this notice.

Thanks for your great work.
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: myplace2100 on July 21, 2014, 15:38:53 PM
I am having the same problem as i am getting those missing values errors in cart page and billing address input page after i upgraded to VM 2.6.0a from low VM 2 version. Solution suggested by Marco is not working in cases when user don't enter some required fields in billing address page, they don't see errors for this.

But solution suggested by Hutson  seems working, but how much fruitful it is in all circumstances ?? Please help any expert guy.
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: AH on July 21, 2014, 16:00:21 PM
I think my solution works in all cases!

It overcomes the issue with a default country being populated in the country filed

This causes the checkout to suggest that you have missed entering fields, even before you have has a chance to enter them.

All required fields are tested as normal
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: myplace2100 on July 21, 2014, 16:19:36 PM
thanks, i will test it by debugging. But when this will be corrected in upcoming VM version?

Also another issue is if i left state field not selected in billing address page i get error - "Missing value for COM_VIRTUEMART_SHOPPER_FORM_STATE" Why it's showing language constant instead of value?? plz help my VM 2.6.0a.
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: AH on July 21, 2014, 17:28:34 PM
Devs have said that this is a feature as it allows the price of orders to be pre-calculated without a full address when you enter the checkout

Great for all those shops where country is the only determinate of shipping price and shipping to one country only

Not much use for anyone not requiring such a function and no ability to switch it off -

They may introduce a parameter in VM3 but I am not sure about that.

Check your language files
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: myplace2100 on July 21, 2014, 17:37:09 PM
Ok one more thing is commenting out those codes as u suggested have any affect of price calculation and showing wrong price to buyers will be presented before and after checkout ??

I checked language file en-GB.com_virtuemart_shoppers.ini in language->en_GB folder and that constant with that value is there!, so can't guess what is the problem.
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: AH on July 21, 2014, 23:00:54 PM
The change does not affect anything other than the early delivery calculation

Prices etc are not affected
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: diacotm on November 23, 2021, 17:50:40 PM
Hi, i got the same issue,
May u help me with Joomla 3.10.2 and Virtuemart VirtueMart 3.8.8 10472? cause i couldn't find these lines on the file that u mention

Thanks in advanced
Quote from: AH on December 28, 2013, 12:01:33 PM
components\com_virtuemart\helpers\cart.php

When a default country is set in the userfield virtuemart_country_id

On entry to the Checkout

The process behaves as though the BT address has been completed


Try commenting out the code as per below :-


$addresstype = $type.'address';
$userFieldsBT = $userFieldsModel->getUserFieldsFor('cart',$type);
$this->$addresstype = $userFieldsModel->getUserFieldsFilled(
$userFieldsBT
,$data
,$preFix
);
//vmdebug('prepareAddressDataInCart',$this->$addresstype);
// if(empty($this->$type)){
// $tmp =&$this->$type ;
// $tmp = array();
// foreach($address['fields'] as $k =>$field){
// //vmdebug('prepareAddressDataInCart',$k,$field);
// if($k=='virtuemart_country_id'){
// if(isset($address['fields'][$k]['virtuemart_country_id']) and !isset($tmp['virtuemart_country_id'])){
// $tmp['virtuemart_country_id'] = $address['fields'][$k]['virtuemart_country_id'];
// }
// } else if($k=='virtuemart_state_id') {
// if(isset($address['fields'][$k]['virtuemart_state_id']) and !isset($tmp['virtuemart_state_id'])){
// $tmp['virtuemart_state_id'] = $address['fields'][$k]['virtuemart_state_id'];
// }
// } else if (!empty($address['fields'][$k]['value'])){
// if(!isset($tmp[$k])){
// $tmp[$k] = $address['fields'][$k]['value'];
// }
//
// }
// }
//$this->$type = $tmp;
// }
if(!empty($this->ST) && $type!=='ST'){
$data = (object)$this->ST;
if($new){
$data = null;
}
$userFieldsST = $userFieldsModel->getUserFieldsFor('cart','ST');
$this->STaddress = $userFieldsModel->getUserFieldsFilled(
$userFieldsST
,$data
,$preFix
);
}

}

Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: GJC Web Design on November 24, 2021, 10:35:07 AM
this thread is from July 21, 2014 !!!!!   :o
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: diacotm on November 24, 2021, 14:57:16 PM
Yeap :(
But i got the same issue and i don't know what to do!
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: GJC Web Design on November 24, 2021, 15:11:04 PM
what problem have u got .. ? Far more info needed ...  if u use VM to register your customers there should be no missing fields
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: diacotm on November 25, 2021, 07:53:18 AM
I use VP One page checkout but it has no difference with or without this plugin cause in both states the error is shown and doesn't let users to go through!
Title: Re: Turn off error report: "missing value for" in shoping cart
Post by: Jörgen on November 25, 2021, 09:01:40 AM
VM version, screenshots, more info needed.

Jörgen  @ Kreativ Fotografi