
Originally Posted by
Ajeh
Did you use a generator for you new files for the request_catalog page?
Or did you make them yourself?
What files did you create?
What files, if any, did you edit or customize?
excuse the extremely late response:
I did not use a generator for the new files I simply copied the ones from the existing "Contact Us" page and modified them to try to make my own form. Alas I haven't been able to test it since I can't get over the first hurdle of publishing it.
The files I created/edited are as follows:
/includes/filenames.php
I edited this file to include:
Code:
define('FILENAME_CAT_REQ', 'cat_req');
Code:
define('FILENAME_DEFINE_CAT_REQ', 'define_cat_req');
/includes/languages/english.php
I edited the file to include:
Code:
define('BOX_INFORMATION_CAT_REQ', 'Request Catalog');
/includes/modules/sideboxes/information.php
I edited the file to include:
Code:
if (DEFINE_CAT_REQ_STATUS <= 1) {
$more_information[] = '<a href="' . zen_href_link(FILENAME_CAT_REQ) . '">' . BOX_INFORMATION_CAT_REQ . '</a>';
/includes/templates/template_default/templates/tpl_site_map_default.php
I edited the file to include:
Code:
<?php } ?>
<?php if (DEFINE_PAGE_1_STATUS <= '1') { ?>
<li><?php echo '<a href="' . zen_href_link(FILENAME_PAGE_1) . '">' . BOX_INFORMATION_PAGE_1 . '</a>'; ?></li>
/includes/languages/english/cat_req.php
I created the file cat_req.php to include this (copied the contact_us.php, renamed it and edited it):
Code:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: cat_req.php 1969 2005-09-13 06:57:21Z drbyte $
//
define('HEADING_TITLE', 'Request a Catalog');
define('NAVBAR_TITLE', 'Request Catalog');
define('TEXT_SUCCESS', 'Your request for a catalog has been successfully sent.');
define('EMAIL_SUBJECT', 'Message from ' . STORE_NAME);
define('ENTRY_NAME', 'Full Name:');
define('COMPANY_NAME', 'Company:');
define('COMPANY_ADDRESS', 'Company Address:');
define('CITY', 'City:');
define('STATE', 'State:');
define('ZIP_CODE', 'Zip-Code:');
define('SEND_TO_TEXT','Send Email To:');
define('ENTRY_EMAIL_NAME_CHECK_ERROR','Sorry, is your name correct? Our system requires a minimum of ' . ENTRY_FIRST_NAME_MIN_LENGTH . ' characters. Please try again.');
//define('ENTRY_EMAIL_CONTENT_CHECK_ERROR','Did you forget your message? We would like to hear from you. You can type your comments in the text area below.');
define('NOT_LOGGED_IN_TEXT', 'Not logged in');
// $Id: request_catalog.php 1969 2005-09-13 06:57:21Z drbyte $
?>
includes/languages/english/html_includes/define_cat_req.php
I created the above and it only includes a small snippet of code that I will change once its published
Code:
<p>Ask for your 96 Page Catalog!</p>
/includes/templates/template_default/templates/tpl_cat_req_default.php
I created the above and it includes (what I'm hoping is a working form, I've yet to find out):
PHP Code:
<?php
/**
* tpl_request_catalog_default.php
*
* @package templateSystem
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_cat_req_default.php 3464 2006-04-19 00:07:26Z ajeh $
*/
?>
<div class="centerColumn" id="contactUsDefault">
<h1 id="gvFaqDefaultHeading">
<?php echo HEADING_TITLE; ?>
</h1>
<div class="tie text2">
<div class="tie-indent">
<?php echo zen_draw_form('cat_req', zen_href_link(FILENAME_CAT_REQ, 'action=send')); ?>
<?php if (DEFINE_CAT_REQ_STATUS >= '1' and DEFINE_CAT_REQ_STATUS <= '2') { ?>
<div id="contactUsNoticeContent" class="content">
<?php
/**
* require html_define for the request_catalog page
*/
require($define_page);
?>
</div>
<?php } ?>
<?php if ($messageStack->size('contact') > 0) echo $messageStack->output('contact'); ?>
<fieldset id="contactUsForm">
<legend>
<?php echo HEADING_TITLE; ?>
</legend>
<div class="alert alignright">
<?php echo FORM_REQUIRED_INFORMATION; ?>
</div>
<label class="inputLabel" for="contactname">
<?php echo ENTRY_NAME. '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
</label>
<?php echo zen_draw_input_field('contactname', $name, ' size="40" id="contactname"') ; ?>
<br class="clearBoth" />
<label class="inputLabel" for="company-name">
<?php echo COMPANY_NAME . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
</label>
<?php echo zen_draw_input_field('company-name', ($company-name), ' size="40" id="company-name"'); ?>
<br class="clearBoth" />
<label class="inputLabel" for="company-address">
<?php echo COMPANY_ADDRESS . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
</label>
<?php echo zen_draw_input_field('company-address', ($company-address), ' size="40" id="company-address"'); ?>
<br class="clearBoth" />
<label class="inputLabel" for="city">
<?php echo CITY . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
</label>
<?php echo zen_draw_input_field('city', ($city), ' size="40" id="city"'); ?>
<br class="clearBoth" />
<label class="inputLabel" for="state">
<?php echo STATE . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
</label>
<?php echo zen_draw_input_field('state', ($state), ' size="40" id="state"'); ?>
<br class="clearBoth" />
<label class="inputLabel" for="zip-code">
<?php echo ZIP_CODE . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
</label>
<?php echo zen_draw_input_field('zip-code', ($zip-code), ' size="40" id="zip-code"'); ?>
<br class="clearBoth" />
</fieldset>
<div class="buttonRow forward">
<?php echo zen_image_submit(BUTTON_IMAGE_SEND, BUTTON_SEND_ALT); ?>
</div>
<div class="buttonRow back">
<?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?>
</div>
<?php
}
?>
</form>
<div class="clear"></div>
</div>
</div>
</div>
/includes/templates/MY_TEMPLATE/templates/tpl_cat_req_default.php
I did the same under my template to be safe ^^^
/includes/modules/pages/cat_req/
I created the above directory and added the following files...
/includes/modules/pages/cat_req/header_php.php
PHP Code:
<?php
/**
* Contact Us Page
*
* @package page
* @copyright Copyright 2003-2010 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: header_php.php 17608 2010-09-24 14:51:46Z drbyte $
*/
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/',
FILENAME_DEFINE_CAT_REQ, 'false');
$error = false;
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
$name = zen_db_prepare_input($_POST['contactname']);
$company-name = zen_db_prepare_input($_POST['company-name']);
$company-address = zen_db_prepare_input($_POST['company-address']);
$city = zen_db_prepare_input($_POST['city']);
$state = zen_db_prepare_input($_POST['state']);
$zip-code = zen_db_prepare_input($_POST['zip-code']);
//otherwise default to EMAIL_FROM and store name
$send_to_email = trim(EMAIL_FROM);
$send_to_name = trim(STORE_NAME);
}
// Prepare Text-only portion of message
$text_message = OFFICE_FROM . "\t" . $name . "\n" .
OFFICE_EMAIL . "\t" . $email_address . "\n\n" .
"Full Name:\n" . strip_tags($_POST['name']) . "\n" .
"Company Name:\n" . strip_tags($_POST['company-name']) . "\n" .
'------------------------------------------------------' . "\n\n" .
"Address:\n" . strip_tags($_POST['company-address']) . "\n" .
"City:\n" . strip_tags($_POST['city']) . "\n" .
"State:\n" . strip_tags($_POST['state']) . "\n" .
"Zip:\n" . strip_tags($_POST['zip-code']) . "\n" .
'------------------------------------------------------' . "\n\n" .
$extra_info['TEXT'];
// Prepare HTML-portion of message
//$html_msg['EMAIL_MESSAGE_HTML'] = strip_tags($_POST['enquiry']);
$html_msg['CONTACT_US_OFFICE_FROM'] = OFFICE_FROM . ' ' . $name . '<br />' . OFFICE_EMAIL . '(' . $email_address . ')';
$html_msg['EXTRA_INFO'] = $extra_info['HTML'];
// Send message
zen_mail($send_to_name, $send_to_email, 'Catalog Request', $text_message, $name, $email_address, $html_msg,'request_catalog');
zen_redirect(zen_href_link('request_catalog', 'action=success'));
} else {
$error = true;
if (empty($name)) {
$messageStack->add('contact', ENTRY_EMAIL_NAME_CHECK_ERROR);
}
if ($zc_validate_email == false) {
$messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}
if (empty($enquiry)) {
$messageStack->add('contact', ENTRY_EMAIL_CONTENT_CHECK_ERROR);
}
}
} // end action==send
// include template specific file name defines
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_CONTACT_US, 'false');
$breadcrumb->add(NAVBAR_TITLE);
?>
/includes/modules/pages/cat_req/on_load_main.js
Code:
if (document.cat_req){ if (document.cat_req.contactname) {document.cat_req.contactname.focus()} };
/admin/includes/languages/english.php
Added the line:
Code:
define('BOX_TOOLS_DEFINE_CAT_REQ','Request Catalog');
/admin/includes/languages/english/define_pages_editor.php
Added the line:
Code:
define('TEXT_INFO_CAT_REQ', 'Request Catalog');
I uploaded all the above files after I had created/edited them. I then logged into my admin panel and installed the SQL patch:
Code:
INSERT INTO `configuration` ( `configuration_title`, `configuration_key`, `configuration_value`,
`configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`,
`set_function`)
VALUES ('Define Request Catalog', 'DEFINE_Cat_REQ_STATUS', '1', 'Enable the Defined Request Catalog Link/Text?<br />0=
Link ON, Define Text OFF<br />1= Link ON, Define Text ON<br />2= Link OFF, Define Text ON<br />3= Link
OFF, Define Text OFF', 25, 100, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(''0'', ''1'', ''2'', ''3''),');
=====================
I believe that's it. I did that twice. The first time and the second time after the DrByte recommended I change the name from "request_catalog"
Thanks in advance for the help
-Adrian