Mike MacKechnie Posted December 10, 2015 Share Posted December 10, 2015 I need to make the Tax Class a mandatory field when using the Add Product option in the Admin panel.Using CC V6.0.8, the drop down for the Tax Class, in the Pricing Tab of Add Product, shows "Please Select" as the default setting.If the administrator forgets to assign a tax class to the product, the product will still be created, but with a tax class value of 0.I am currently developing some sales reports for my client, which is when I noticed these errant products. My client sells a lot of books, which are zero rated for tax, hence I was the first to spot this.So what I need is a check on the product before it is created, and some sort of error message and/or warning when the tax class has not been sent.I guess that I could live with the products being created, simply with a warning message about the tax class at the top of the screen, but the best solution would be to prevent the product from being created until the tax class had been selected. If this has already been raised as a topic then apologies but I have done a fairly comprehensive search.If this needs a git request raised let me know.Any advice appreciated. Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted December 11, 2015 Author Share Posted December 11, 2015 As a short-term stopgap I've removed the following from line 234 of /admin/skins/default/templates/products.index.php <option value="">{$LANG.common.please_select} …</option>so that the first tax class (<option value="1">Tax Exempt</option>) appears as the default selection in the drop-down. Quote Link to comment Share on other sites More sharing options...
bsandall Posted December 11, 2015 Share Posted December 11, 2015 Alternatively, you could add the `required="required"` attribute to the parent select element on the previous line:<select name="tax_type" id="tax_type" class="textbox" required="required">That should cause the form to highlight that input element upon submitting without selecting an option. Quote Link to comment Share on other sites More sharing options...
Mike MacKechnie Posted December 17, 2015 Author Share Posted December 17, 2015 Good thinking Mr Sandall;I've gone one step further and used <select name="tax_type" id="tax_type" class="textbox required">which does the job nicely. Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted December 17, 2015 Share Posted December 17, 2015 If making changes to admin skin templates then we strongly advise you to make a copy of the templates, called something else, so that these changes are not overwritten when doing an upgrade. When doing an upgrade, you will then also need to compare changes to the template files from your current CubeCart version to the new version and apply any new changes introduced.Ian Quote Link to comment Share on other sites More sharing options...
bsandall Posted December 17, 2015 Share Posted December 17, 2015 What Ian says is true, but a much better solution than making copies is to use a version control system such as Git - then whenever you upgrade, it is a simple process to re-apply all of your personal changes on top of the latest CC version. This becomes more and more useful the more changes you make. Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted December 17, 2015 Share Posted December 17, 2015 Yes of course git is a great solution but probably completely beyond most users (a guide on installing and using this for the average user would be a great community resource if you were willing !). The plugin functionality was introduced to CubeCart (and other products like WordPress for example) to allow function changes without changing any core files and this has always got to be the recommended way of doing changesIan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.