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

Mod to set max lenght for product option text fields

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 12-06-2003, 08:52 AM
  finestshops's Avatar 
finestshops finestshops is offline
 

eXpert
  
Join Date: Oct 2002
Location: Toronto, Canada
Posts: 335
 

Default Mod to set max lenght for product option text fields

Hi guys,

I want to share a small mod to set the max number of characters for product option text fields. I was asked about this feature several times in the last week and here it is.

Example: Monogram field for each product - 3 characters max.

http://regalfav.finestshops.com/store/customer/product.php?productid=149

Here is the code:

skin1/modules/Product_Options/product_options.tpl

change this one:

Code:
<input type=text name="product_options[{$product_options[product_option].optclass}]" size=32>

to this:

Code:
<input type=text name="product_options[{$product_options[product_option].optclass}]" size={$product_options[product_option].optclass|regex_replace:"/[[a-z]|[A-Z]|_/":""} maxlength={$product_options[product_option].optclass|regex_replace:"/[[a-z]|[A-Z]|_/":""}> Max: {$product_options[product_option].optclass|regex_replace:"/[[a-z]|[A-Z]|_/":""} character(s)

Now, just use "optionclass_maxlength" format for product option class.
Like "Message_10" to restrict "Message" filed to 10 characters or
"Monogram_3" field to restrict Monogram field to 3 characters.

Hope this will help somebody. Should work in any version.
__________________
Best regards,

Anton Pachkine
finestshops.com/x-cart
Reply With Quote
  #2  
Old 12-09-2003, 11:39 AM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

Nice output, thanx. I am not using it at the moment but could be handy.
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #3  
Old 05-09-2004, 07:42 AM
 
derrick92130 derrick92130 is offline
 

Advanced Member
  
Join Date: Nov 2002
Location: San Diego, California USA
Posts: 68
 

Default

Interesting and much cleaner approach than what I had done in the past. I actually modified the table structure to include a couple of new fields to identify type of field (Monogram versus Embroidery as an example), size of field, etc. I then modified the admin interface to allow those fields to be defined easily on a product by product basis. With some strong rules on how to name the type fields, this is interesting.

I also had to adjust the price for monogramming based upon how many characters were entered (first 10 characters for $30, $3 per character thereafter, with a max of 30 as an example). I ended up modifying that in the cart calculation code.

Do you have any variable costs issues like this that you have dealt with? Upgrading the cart becomes quite difficult with the way I implemented it and am now ready to rethink it as I am doing an upgrade now.
__________________
-Derrick
FreeRangeMinds, LLC
Reply With Quote
  #4  
Old 01-16-2005, 08:57 PM
 
1day2004 1day2004 is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 115
 

Default

I tried implementing this mod, but couldn't find the code: <input type=text name="product_options[{$product_options[product_option].optclass}]" size=32> in skin1/modules/Product_Options/product_options.tpl

I'm using version 4.0.8. Any ideas where I can find it?
__________________
Version 4.0.8 Live
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not 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:59 PM.

   

 
X-Cart forums © 2001-2020