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

Set the "Text Box" and "Maxlength" size per product

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 09-01-2006, 12:49 AM
  Blainevk's Avatar 
Blainevk Blainevk is offline
 

Senior Member
  
Join Date: Dec 2004
Location: Atlanta, GA
Posts: 162
 

Default How to set the "Text Box" and "Maxlength" size per product

Hello "Maximum Character" Seekers........

I have over 200 personalized products that can only be engraved with a specific number of characters (1 (initial), 3 (monogram) and other varying lengths) and I was determined to find a way to be able to set the text box size and the maximum amount of characters allowed for each product.

With a lot of determination and over 24 hours of trial and error, I have accomplished just that..... BUT with a couple of things that need tweeking to make it fully functional and I need the help of all, expecially the XCART GURUS!

It works when physically entering a NEW product in the admin section, but it will not allow for changes/updates (currently you can make changes/updates in the phpMyAdmin-MYSQL).... also I have not had time to figure out if there is a way to include this new feature in a CSV file for uploading (XCART GURUS, are you listening!!!

Anyway here is what you do if you want to be able to set the TEXT BOX SIZE and the MAXIMUM CHARACTERS for any products that need it!..... If you don't need this feature simply leave the boxes empty when creating your new products and it will create it with the default settings.

HERE ARE THE STEPS:
===============================

IN YOUR X-CART ADMIN AREA / LANGUAGES / LABELS

FIND:
lbl_availability ||| shorten "Availability" to: Avail (we need the space)
lbl_text_field ||| change "Text Field" to: Text Field** (adding the following two asterisks)

CREATE THE FOLLOWING NEW LABELS:
lbl_text_box_size ||| (Text Field) Box Size ||| **Box_Size
lbl_text_max_char ||| (Text Field) Max Keystrokes ||| **Max_Char

============================

GO TO YOUR PHPMYADMIN... (MYSQL)
inside table "xcart_classes"
Create the following fields:

FIELD ||| TYPE ||| LENGTH/VALUE ||| ATTRIBUTES ||| NULL ||| DEFAULT ||| EXTRA
max_char ||| INT ||| 11 ||| Blank ||| Not Null ||| 0 ||| Blank
box_size ||| INT ||| 11 ||| Blank ||| Not Null ||| 0 ||| Blank

============================

OPEN THE FILE:
skin1/modules/Product_Options/customer_options.tpl

FIND LINE 19:
===========================
<INPUT id="po{$v.classid}" type="text" name="{$poname}" maxlength="{$pomaxlength}" value="{$v.default|escape}">
===========================

AND CHANGE IT TO:
===========================
<INPUT id="po{$v.classid}" type="text" name="{$poname}" maxlength="{$v.max_char}" size="{$v.box_size}" value="{$v.default|escape}">
===========================


OPEN THE FILE:
skin1/modules/Product_Options/product_options.tpl


BETWEEN LINES 152 & 153 ADD:
===========================
<TR>
<TD>{$lng.lbl_text_max_char}</TD>
<TD><INPUT type="text" size="5" maxlength="3" name="add[max_char]" value="{$product_option.max_char}"></TD>
</TR>
<TR>
<TD>{$lng.lbl_text_box_size}</TD>
<TD><INPUT type="text" size="5" maxlength="3" name="add[box_size]" value="{$product_option.box_size}"></TD>
</TR>
===========================



BETWEEN LINES 67 & 68 ADD:
===========================
<TD valign="top">**<INPUT type="text" name="po_classes[{$v.classid}][max_char]" size="5" maxlength="3" value="{$v.max_char}"></TD>
<TD valign="top">**<INPUT type="text" name="po_classes[{$v.classid}][box_size]" size="5" maxlength="3" value="{$v.box_size}"></TD>
===========================



BETWEEN LINES 56 & 57 ADD:
===========================
<TD>{$lng.lbl_text_max_char}</TD>
<TD>{$lng.lbl_text_box_size}</TD>
===========================

OK, now let's fine tune this puppy!!!
__________________
Blaine

X-Cart Multi-vendor 5.4.1.35
PHP version: 8.1

Blaine's Travel Club - http://blainestravelclub.com

Collect Travel Points - http://blainestravelclub.com/travelpoints/rewards/

Travel Points Gift Mall - https://blainestravelclub.com/travelpoints/giftmall/

Grow Your Business - http://blainestravelclub.com/business/

Making Money & Fun - http://blainestravelclub.com/travelers/

Charitable Fun-razing - http://blainestravelclub.com/fun-razors
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 02:29 AM.

   

 
X-Cart forums © 2001-2020