Full service web hosting, great prices and support. Starts at $1.99/month!
Results 1 to 7 of 7

Thread: request free sample method?

  1. #1
    wkdwich
    Guest


    Default request free sample method?

    Maybe I am over thinking this I would like to add what essentially would be a dupliacte contact_us page for people to request a free sample. I will need full postal contact info from them as well as, phone, a license number, agree to conditions and newsletter check boxes.

    I found several contributions at OSC:
    osCommerce Community Add-Ons
    osCommerce Community Add-Ons

    I saw one thread about doing this with attributes but I don't think thats going to work in the big picture, nor did I understand how they did that.

    Anyone have any suggestions for me that would be simple to implement?

    thanks

  2. #2
    wkdwich
    Guest


    Default Re: request free sample method?

    Solved.. took some futzing with it, I basically duplicated the contact_us page and altered the language file to ask the user to enter the required information in the text box.. it works.. maybe not the right way, but it works

  3. #3
    wkdwich
    Guest


    Default Re: request free sample method?

    OK the system isn't perfect and I need a little more tweaking but I'm stuck and need help

    The subject line is still being pulled from the contact_us language file. When the page is refreshed after submitting, it goes to the contact_us.php page

    I took the 3 contact_us pages:
    catalog/contact_us.php
    catalog/templates/fallback/content/contact_us.php
    catalog/includes/languages/english/contact_us.php

    and copied them to the following file names, only changing "FILENAME_CONACT_US" to "FILENAME_SAMPLE" in the first 2 files, changed the form name in the template file and adjusted the text in the language file:

    catalog/sample.php
    catalog/templates/fallback/content/sample.php
    catalog/includes/languages/english/sample.php

    in
    catalog/includes/filenames.php I added:.
    define('FILENAME_SAMPLE', 'sample.php');

    Here are the 3 revised files:
    catalog/sample.php
    Code:
     
    <?php
    /*
    $Id: sample.php based on contact_us.php 8 2006-06-22 02:48:59Z user $
      osCMax Power E-Commerce
      http://oscdox.com
      Copyright 2006 osCMax
      Released under the GNU General Public License
    */
    // Most of this file is changed or moved to BTS - Basic Template System - format.
    // For adding in contribution or modification - parts of this file has been moved to: catalogtemplatesfallbackcontents<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).
    //       catalogtemplatesfallbackcontents<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).
    // (Sub 'fallback' with your current template to see if there is a template specific file.)
      require('includes/application_top.php');
      require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SAMPLE);
    // BOF: Added
    $_POST['email'] = preg_replace( "/n/", " ", $_POST['email'] );
    $_POST['name'] = preg_replace( "/n/", " ", $_POST['name'] );
    $_POST['email'] = preg_replace( "/r/", " ", $_POST['email'] );
    $_POST['name'] = preg_replace( "/r/", " ", $_POST['name'] );
    $_POST['email'] = str_replace("Content-Type:","",$_POST['email']);
    $_POST['name'] = str_replace("Content-Type:","",$_POST['name']);
    // EOF: Added
      $error = false;
      if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
        $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
        $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
        $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
    
     // BOF: Remove blank emails
    // if (tep_validate_email($email_address)) {
    // tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);
    // tep_redirect(tep_href_link(FILENAME_SAMPLE, 'action=success'));
    // } else {
    // $error = true;
    // $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
        if (! tep_validate_email($email_address)) {
            $error = true;
            $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
        }
        if ($enquiry == '') {
            $error = true;
            $messageStack->add('contact', ENTRY_EMAIL_CONTENT_CHECK_ERROR);
        }
        if ($error == false) {
          tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);
          tep_redirect(tep_href_link(FILENAME_SAMPLE, 'action=success'));
    // EOF: Remove blank emails
        }
      }
      $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SAMPLE));
      $content = CONTENT_CONTACT_US;
      include (bts_select('main', $content_template)); // BTSv1.5
      require(DIR_WS_INCLUDES . 'application_bottom.php');
    ?>

    catalog/templates/fallback/content/sample.php
    Code:
        <?php echo tep_draw_form('sample', tep_href_link(FILENAME_SAMPLE, 'action=send')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
              <tr>
                <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
                <td class="pageHeading" align="right"></td>
              </tr>
            </table></td>
          </tr>
    <tr>
    <td><HR></td>
    </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
    <?php
      if ($messageStack->size('contact') > 0) {
    ?>
          <tr>
            <td><?php echo $messageStack->output('contact'); ?></td>
          </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
    <?php
      }
      if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
    ?>
          <tr>
            <td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE, '0', '0', 'align="left"') . TEXT_SUCCESS; ?></td>
          </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
          <tr>
            <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                    <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
    <?php
      } else {
    ?>
          <tr>
            <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="pageHeading"><?php echo ENTRY_NAME; ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo tep_draw_input_field('name'); ?></td>
                  </tr>
                  <tr>
                    <td class="pageHeading"><?php echo ENTRY_EMAIL; ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo tep_draw_input_field('email'); ?></td>
                  </tr>
                  <tr>
                    <td class="pageHeading"><?php echo ENTRY_ENQUIRY; ?></td>
                  </tr>
                  <tr>
                    <td><?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15); ?></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
          <tr>
            <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                    <td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
                    <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
    <?php
      }
    ?>
        </table></form>
    catalog/includes/languages/english/sample.php

    Code:
    <?php
    /*
    $Id: contact_us.php 7 2006-06-22 02:48:30Z user $
      osCMax Power E-Commerce
      osCommerce Documentation by OSCdox :: osCommerce and osCMax documentation
      Copyright 2006 osCMax2005 osCMax, 2002 osCommerce
      Released under the GNU General Public License
    */
    define('HEADING_TITLE', 'Sample Request');
    define('NAVBAR_TITLE', 'Sample Request');
    define('TEXT_SUCCESS', 'Your Sample Request has been successfully sent to the Store Owner.');
    define('EMAIL_SUBJECT', 'Sample Request from ' . STORE_NAME);
    define('ENTRY_NAME', '<b>Receive a FREE Sample by filling out and submitting the form.</b>.<p>Form submission agrees to: <i>I agree to receive more information about promotions like this in the future</i> (You may opt out at any time) and <i>I agree to these Terms & Conditions</i>
    <P><b>Full Name:</b> *Required');
    define('ENTRY_EMAIL', '<b>E-Mail Address:</b> *Required');
    define('ENTRY_ENQUIRY', '<b>Please supply us with the following information so we may ship your sample:</b><ul><li><b>Salon Name</b> *Required<li><b>Full Shipping Address</b> Street, City, State, Zipcode *Required<li><b>Daytime telephone:</b> *Required<li><b>License #:</b> *Required for Professionals & Salon Owners</ul>');
    define('ENTRY_EMAIL_CONTENT_CHECK_ERROR', 'Missing content, please type a message.');
    ?>

  4. #4
    wkdwich
    Guest


    Default Re: request free sample method?

    nevermind I got it now.. I had to add
    define('CONTENT_SAMPLE', 'sample');

    to the filenames.php also

    and change the references in
    catalog\sample.php
    also to: CONTENT_SAMPLE
    Last edited by wkdwich; 08-01-2010 at 10:03 PM.

  5. #5
    osCMax Development Team

    request free sample method?

    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    4,137
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    ridexbuilder     $ 15.00
    Rep Power
    96


    Thumbs up Re: request free sample method?

    So, you'll be ready to package it up as a Project, then?

    Developers resource at bitbucket
    *** *** ***
    oscmax.co.uk / ejsolutions.co.uk
    Hosting plans with installation, configuration, contributions, support and maintenance.
    *** FREE osCmax hosting available ***
    oscmaxtemplates.com

  6. #6
    wkdwich
    Guest


    Default Re: request free sample method?

    yes as a matter of fact I will do that

  7. #7
    wkdwich
    Guest


    Default Re: request free sample method?

    I have bundled up my mess and posted it in the projects section here: http://www.oscmax.com/projects/free_...t_catalog_form

Similar Threads

  1. payment method depends on shipping method
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 11-25-2009, 08:00 AM
  2. MOD shipping method depends on payment method
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 11-25-2009, 08:00 AM
  3. payment method depends on shipping method
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 07-04-2009, 11:52 AM
  4. Creating a https request with the POST method
    By Anonymous in forum osCmax v1.7 Discussion
    Replies: 1
    Last Post: 07-19-2004, 08:11 AM
  5. Defining a payment method for a shipping method
    By Lynoure in forum osCommerce 2.2 Installation Help
    Replies: 0
    Last Post: 06-12-2003, 11:46 PM

Bookmarks

Bookmarks

Posting Permissions

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