Jump to content

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

How To Make A Field Mandatory In Product Detail Page Tabs Rate Topic   - - - - -

 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 03 June 2015 - 05:00 AM #1

There are different tabs on the product detail page and what I want is to make few fields mandatory on different tabs so that if the vendor creates a new product he should get an error message if all the mandatory fields ( on different tabs) are not filled?

I tried using the class cm-required on the fields in tpl field but that is just a display of asterisk not a field check. Please advise?
Warm Regards,
Admin | MVE: 4.2.4

 

Posted 03 June 2015 - 08:15 AM #2

hi,

It should work via CSS class "cm-required" so possibly it was added to wrong HTML tags. Please check how it should look like:
<div class="control-group">
     <label for="product_field" class="control-label cm-required">Field</label>
     <div class="controls">
          <input class="input-large" type="text" name="field" id="product_field" value="">
     </div>
</div>

Comments:
1. CSS class "cm-required" is added to LABEL
2. FOR attribtute for LABEL = ID attribute for INPUT

Please check it and let us know result.

best regards,
WSA team

 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 08 June 2015 - 10:09 AM #3

Damir,

Thanks for the response, I did the same thing but now I have figured out why its not happening. I applied this on the weight field in shipping and by default its adding 0.00 in the content , how can we validate that the content is not 0.00 and then raise an alert that please fill this value while creating a product.

Thanks.
Warm Regards,
Admin | MVE: 4.2.4

 

Posted 09 June 2015 - 08:28 AM #4

You may remove the zero value 0.00 and make field required. For this please open the file "design/backend/templates/views/products/components/products_shipping_settings.tpl" and replace the line:


<label class="control-label" for="product_weight">{__("weight")} ({$settings.General.weight_symbol nofilter}):</label>

with:


<label class="control-label cm-required" for="product_weight">{__("weight")} ({$settings.General.weight_symbol nofilter}):</label>

and line


<input type="text" name="product_data[weight]" id="product_weight" size="10" value="{$product_data.weight|default:"0"}" class="input-long" />
with


<input type="text" name="product_data[weight]" id="product_weight" size="10" value="{$product_data.weight}" class="input-long" />

p.s. Also please don't forget to clear template cache.

Let us know if it helps.

best regards,
WSA team

 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 19 June 2015 - 08:20 AM #5

Hi Damir,

Thanks for this it works but now the issue is since the Shipping Tab is having this Weight field , if the user is not on the Shipping Tab he never comes to know that the validation error is coming. Can we somehow show a popup ( javascript) error to let the user know about this or may be some other notification ?

Thanks.
Warm Regards,
Admin | MVE: 4.2.4

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

Posted 19 June 2015 - 09:16 AM #6

The system should open the corresponding tab to the user. It is default CS-Cart behavior. Please check
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    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 

Posted 19 June 2015 - 11:27 AM #7

hi,

eComLabs is right, it should work by default.
If no, please provide us with the temporary FTP access, our specialists can check the issue.

best regards,
WSA team

 
  • fleaffair
  • Senior Member
  • Members
  • Join Date: 11-Jun 14
  • 537 posts

Posted 19 June 2015 - 11:35 AM #8

Awesome, it works post cleaning the cache. :shock: Strange behavior
Warm Regards,
Admin | MVE: 4.2.4

 
  • emall
  • Advanced Member
  • Trial users
  • Join Date: 15-Sep 20
  • 70 posts

Posted 17 February 2021 - 09:22 PM #9

Could you please explain where the CS class should be added in order to make a feature "rewuired"? I have a feature (size) which I would like to make a required field. How can I do this?

 

Many thanks in advance



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

Posted 18 February 2021 - 06:16 AM #10

You can add cm-required class to label elements here

 

design/backend/templates/views/products/components/product_assign_feature.tpl

 

This file has hooks as well


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    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • emall
  • Advanced Member
  • Trial users
  • Join Date: 15-Sep 20
  • 70 posts

Posted 18 February 2021 - 08:14 PM #11

Thank you ecom. Can you please indicate what I should replace with what, so as not to mess anything up. I remind you that I need to make a specific feature required (i.e. size).

 

Thanks again, much obliged



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

Posted 19 February 2021 - 07:18 AM #12

Try to replace

<label class="control-label" for="feature_{$feature_id}">

with

<label class="control-label{if $feature_id == 123} cm-required{/if}" for="feature_{$feature_id}">

where 123 - feature ID, can be found in the admin panel

 

(!) Not tested


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    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • emall
  • Advanced Member
  • Trial users
  • Join Date: 15-Sep 20
  • 70 posts

Posted 19 February 2021 - 09:15 PM #13

Thanks eCom but it didn't work. I get a "service unavailable" screen when trying to sreate a new product or see a product which is already in store.



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

Posted 21 February 2021 - 07:24 PM #14

Right click/inspect that screen and post the comments which is the stack trace and report of the error.  Most likely you have a typo in your Smarty syntax.


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
  • 21567 posts

Posted 22 February 2021 - 06:22 AM #15

Thanks eCom but it didn't work. I get a "service unavailable" screen when trying to sreate a new product or see a product which is already in store.

 

Our code is correct. Please make sure that everything is copied correctly


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    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)