[Feature request] plugin override customerfield required

Started by Doeke Norg, November 16, 2015, 13:48:18 PM

Previous topic - Next topic

Doeke Norg

When placing an order which comes digital, and is payed for via paypal or something similar, it doens't really make sense for a customer to have to enter all his information.
Giving his / her name and e-mailadres, should be more than enough.

I think it would be nice if there was a way to change the required status of a field via a plugin.
Based on information like payment method / shipping method / cart total.

I currently have a customer who sells both digital and physical products. When a cart only contains digital products the "shipping"-method is: "no shipping".
Based on this shipping method I'd like to set the required option to 0 for the address fields (zip, city, etc).

Also, with this addition, it would be possible to only show the necessary fields on a mobile device to enhance the usability.

Currently an plugin override is only available for custom fields.

lindapowers

#1
Well... as far as I know even digital products are products from a company and those require at least billing information.

I have never seen an invoice with only name and e-mail so I don't agree, it makes perfect sense to enter all the information required for billing.

I understand your request for simplicity but I don't think is a very good idea in legal terms.

I have always entered my billing address even for physical products.

Maybe an OPC solution or download plugin already makes possible what you request.

Doeke Norg

Quote from: lindapowers on November 16, 2015, 14:18:45 PM
Well... as far as I know even digital products are products from a company and those require at least billing information.

I have never seen an invoice with only name and e-mail so I don't agree, it makes perfect sense to enter all the information required for billing.

I understand your request for simplicity but I don't think is a very good idea in legal terms.

I have always entered my billing address even for physical products.

Maybe an OPC solution or download plugin already makes possible what you request.

Sure in some cases that's true. But isn't it up to the vendor if he wants this information? If a payment is done, and the products can be delivered via e-mail (which in my case is connected to the confirmation email), the order is completed without interference from the vendor.

I'm not suggesting that my specific case be added to Virtuemart, just the option to implement it on my own, and at my own "risk".

jenkinhill

Quote from: Doeke Norg on November 16, 2015, 14:25:01 PM
But isn't it up to the vendor if he wants this information?

Collecting such information is required by EU VAT laws so that the correct rate of tax is levied on downloadable products and paid to the appropriate country authorities.
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

Doeke Norg

True.

But it's all besides the point and feature request. This is just one example why it could be useful.

All I'm saying is: the possibility is there to make customer fields required / or not.
And because that is possible (wether it's needed for vat or not), I'd like to make that choice via a plugin based on whatever information I deem necessary :)

lindapowers

#5
Quote from: Doeke Norg on November 16, 2015, 15:18:56 PM
True.

But it's all besides the point and feature request. This is just one example why it could be useful.

First of all this is not a feature request section but a development section for bug reports mainly, actually that doesn't exist here unless they are things which benefit most vendors or improve the system.

As Jenkinhill told you this is requested by law so no one can really ignore that, Ill very very surprised if the VM team developed something like this when they really take care of laws in their system.

If I really needed this feature Ill contact GJC or Studio42 or any of the developers here since this is something very specific which most of use won't find useful at all and therefore I wont ask an entire team to develop it for me ;)

Feature requests should be something that give benefit for most vendors or that really make sense, creating a feature that crosses the line of what is legal... you know ;)

--------------------------------------

Furthermore just some fields are required and there you'll have to bypass the core joomla required fields which you seem to dont want either... ending up with a non secure system due to the difficulty of updating it but anyway.. do what you want ;)

Doeke Norg

Quote from: lindapowers on November 16, 2015, 15:46:08 PM
First of all this is not a feature request section but a development section for bug reports mainly, actually that doesn't exist here unless they are things which benefit most vendors or improve the system.

I searched for a request section, and didn't find one. I saw others (including the bulk-status-request) in this section. That's why I posted i here. 

QuoteAs Jenkinhill told you this is requested by law so no one can really ignore that, Ill very very surprised if the VM team developed something like this when they really take care of laws in their system.
If I really needed this feature Ill contact GJC or Studio42 or any of the developers here since this is something very specific which most of use won't find useful at all and therefore I wont ask an entire team to develop it for me ;)

I'm not asking the VM team to develop this. I'm quite capable of doing this myself. I'm only asking for a plugin function (an event-hook if you will) for overwriting a field. The code for this, is about 4 lines. I can update the core files and have it. But I'd also like to update to the next version of VM without any problems.

Quote
Feature requests should be something that give benefit for most vendors or that really make sense, creating a feature that crosses the line of what is legal... you know ;)

The request isn't crossing any line. What people may be doing with it is, of course. But, still, thats up to them. In every VM configuration you have the possibility to un-require the fields: address, zipcode, country, etc. I just want to do this, based on my own plugin and code.

Quote
Furthermore just some fields are required and there you'll have to bypass the core joomla required fields which you seem to dont want either... ending up with a non secure system due to the difficulty of updating it but anyway.. do what you want ;)

Not to be a smart ass or anything, but this just isn't true. Virtuemart itself overrides these values based on wether you want to register and checkout, or if you are required to have an account.

Another possible usage for this request would be to pre-fill certain fields based upon some kind of location data. It adds a layer of flexibility for developers.

Milbo

Quote from: Doeke Norg on November 16, 2015, 16:13:03 PM
The code for this, is about 4 lines. I can update the core files and have it. But I'd also like to update to the next version of VM without any problems.

Tell me the 4 lines :-)
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Doeke Norg

#8
Quote from: Milbo on November 19, 2015, 00:21:44 AM
Quote from: Doeke Norg on November 16, 2015, 16:13:03 PM
The code for this, is about 4 lines. I can update the core files and have it. But I'd also like to update to the next version of VM without any problems.

Tell me the 4 lines :-)

sorry, it's 5 lines :-) but you can add the closing bracket to the fourth line.


JPluginHelper::importPlugin('vmuserfield');
$dispatcher = JDispatcher::getInstance();
foreach($userFields as &$field) {
$dispatcher->trigger('plgVmOnGetUserfield', array($type, &$field));
}


I placed it in userfields.php in "getUserFieldsFor" just before

$c[$h] = $userfields;
return $userfields;

Milbo

So you can do this stuff like this yourself

//Small ugly hack to make registering optional //do we still need that? YES !  notice by Max Milbers
      if($register and $type == 'BT' and VmConfig::get('oncheckout_show_register',1) and !VmConfig::get('oncheckout_only_registered',1) ){

if(!$register and $type!='ST'){

right?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

Implemented as

JPluginHelper::importPlugin('vmuserfield');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('plgVmOnGetUserfields', array($type, &$userFields));


Your code was horrible unperformant. Triggers can be very slow.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

If you don't want check for legal User information.
Remove all "required" in Bill to adress and add a javascript to hide/show it with a toggle button+ media query for mobile.
I think, it's not needed to change anything in core for this, but i don't have do advanced test.
And remember that you can use Joomla system plugins OnAfterInitialise to control all your form, if VIrtuemart cannot do something most of time you can do it in Joomla

Milbo

I enhanced this feature today.

Required fields, which are core fields are set to register=1, so the js can handle it now almost perfectly. Still there is a stupid php var in the js, but it works flawless now. You can set now the pw field to unrequired and it stays unrequired.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/