X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Making product description non-mandatory (https://forum.x-cart.com/showthread.php?t=20240)

interstellarsounds 03-01-2006 07:55 AM

Making product description non-mandatory
 
When adding a product I need to be able to make the 'short description' field non-mandatory. I do not want to remove the field completely but just make it so it can be left blank. I've searched around the main/product_details.tpl and main/product_modify.tpl but do not know which code to modify?

Any help would be appreciated.

danraymo 03-15-2006 04:36 AM

Required Fields for Product Modify
 
The required fields can be changed by adjusting line 82 in product_modify.php ----

$fillerror = (($categoryid == "") || empty($product) || empty($descr) || ($price == "") || ($avail == "") || empty($low_avail_limit));

remove "empty($descr) || "

alelover 04-08-2006 07:27 AM

I can't seem to find that line.

alelover 04-09-2006 01:48 PM

Required fields?
 
Ahhh. I got it. It was at line 269 in my version.

Dongan 04-09-2006 10:29 PM

glad to know that you got it. but, however does it solve your problem exactly what you want?

ryno 04-12-2006 04:02 PM

The problem with removing that error checking function from that line (269 for me too btw) is that now it won't validate the Full Description field and that field can now be submitted without being filled out, which is a bad thing.

I'm also wanting to remove the short description box from the admin products page and have had some resistance thusfar. I'm going to dig further, but I believe some further hacking is going to be required.

Any suggestions? If I beat you guys to it I'll reply my findings.

ryno 04-12-2006 04:28 PM

Okay - here's the deal.


Don't worry about include/product_modify.php
Leave it alone - it does what it's supposed to.

Edit: /yourSkin/main/product_details.tpl

Instead of this:
Code:

<tr>
{if $productids ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[descr]" /></td>{/if}
  <td class="FormButton" valign="top" nowrap>{$lng.lbl_short_description}* :</td>
  <td class="ProductDetails">
    <textarea name="descr" cols="45" rows="8" class="InputWidth">{$product.descr|escape:"html"}</textarea>
{if $top_message.fillerror ne "" and $product.descr eq ""}<font class="Star">&lt;&lt;</font>{/if}  </td>
</tr>


I replaced that whole row with a hidden field:
Code:

<input type=hidden value=" " name="descr" />

So the textarea doesn't have to be a textarea, its just that the variable "descr" just has to have SOME value - hence the 'space' in the value attribute.

The BEST way to do this, would be to go hack out every insert and validation rule for this field but - time is money and money talks so... It's semi-ugly but extremely effective.

rYno


All times are GMT -8. The time now is 02:25 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.