Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Required Option/Attribute
 
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 06-10-2019, 05:24 AM
 
neroag neroag is offline
 

Senior Member
  
Join Date: May 2005
Location: UK
Posts: 171
 

Default Required Option/Attribute

Is there a way to have a products option a required field ?

I had this on V4 with some java scripting but not sure with V5

many thanks
__________________
X-cart Gold - 4.0.18 - 4.1.9 - 4.1.10 - 4.3.0
Reply With Quote
  #2  
Old 07-13-2019, 10:09 AM
 
Ed B. Ed B. is online now
 

Senior Member
  
Join Date: Apr 2016
Posts: 180
 

Default Re: Required Option/Attribute

This is about 5.3, and I don't know about in other versions. A quick look at the php code shows that there is an array defined in classes/XLite/View/FormModel/Product/Info.php called
Code:
$schema
So if you want to make required, for example, images, then you would want to set

Code:
$schema[self::SECTION_DEFAULT]['images']['required'] = true; $schema[self::SECTION_DEFAULT]['images']['constraints']['Symfony\Compon ent\Validator\Constraints\NotBlank'] = [ 'message' => static::t('This field is required'), ];
Now, unfortunately I don't know if there is a method defiend somewhere for changing this array.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #3  
Old 07-13-2019, 04:11 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,532
 

Default Re: Required Option/Attribute

It is a setting already in admin cart settings. It is global for all options/variants. If you need it on per product basis you need to get it custom coded.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:17 PM.

   

 
X-Cart forums © 2001-2018