Results 1 to 3 of 3
  1. #1
    Join Date
    May 2007
    Posts
    6
    Plugin Contributions
    0

    Default Free Letters - Can Punctuation Be Free?

    I read an archived thread ( I can't post to it so here it is again)
    Free Letters - Can Punctuation Be Free?
    As suggested, I replaced the following line of code in
    includes/functions/function_prices.php

    Code: $letters_count = strlen(str_replace(' ', '', $string));
    with
    Code:
    $letters_count = strlen(str_replace(' ', '', str_replace('.', '', $string)));
    It does work, for "." but I'd like to add other punctuation as well. Specifically, comma, periods, dashes, and apostrophes. Might someone be able to toss me a clue?
    thanks
    steco

  2. #2
    Join Date
    May 2007
    Posts
    6
    Plugin Contributions
    0

    Default Re: Free Letters - Can Punctuation Be Free?

    never mind .. I figured it out. not sure how pretty it is .. but it works.
    So, for anyone else struggling with this .....

    The pattern is to add a space after the last str_replace('foo', '', then repeat that
    str_replace('foo', '',
    and don't forget to add another curved bracket after $string

    The code previously posted to not charge for the "period" was:
    Code:
    $letters_count = strlen(str_replace(' ', '', str_replace('.', '', $string)));
    to allow ' " . , - / ( ) % # I changed it to:
    Code:
    $letters_count = strlen(str_replace(' ', '', str_replace('.', '', str_replace(',', '', str_replace("'", '', str_replace('-', '', str_replace('/', '', str_replace('"', '', str_replace('(', '', str_replace(')', '', str_replace('%', '', str_replace('#', '', $string))))))))))));
    BTW single quote was a problem, I eventually solved by putting it in double quotes
    If anyone knows a better way to do any of this ... let me know.
    steco
    ( I don't even play a programmer on TV)

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

    Default Re: Free Letters - Can Punctuation Be Free?

    I have some code for this that I am playing with that will allow you to say what letters, spaces, characters, etc. are free ...

    With luck it will get out in an up coming release ...
    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. v139h Free shipping to just 1 country using free shipper and Yes, Always Free Shipping
    By boomy in forum Built-in Shipping and Payment Modules
    Replies: 9
    Last Post: 20 Oct 2014, 01:43 AM
  2. Replies: 1
    Last Post: 8 Jun 2012, 04:35 PM
  3. Can I set up Retail all free shipping, Wholesale free shipping >$500 ?
    By GTHENRY in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 19 Aug 2010, 10:34 PM
  4. How can I not show [was: +$0.00 now is: Free] on free products?
    By jaxbakers in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 23 Jul 2006, 02:19 PM

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