- Posts: 259
- Thank you received: 22
Changing user groups before completing a sale
- rodfarrell
-
Topic Author
- Offline
Less
More
11 years 11 months ago #174724
by rodfarrell
Changing user groups before completing a sale was created by rodfarrell
-- HikaShop version -- : 2.3.0
I have another requirement thrown at me from left field. My client wants to charge no shipping to customers who provide an employee number.
Ignoring how we verify the input for now, I'm thinking this would most likely be a custom address field so it is stored for future reference and possibly change the user group to one that gets free shipping when the field is completed. Does anyone have any alternate suggestions or see any insurmountable issues with this approach?
I have another requirement thrown at me from left field. My client wants to charge no shipping to customers who provide an employee number.
Ignoring how we verify the input for now, I'm thinking this would most likely be a custom address field so it is stored for future reference and possibly change the user group to one that gets free shipping when the field is completed. Does anyone have any alternate suggestions or see any insurmountable issues with this approach?
Please Log in or Create an account to join the conversation.
11 years 11 months ago #174750
by Xavier
Replied by Xavier on topic Changing user groups before completing a sale
Hi,
Yes you can indeed use an address custom field, then you will have to create a plugin based on the function "onBeforeAddressCreate(&$element,&$do)" and do some PHP check regarding the custom field value, and if checks are ok you change the user group.
Here is some documentation for the plugins:
hikashop.com/support/support/documentati...r-documentation.html
Yes you can indeed use an address custom field, then you will have to create a plugin based on the function "onBeforeAddressCreate(&$element,&$do)" and do some PHP check regarding the custom field value, and if checks are ok you change the user group.
Here is some documentation for the plugins:
hikashop.com/support/support/documentati...r-documentation.html
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
Less
More
- Posts: 259
- Thank you received: 22
11 years 9 months ago #182829
by rodfarrell
Replied by rodfarrell on topic Changing user groups before completing a sale
I've just come back to this and realised my approach needs to change. What I really need to do is add two required text fields to the manual shipping plugin (or more accurately to a new plugin copied from the manual plugin). Essentially i need an employee number to be entered tyo allow a reduced shipping amount.
As Custom Fields are not available for shipping plugins, what would be the best way to do this?
As Custom Fields are not available for shipping plugins, what would be the best way to do this?
Please Log in or Create an account to join the conversation.
11 years 9 months ago #182845
by Xavier
Replied by Xavier on topic Changing user groups before completing a sale
Hi,
Add a custom order field, this way when on the checkout he can fill the field, and in the plugin you can check the content of the fields, if values are correct so change the user group.
Add a custom order field, this way when on the checkout he can fill the field, and in the plugin you can check the content of the fields, if values are correct so change the user group.
Please Log in or Create an account to join the conversation.
- rodfarrell
-
Topic Author
- Offline
Less
More
- Posts: 259
- Thank you received: 22
11 years 9 months ago #182948
by rodfarrell
Replied by rodfarrell on topic Changing user groups before completing a sale
Hi Xavier, unfortunately this is not an option because we only want the fields to apply to 1 of the two shipping methods available. An ideal option would be a custom field attached to a shipping method but Hikashop doesn't support that at the moment so the alternative is to add the fields directly to the shipping plugin.
Background - The site has two user groups (representing two corporate clients, each with multiple cost centres with their own accounts). Free shipping is being offered to employees of one of these customers for personal shopping only but as they will either be logging in using the employers login or creating a new account defaulting to the same user group we need the employee and cost centre codes to be completed only for those employee purchases - hence an employee "free shipping" plugin to be validated on the custom fields that only apply to that shipping method.
Background - The site has two user groups (representing two corporate clients, each with multiple cost centres with their own accounts). Free shipping is being offered to employees of one of these customers for personal shopping only but as they will either be logging in using the employers login or creating a new account defaulting to the same user group we need the employee and cost centre codes to be completed only for those employee purchases - hence an employee "free shipping" plugin to be validated on the custom fields that only apply to that shipping method.
Please Log in or Create an account to join the conversation.
11 years 9 months ago #182972
by Xavier
Replied by Xavier on topic Changing user groups before completing a sale
Hi,
Or use as said a custom order field, but add some javascript to hide it based on the shipping method selection.
If desired shipping method, display the field, else hide it, and do all the checks in the plugin.
Or use as said a custom order field, but add some javascript to hide it based on the shipping method selection.
If desired shipping method, display the field, else hide it, and do all the checks in the plugin.
Please Log in or Create an account to join the conversation.
Time to create page: 0.183 seconds