Results 1 to 5 of 5

Hybrid View

  1. #1

    Default Formating Text Area Attribute

    I'm using a text attribute of 35 characters max and 3 rows and having two problems with it.

    First: The carraige returns are being counted as characters. I can explain spaces being counted to customers but not carraige returns. I am not charging per letter but I do want to allow for an acurate entry.
    http://storefront.gwrradea.org/index...&products_id=2


    Second: The format of the entry when sent to email, packing slip, invoice or viewed through the order details in the administrator are not justified properly. Attached is a picture of how they are being formatted with lines 2 and 3 left justified under line 1. Is there any way to have lines 2 and 3 line up under line 1?



    Thanks
    Mike
    Attached Images Attached Images  

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Formating Text Area Attribute

    This would be an unexpected feature ...

    Some call it a bug ...

    I am moving this to the Bug Reports ...

    Thanks for spotting this, no one else has up until now and that has been there for a long, long time ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Formating Text Area Attribute

    The solution to this is to backup your file:
    /includes/functions/functions_prices.php

    Find the four functions for calculate letter or words and add as the first line to them:
    PHP Code:
        $string str_replace(array("\r\n""\n""\r""\t"), ""$string); 
    NOTE: each are commented with:
    // calculate words
    // calculate letters

    See if this doesn't fix the calculations for you ...

    This is a temporary solution at this time ... but will result in the correct pricing for you ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  4. #4

    Default Re: Formating Text Area Attribute

    okay, I tried that and nothing worked. Below is one of the functions along with the code I inserted:

    // calculate letters
    function zen_get_letters_count($string, $free=0) {
    $string = str_replace(array("\r\n", "\n", "\r", "\t"), "", $string);
    while (strstr($string, ' ')) $string = str_replace(' ', ' ', $string);
    $string = trim($string);
    if (TEXT_SPACES_FREE == '1') {
    $letters_count = strlen(str_replace(' ', '', $string));
    } else {
    $letters_count = strlen($string);
    }
    if ($letters_count - $free >= 1) {
    return ($letters_count - $free);
    } else {
    return 0;
    }
    }


    I wasn't sure if the line you sent needed to be the first line after the function call or if it needed to be directly after the comment but I tried both, refreshed the page and nothing changed. As a matter of fact. I'm noticing it is actually two characters that are used for the carraige return. I type in 1234 with the 35 limit and when I hit the return the count drops from 31 to 29. Sorry for the miss on that.

    Mike

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Formating Text Area Attribute

    PHP Code:
      function zen_get_word_count($string$free=0) {
        
    $string str_replace(array("\r\n""\n""\r""\t"), ' '$string); 
    PHP Code:
      function zen_get_letters_count($string$free=0) {
        
    $string str_replace(array("\r\n""\n""\r""\t"), ' '$string); 
    Note: the java counter also needs an update in the:
    /includes/modules/pages/product_info/jscript_textarea_counter.js

    Code:
    /* javascript function to update form field
     *  field		form field that is being counted
     *  count		form field that will show characters left
     *  maxchars 	maximum number of characters
    */
    function characterCount(field, count, maxchars) {
      var realchars = field.value.replace(/\t|\r|\n|\r\n/g,'');
      var excesschars = realchars.length - maxchars;
      if (excesschars > 0) {
    		field.value = field.value.substring(0, excesschars);
    		alert("Error:\n\n- You are only allowed to enter up to"+maxchars+" characters.");
    	} else {
    		count.value = maxchars - realchars.length;
    	}
    }
    The functions fix the price ...

    The java fixes the counter in the box ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. Formating Text attribute for print
    By michaelchu in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 12 Jan 2012, 02:17 PM
  2. remove text formating in batch
    By kitcorsa in forum General Questions
    Replies: 0
    Last Post: 14 Jan 2010, 05:14 PM
  3. Text formating not displaying per css
    By jeking in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 7 Jan 2009, 03:59 PM
  4. attribute formating
    By Greybeard in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Jul 2007, 06:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg