Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Profile Field Required For Some Countries Rate Topic   - - - - -

 
  • sok777
  • Senior Member
  • Members
  • Join Date: 23-Jun 11
  • 324 posts

Posted 20 April 2018 - 06:25 AM #1

Hello,

 

what is the way to add extra profile field required only for certain countries on checkout registration page?

 

thanks



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17267 posts

Posted 20 April 2018 - 01:15 PM #2

I do not know easy way to do it. Additional custom development work is required


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • sok777
  • Senior Member
  • Members
  • Join Date: 23-Jun 11
  • 324 posts

Posted 23 April 2018 - 06:57 AM #3

ok thanks.

 

should it work if to make extra field visible / not required and add extra condition in profile_fields.tpl and to make it required if country match?

 

<input {if $field.autocomplete_type}x-autocompletetype="{$field.autocomplete_type}"{/if} type="text" id="{$id_prefix}elm_{$field.field_id}" name="{$data_name}[{$data_id}]" size="32" value="{$value}" class="ty-input-text {if $country == "XX"} cm-required" {/if} />



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17267 posts

Posted 23 April 2018 - 01:09 PM #4

ok thanks.

 

should it work if to make extra field visible / not required and add extra condition in profile_fields.tpl and to make it required if country match?

 

<input {if $field.autocomplete_type}x-autocompletetype="{$field.autocomplete_type}"{/if} type="text" id="{$id_prefix}elm_{$field.field_id}" name="{$data_name}[{$data_id}]" size="32" value="{$value}" class="ty-input-text {if $country == "XX"} cm-required" {/if} />

 

It should be checked dynamically after the country is changed, isn't it? In this case you should run special script after the profile details are updated to enable/ disable new field 


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • sok777
  • Senior Member
  • Members
  • Join Date: 23-Jun 11
  • 324 posts

Posted 01 May 2018 - 12:25 AM #5

I added test script for dynamic country check up in profile_scripts,tpl for extra notification as follows:

        $(_.doc).on('change', '.cm-country', function() {
 	    var country_val= $(this).val();
   	    if (country_val==="DE") {
			
			
            $.ceNotification('show', {
                type: 'W', 
                title: _.tr('warning'), 
                message: _.tr('cannot_buy'),
			});
		};

	});

.I think just enable/disable field is not enough, may be adding cm-required to the label for the specific field will do it?

 

What would be the right way to add field id check up and add class to its label? I need something like this

 

 

if (field_id == 37) {

 

    $('label').addClass('cm-required');

 

}

 

thanks



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17267 posts

Posted 02 May 2018 - 06:20 AM #6

I vote for specific class due to easy management


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10557 posts

Posted 02 May 2018 - 09:34 PM #7

Note that the 'cm-required' class is usually applied to the label versus the input tag.

Making it required only means "something entered" unless you use a reg_ex to validate it.  Otherwise you'll have to validate it in a controller (addon preferred) when the data is POSTed.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17267 posts

Posted 03 May 2018 - 06:37 AM #8

Note that the 'cm-required' class is usually applied to the label versus the input tag.

Making it required only means "something entered" unless you use a reg_ex to validate it.  Otherwise you'll have to validate it in a controller (addon preferred) when the data is POSTed.

 

You can also use regular expressions in the template with the cm-regexp class

 

https://docs.cs-cart...croformats.html


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.