Thread: New Option Type

Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2011
    Posts
    16
    Plugin Contributions
    0

    Default New Option Type

    I need an additional "option type" to describe an attribute. It is "date/time."

    I've considered several options, but none seems workable. While the information can certainly be stored as a text field, I need to give the client a simple way to select the date and time through an applet which produces perfectly formatted text (so I can later use this to automatically add a cron job).

    I've not come across any discussion whatsoever about adding new option types. Has anyone considered this or had experience doing this?

  2. #2
    Join Date
    Apr 2006
    Location
    Texas
    Posts
    6,196
    Plugin Contributions
    0

    Default Re: New Option Type

    This thread might get your brain a thinking?
    Settings for time, date, etc. follow pretty much zen-cart's configuration options with two important differences.

    • There is no need to implement a custom zen_date_raw(..) function if your UI date format differs from the default. This is done transparently by configuring UI_DATE_FORMAT and UI_DATE_FORMAT_SAMPLE.
    • Settings are configured similar to About:Localization l10n options using a function. This allows it to inherit settings while still being able to modify them later on.


    Settings are expected in the theme's lang directory in a file named i18n.php.

    UI_DATE_FORMAT supports the following format options:
    DD The day (two digits) MM The month (two digits) CC The century (two digits) YY The year (two digits) YYYY The year (four digits) All other characters in the format string will be ignored when converting user input to be stored in the database.
    It is also worth pointing out that UI_DATE_FORMAT is also used by the date validation code.

    The i18n settings of the default theme:
    <?php zm_i18n_add(array( // system locale 'LC_TIME_LOCALE' => 'en_US.ISO_8859-1', // to format dates 'DATE_FORMAT' => 'd/m/Y', // to parse user input 'UI_DATE_FORMAT' => 'dd/mm/yyyy', 'UI_DATE_FORMAT_SAMPLE' => '16/11/1967', // various date/time formats used 'DATE_FORMAT_LONG' => '%A %d %B, %Y', 'DATE_TIME_FORMAT' => '%d/%m/%Y %H:%M:%S', 'HTML_CHARSET' => 'iso-8859-1', // NOTE: This is *NOT* used in ZenMagick, however zen-cart uses it in some places... 'HTML_PARAMS' => 'dir="ltr" lang="en"' )); ?>

  3. #3
    Join Date
    Mar 2011
    Posts
    16
    Plugin Contributions
    0

    Default Re: New Option Type

    Well, it didn't get my brain thinking so much as it caused my brain to explode somewhat...

    I'm not a programmer and, although I understand the terminology and can read the PHP code, it doesn't help me to actually produce this new option type.

    Have you done something similar? Or can you do this? If so, we could take our conversation offline and discuss fees and time lines.

 

 

Similar Threads

  1. Add new Attribute Option Type
    By wow11111 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 17 May 2009, 07:30 PM
  2. Creating a new Option Type
    By rippyuk in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 18 Oct 2007, 04:21 PM
  3. How to create new option type with value for gift certificate
    By Beez in forum Setting Up Categories, Products, Attributes
    Replies: 14
    Last Post: 7 Dec 2006, 02:44 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