Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

Also,

 

My admin panels freak out with the new catalog.php file so I had to restore the old one. What am I doing wrong?

 

Thanks.

 

 

Never mind. I only downloaded the patch. Duh!

Share this post


Link to post
Share on other sites

Ok, I got some help from my Customer support and they showed me how to do step 2 and update my PhP...but here is the problem I am having now.

 

The manual says to go to your Catalog>Discount Coupons...well I dont seem to have the Discount Coupon show up under this heading, or any heading for that matter.

 

I have installed it in the Modules>Order Total and given it a unique sort order. When I am in my SQL area and poking around in what is there, I can see the info that should be there as it has options to put in codes and dates, but ofcourse this cant be filled out in the SQL area.

 

What could I try to do to get this to show up in my Catalog?

 

I feel so close yet so far away as I have checked and double checked before posting here and must be missing something.

 

Thankyou Muchly

Share this post


Link to post
Share on other sites
Ok, I got some help from my Customer support and they showed me how to do step 2 and update my PhP...but here is the problem I am having now.

 

The manual says to go to your Catalog>Discount Coupons...well I dont seem to have the Discount Coupon show up under this heading, or any heading for that matter.

 

 

Make sure you have followed the steps to correctly install this in the admin section:

 

admin/includes/boxes/catalog.php ----------------------------------------------

 

line 29

replace

 

'<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>' );

 

with

 

//kgt - discount coupons

'<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.

'<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' );

//end kgt - discount coupons

 

 

admin/includes/database_tables.php --------------------------------------------

 

add

 

//kgt - discount coupons

define('TABLE_DISCOUNT_COUPONS', 'discount_coupons');

define('TABLE_DISCOUNT_COUPONS_TO_ORDERS', 'discount_coupons_to_orders');

//end kgt - discount coupons

 

 

admin/includes/filenames.php --------------------------------------------------

 

add

 

//kgt - discount coupons

define('FILENAME_DISCOUNT_COUPONS','coupons.php');

//end kgt - discount coupons

 

 

admin/includes/languages/english.php ------------------------------------------

 

add

 

//kgt - discount coupons

define('BOX_CATALOG_DISCOUNT_COUPONS', 'Discount Coupons');

//end kgt - discount coupons


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I'm trying to install this contrib but get this error from phpMyAdmin:

 

SQL query:

 

INSERT INTO `admin_files` ( `admin_files_id` , `admin_files_name` , `admin_files_is_boxes` , `admin_files_to_boxes` , `admin_groups_id` )

VALUES (

 

NULL , 'coupons.php', '0', '3', '1'

)

 

 

I think you're looking at the wrong support thread. This query has nothing to do with Discount Coupon Codes.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

KGT, if you would be so kind and help me with this little prob.

 

Installed, and seemed to edit fine, it shows in admin, but once i try to raise a coupon i get this error?

 

1136 - Column count doesn't match value count at row 1

 

insert into discount_coupons ( coupons_id, coupons_description, coupons_discount_percent, date_start, date_end, max_use, min_order) values ('DW22ZU', 'discounts', '.10', "2006-06-28", "2006-07-28", 1, 40, 0)

 

[TEP STOP]

 

Is this a database thing, or something within the file edits?

 

Cheers :thumbsup:

Edited by modulate

Share this post


Link to post
Share on other sites
I think you're looking at the wrong support thread. This query has nothing to do with Discount Coupon Codes.

It is the patch for Access with Level Account


Eddie Schnell

Custom PC Builder

If you dare, take my advice. But make sure you back up TWICE before.

Share this post


Link to post
Share on other sites
KGT, if you would be so kind and help me with this little prob.

 

Installed, and seemed to edit fine, it shows in admin, but once i try to raise a coupon i get this error?

 

1136 - Column count doesn't match value count at row 1

 

insert into discount_coupons ( coupons_id, coupons_description, coupons_discount_percent, date_start, date_end, max_use, min_order) values ('DW22ZU', 'discounts', '.10', "2006-06-28", "2006-07-28", 1, 40, 0)

 

[TEP STOP]

 

Is this a database thing, or something within the file edits?

 

Cheers :thumbsup:

 

in admin/coupons.php find this code

 

		tep_db_query($sql = "insert into " . TABLE_DISCOUNT_COUPONS . " (
				coupons_id,
				coupons_description,
				coupons_discount_percent,
				date_start,
				date_end,
				max_use,
				min_order)

 

Change to this

		tep_db_query($sql = "insert into " . TABLE_DISCOUNT_COUPONS . " (
				coupons_id,
				coupons_description,
				coupons_discount_percent,
				date_start,
				date_end,
				max_use,
				min_order,
				number_available)

 

The number available is missing from the indert command

 

Hope that helps

 

Regards

 

Mark


Regards

 

Mark A Reynolds

Share this post


Link to post
Share on other sites

Hi. Congratulations to this great contibution.

 

I tried to install but in the checkout_shipping appears this follow message:

 

Parse error: parse error, unexpected T_DOUBLE_ARROW in /home/restricted/home/indvd/public_html/loja/includes/classes/order.php on line 166

 

Could you help me?

 

Other question: is it possible to give some coupons differents to some customers?

 

Thanks

Share this post


Link to post
Share on other sites
Parse error: parse error, unexpected T_DOUBLE_ARROW in /home/restricted/home/indvd/public_html/loja/includes/classes/order.php on line 166

 

You'll the to post the code from includes/classes/order.php on line 166. Include a few lines before and a few lines after.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

Hi, I've tried installing this twice. I can create the coupons just fine, but the problem is that I'm not seeing it anywhere to put the code in. It will NOT show up on the confirmation page. I added this code here, as I saw this solution in the early part of this thread.... but that didn't work either.

 

if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
 if (tep_not_null($HTTP_POST_VARS['coupon'])) {
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
 }
 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

 

Now if I hit back, it goes to an unsecured part, checkout payment.php which I think I bypass entirely as I'm using the Fast Easy Check out contribution (another problem I need to solve but that's something else here). When a person checks out on my site, it goes to create_account3.php, then ... checkout_shipping.php, then to checkout_confirmation.php

 

Is there a way to add it to the checkout_shipping.php perhaps? I love this contribution and it was exactly what I was looking for but just can't get it to show up! Thank you.

 

Or in my create_account3.php?

 

here is the code in case anyone can help me here.

 

<?php

/*

$Id: create+account3.php,v 2.00 2004/01/05 23:28:24 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright (c) 2003 osCommerce

 

Released under the GNU General Public License

*/

$show_account_box = 0;

//IF you want to give the option to create an account with random password choose to 0 if not

$create_password =1;// set to 1 to create an account with random password

$show_login=0;// set to 1 to show login box

////////////////////////////////////////////////

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . 'create_account.php');

require(DIR_WS_LANGUAGES . $language . '/' . 'fast_account.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);

// if we have been here before and are coming back get rid of the credit covers variable

if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers'); //rmh M-S_ccgv

//line 21-23 sends the customer ti index.php if he is logedin

if ((tep_session_is_registered('customer_id'))&&(tep_session_is_registered('createaccount'))) { tep_redirect(tep_href_link('account_password_new.php', '', 'SSL'));

}

 

if (tep_session_is_registered('customer_id')) {

tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'SSL'));

}

 

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)

if ($session_started == false) {

tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));

}

$error = false;

if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {

if (ACCOUNT_GENDER == 'false') {

if (isset($HTTP_POST_VARS['gender'])) {

$gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);

} else {

$gender = false;

}

}

//START REGISTRATION CODE

$createaccount='N';

//next two lines gives you a temporary fixed password you can change to what you like

$password = tep_create_random_value(15);

$confirmation = $password;

//start type one create assount

 

if ($create_password == 1) {

$createaccount = tep_db_prepare_input($HTTP_POST_VARS['createaccount']);

if ($createaccount!='Y')$createaccount='N';

}

//start type two create account

if ($show_account_box == 1) {

$createaccount = tep_db_prepare_input($HTTP_POST_VARS['createaccount']);

if ($createaccount=='Y') {

$password = tep_db_prepare_input($HTTP_POST_VARS['password']);

$confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']);

 

}

}

 

$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);

$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);

if (ACCOUNT_DOB == 'false') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);

$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);

if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']);

$street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);

 

if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);

$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);

$city = tep_db_prepare_input($HTTP_POST_VARS['City']);

if (ACCOUNT_STATE == 'true') {

$state = tep_db_prepare_input($HTTP_POST_VARS['state']);

if (isset($HTTP_POST_VARS['zone_id'])) {

$zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);

} else {

$zone_id = false;

}

}

$country = tep_db_prepare_input($HTTP_POST_VARS['country']);

 

$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);

$fax = tep_db_prepare_input($HTTP_POST_VARS['fax']);

 

if (isset($HTTP_POST_VARS['newsletter'])) {

$newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']);

} else {

$newsletter = false;

}

 

 

$error = false;

if (ACCOUNT_GENDER == 'false') {

if ( ($gender != 'm') && ($gender != 'f') ) {

$error = false;

 

$messageStack->add('create_account', ENTRY_GENDER_ERROR);

}

}

 

if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);

}

 

if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);

}

//rmh M-S_addr-enhancer begin

if (ACCOUNT_DOB == 'true' && REQUIRE_DOB == 'true') {

if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) {

$error = true;

 

$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);

}

}

//rmh M-S_addr-enhancer end

if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);

} elseif (tep_validate_email($email_address) == false) {

$error = true;

 

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);

} else {

$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");

$check_email = tep_db_fetch_array($check_email_query);

 

/* if ($check_email['total'] > 0) {

$error = true;

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);

}*/

if ($check_email['total'] > 0)

{ //PWA delete account

$get_customer_info = tep_db_query("select customers_id, customers_email_address, createaccount from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");

$customer_info = tep_db_fetch_array($get_customer_info);

$customer_id = $customer_info['customers_id'];

$customer_email_address = $customer_info['customers_email_address'];

$customer_pwa = $customer_info['createaccount'];

if ($customer_pwa =='Y')

{

$error = true;

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);

} else {

// here i am adding another line just incase they change to an account immediatly i do not know if it is necessary or not

if (tep_session_is_registered('registered_now')) tep_session_unregister('registered_now');

if (tep_session_is_registered('createaccount')) tep_session_unregister('createaccount');

tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'");

tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");

tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customer_id . "'");

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "'");

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $customer_id . "'");

tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . $customer_id . "'");

}

}

// END

}

if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);

}

 

if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_POST_CODE_ERROR);

}

 

if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_CITY_ERROR);

}

 

if (is_numeric($country) == false) {

$error = true;

 

$messageStack->add('create_account', ENTRY_COUNTRY_ERROR);

}

 

if (ACCOUNT_STATE == 'true') {

$zone_id = 0;

$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");

$check = tep_db_fetch_array($check_query);

$entry_state_has_zones = ($check['total'] > 0);

if ($entry_state_has_zones == true) {

$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");

if (tep_db_num_rows($zone_query) == 1) {

$zone = tep_db_fetch_array($zone_query);

$zone_id = $zone['zone_id'];

} else {

$error = true;

 

$messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);

}

} else {

if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_STATE_ERROR);

}

}

}

 

if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);

}

if ($error == false) {

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'createaccount' => $createaccount,

'customers_newsletter' => $newsletter,

'confirmation_key' => $confirmation,

'customers_password' => tep_encrypt_password($password));

 

if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;

if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);

 

tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

 

$customer_id = tep_db_insert_id();

 

$sql_data_array = array('customers_id' => $customer_id,

'entry_firstname' => $firstname,

'entry_lastname' => $lastname,

'entry_street_address' => $street_address,

'entry_postcode' => $postcode,

'entry_city' => $city,

'entry_country_id' => $country);

 

if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;

if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;

if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;

if (ACCOUNT_STATE == 'true') {

if ($zone_id > 0) {

$sql_data_array['entry_zone_id'] = $zone_id;

$sql_data_array['entry_state'] = '';

} else {

$sql_data_array['entry_zone_id'] = '0';

$sql_data_array['entry_state'] = $state;

}

}

 

tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

$address_id = tep_db_insert_id();

 

tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

 

tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");

 

if (SESSION_RECREATE == 'True') {

tep_session_recreate();

}

 

$customer_first_name = $firstname;

$customer_default_address_id = $address_id;

$customer_country_id = $country;

$customer_zone_id = $zone_id;

tep_session_register('customer_id');

tep_session_register('customer_first_name');

tep_session_register('customer_default_address_id');

tep_session_register('customer_country_id');

tep_session_register('customer_zone_id');

 

$registered_now=1;

tep_session_register('registered_now');

if ($createaccount == 'N') tep_session_register('createaccount');

 

$shipping_address_query = tep_db_query("select address_book_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "'");

$shipping_address = tep_db_fetch_array($shipping_address_query);

$billto = $shipping_address['address_book_id'];

$sendto = $shipping_address['address_book_id'];

tep_session_register('billto');

tep_session_register('sendto');

$billto = $shipping_address['address_book_id'];

$sendto = $shipping_address['address_book_id'];

// restore cart contents

$cart->restore_contents();

 

//END REGISTRATION CODE

 

 

 

//START DIFFERENT SHIPPING CODE

 

if (tep_not_null($HTTP_POST_VARS['ShipFirstName']) && tep_not_null($HTTP_POST_VARS['ShipLastName']) && tep_not_null($HTTP_POST_VARS['ShipAddress'])) {

$process = true;

 

$firstname = tep_db_prepare_input($HTTP_POST_VARS['ShipFirstName']);

$lastname = tep_db_prepare_input($HTTP_POST_VARS['ShipLastName']);

$street_address = tep_db_prepare_input($HTTP_POST_VARS['ShipAddress']);

if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['shipsuburb']);

$postcode = tep_db_prepare_input($HTTP_POST_VARS['shippostcode']);

$city = tep_db_prepare_input($HTTP_POST_VARS['ShipCity']);

$suburb = tep_db_prepare_input($HTTP_POST_VARS['shipsuburb']);

$country = tep_db_prepare_input($HTTP_POST_VARS['shipcountry']);

if (ACCOUNT_STATE == 'true') {

if (isset($HTTP_POST_VARS['zone_id'])) {

$zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);

} else {

$zone_id = false;

}

$state = tep_db_prepare_input($HTTP_POST_VARS['shippingstate']);

}

 

if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {

$error = true;

 

$messageStack->add('checkout_address', ENTRY_FIRST_NAME_ERROR);

}

 

if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {

$error = true;

 

$messageStack->add('checkout_address', ENTRY_LAST_NAME_ERROR);

}

 

if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {

$error = true;

 

$messageStack->add('checkout_address', ENTRY_STREET_ADDRESS_ERROR);

}

 

if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {

$error = true;

 

$messageStack->add('checkout_address', ENTRY_POST_CODE_ERROR);

}

 

if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {

$error = true;

 

$messageStack->add('checkout_address', ENTRY_CITY_ERROR);

}

 

if (ACCOUNT_STATE == 'true') {

$zone_id = 0;

$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");

$check = tep_db_fetch_array($check_query);

$entry_state_has_zones = ($check['total'] > 0);

if ($entry_state_has_zones == true) {

$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");

if (tep_db_num_rows($zone_query) == 1) {

$zone = tep_db_fetch_array($zone_query);

$zone_id = $zone['zone_id'];

} else {

$error = true;

 

$messageStack->add('checkout_address', ENTRY_STATE_ERROR_SELECT);

}

} else {

if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {

$error = true;

 

$messageStack->add('checkout_address', ENTRY_STATE_ERROR);

}

}

}

 

if ( (is_numeric($country) == false) || ($country < 1) ) {

$error = true;

 

$messageStack->add('checkout_address', ENTRY_COUNTRY_ERROR);

}

$error = false;

if ($error == false) {

$sql_data_array = array('customers_id' => $customer_id,

 

'entry_firstname' => $firstname,

'entry_lastname' => $lastname,

'entry_street_address' => $street_address,

'entry_postcode' => $postcode,

'entry_city' => $city,

'entry_country_id' => $country);

 

if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;

if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;

if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;

if (ACCOUNT_STATE == 'true') {

if ($zone_id > 0) {

$sql_data_array['entry_zone_id'] = $zone_id;

$sql_data_array['entry_state'] = '';

} else {

$sql_data_array['entry_zone_id'] = '0';

$sql_data_array['entry_state'] = $state;

}

}

 

tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

 

$address_id = tep_db_insert_id();

$sendto =$address_id;

tep_session_unregister('sendto');

;

tep_session_register('sendto');

 

$sendto = tep_db_insert_id();

 

}

}

//END DIFFERENT SHIPPING CODE

 

 

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING));

}

}

if ($error == true) {

// $messageStack->add('create_account', TEXT_CREATE_ACCOUNT_ERROR);

}

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));

 

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

<script src="global.js"type=text/javascript></SCRIPT>

<?php require('includes/form_check.js.php'); ?>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="3" rightmargin="3" >

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

<? include("mymenu.php") ?>

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3" align="center">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><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_TITLES; ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_login.gif', HEADING_TITLES, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

 

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><?php if ($show_login ==1) { require('login_box.php');}else{echo PRIMARY_ADDRESS_DESCRIPTION; } ?></td>

</tr>

 

<tr>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

 

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo tep_draw_form('checkout', tep_href_link('create_account3.php', '', 'SSL'), 'post','onSubmit="return check_form(checkout);"') . tep_draw_hidden_field('action', 'process'); ?><b><?php //echo TITLE_FORM; ?></b></td>

</tr>

</table></td>

</tr>

 

<tr>

<td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo TITLE_PAYMENT_ADDRESS; ?></b></td>

<td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td>

</tr>

<?php

if ($messageStack->size('create_account') > 0) {

?>

<tr>

<td><?php echo $messageStack->output('create_account'); ?></td>

</tr>

<?php

}

?>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" cellspacing="2" cellpadding="2" align="right">

<tr>

<td class = "infoBoxContents"><?php echo PAYMENT_SHIPMENT; ?></td>

<td class = "infoBoxContents"><input type="image" src="images/collapse_tcat.gif" name="row" value="1" onclick="return toggle_collapse('forumbit_1')"></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

 

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" cellspacing="2" cellpadding="2">

<tr><?php

if (ACCOUNT_GENDER == 'true') {

?>

<tr>

<td class="infoBoxContents"><?php echo ENTRY_GENDER; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_radio_field('gender', 'm') . ' ' . MALE . ' ' . tep_draw_radio_field('gender', 'f') . ' ' . FEMALE . ' ' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>

</tr> </tr>

<?php

}

?>

<td class="infoBoxContents"><?php echo ENTRY_FIRST_NAME; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_input_field('firstname','','') . ' ' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>

</tr> <tr>

<td class="infoBoxContents"><?php echo ENTRY_LAST_NAME; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_input_field('lastname','','') . ' ' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>

<?php

if (ACCOUNT_DOB == 'true') {

?>

</tr> <tr>

<td class="infoBoxContents"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_input_field('dob') . ' ' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td>

 

<?php

}

?>

</tr><tr>

<td class="infoBoxContents"><?php echo ENTRY_COMPANY; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_input_field('company') . ' ' . (tep_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>

</tr> <tr>

<td class="infoBoxContents"><?php echo ENTRY_STREET_ADDRESS; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_input_field('street_address','','') . ' ' . (tep_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?></td>

 

</tr><tr>

<td class="infoBoxContents"><?php echo ENTRY_POST_CODE; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_input_field('postcode') . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>

</tr>

<?php

if (ACCOUNT_SUBURB == 'true') {

?>

<tr>

<td class="infoBoxContents"><?php echo ENTRY_SUBURB; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_input_field('suburb') . ' ' . (tep_not_null(ENTRY_SUBURB_TEXT) ? '<span class="inputRequirement">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?></td>

</tr>

<?php

}

?> <tr>

<td class="infoBoxContents"><?php echo ENTRY_CITY; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_input_field('City') . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>

</tr>

<?php

 

if (ACCOUNT_STATE == 'true') {

?>

<tr>

<td class="infoBoxContents"><?php echo ENTRY_STATE; ?></td>

<td class="infoBoxContents">

<?php

if ($HTTP_POST_VARS['action'] == 'process') {

if ($entry_state_has_zones == true) {

$zones_array = array();

$zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");

while ($zones_values = tep_db_fetch_array($zones_query)) {

$zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);

}

echo tep_draw_pull_down_menu('state', $zones_array);

} else {

echo tep_draw_input_field('state');

}

} else {

echo tep_draw_input_field('state');

}

 

if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;

?>

</td>

</tr>

<?php

}

?>

<tr>

<td class="infoBoxContents"><?php echo ENTRY_COUNTRY; ?></td>

<td class="infoBoxContents"><?php echo tep_get_country_list('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>

</tr><tr>

 

<td class="infoBoxContents"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_input_field('telephone','','') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>

</tr><tr>

<td class="infoBoxContents"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>

<td class="infoBoxContents"><?php echo tep_draw_input_field('email_address') . ' ' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>

</tr>

<tr>

<td class="main"><?php echo ENTRY_NEWSLETTER; ?></td>

<td class="main"><?php echo tep_draw_checkbox_field('newsletter', '1') . ' ' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': '');?></td>

</tr>

<?php

 

if ($create_password == 1) {

?>

<tr>

<td class="main"><?php echo YES_ACCOUNT; ?></td>

<td class="main"><?php echo tep_draw_checkbox_field('createaccount', 'Y') . ' ' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': '');?></td>

</tr>

<?php

}

?>

</table></td>

</tr>

</table></td>

</tr>

 

 

 

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2">

<TBODY id=collapseobj_forumbit_1>

<TD class=alt2 noWrap>

<table border="0" width="100%" cellspacing="1" cellpadding="2">

<TBODY>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo TITLE_SHIPPING_ADDRESS; ?></b></td>

</tr>

</table></td>

</tr>

 

 &

Share this post


Link to post
Share on other sites

Hi KGT,

 

You have been a great help. I guess step 1A could have been step 4. I installed what you mentioned, but I also noted back in the install that that there was more to the list, do I need to install that as well? The reason I am asking is because now when I go into my commerce pannel I get this at the top.

 

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /mnt/w0201/d29/s37/b0282505/www/Products/nfoscomm/catalog/admin/includes/filenames.php:57) in /mnt/w0201/d29/s37/b0282505/www/Products/nfoscomm/catalog/admin/includes/functions/sessions.php on line 67

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /mnt/w0201/d29/s37/b0282505/www/Products/nfoscomm/catalog/admin/includes/filenames.php:57) in /mnt/w0201/d29/s37/b0282505/www/Products/nfoscomm/catalog/admin/includes/functions/sessions.php on line 67

 

I went to that file and line and this is what is on line 67 (assuming I counted right)

 

return session_start();

 

Thanks for the help!

Share this post


Link to post
Share on other sites

Hi.

Congratulations to this great contibution. :D

 

I have a small question...

 

 

can we have amount and not % for a coupon?

 

Like if I want to give 5$ to one of my costumer?

 

Thanks!

Edited by Nathalienature

Share this post


Link to post
Share on other sites

First of all, I want to thank kgt for making this Contribution. It is very helpful for my buisness needs. :)

 

This thread has been VERY helpful to me so far (ive run into several problems but found the solution through this thread) so I hope you guys can help with with 1 last one.

 

I have gotten all the way to the point where I have successfully created my first coupon. The problem is, when I go to my store and add an item to my cart, then goto 'Checkout' I get this error message:

 

1146 - Table 'triton.TABLE_DISCOUNT_COUPONS' doesn't exist

select * from TABLE_DISCOUNT_COUPONS where coupons_id = 'TESTCOUPON'

[TEP STOP]

 

Any ideas what I can do?

 

Thanks!

 

-Andrew

Share this post


Link to post
Share on other sites
You'll the to post the code from includes/classes/order.php on line 166. Include a few lines before and a few lines after.

 

 

$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,

'currency' => $currency,

'currency_value' => $currencies->currencies[$currency]['value'],

'payment_method' => $payment,

'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),

'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),

'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),

'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),

'shipping_method' => $shipping['title'],

'shipping_cost' => $shipping['cost'],

'subtotal' => 0,

'tax' => 0,

'tax_groups' => array(),

'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : ''));

 

//kgt - discount coupons

'coupon' => (isset($GLOBALS['coupon']) ? $GLOBALS['coupon'] : ''), <<Line 166<<

'applied_discount' => array(),

//end kgt - discount coupons

 

if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {

$this->info['payment_method'] = $GLOBALS[$payment]->title;

 

if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) {

$this->info['order_status'] = $GLOBALS[$payment]->order_status;

}

}

Edited by rdbello

Share this post


Link to post
Share on other sites
I have gotten all the way to the point where I have successfully created my first coupon. The problem is, when I go to my store and add an item to my cart, then goto 'Checkout' I get this error message:

 

1146 - Table 'triton.TABLE_DISCOUNT_COUPONS' doesn't exist

select * from TABLE_DISCOUNT_COUPONS where coupons_id = 'TESTCOUPON'

[TEP STOP]

 

 

Think you missed editing includes/database_tables.php:

 

//kgt - discount coupons

define('TABLE_DISCOUNT_COUPONS', 'discount_coupons');

define('TABLE_DISCOUNT_COUPONS_TO_ORDERS', 'discount_coupons_to_orders');

//end kgt - discount coupons

 

You need to add this code somewhere in that file.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,

'currency' => $currency,

'currency_value' => $currencies->currencies[$currency]['value'],

'payment_method' => $payment,

'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),

'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),

'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),

'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),

'shipping_method' => $shipping['title'],

'shipping_cost' => $shipping['cost'],

'subtotal' => 0,

'tax' => 0,

'tax_groups' => array(),

'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : ''));

 

//kgt - discount coupons

'coupon' => (isset($GLOBALS['coupon']) ? $GLOBALS['coupon'] : ''), <<Line 166<<

'applied_discount' => array(),

//end kgt - discount coupons

 

if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {

$this->info['payment_method'] = $GLOBALS[$payment]->title;

 

if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) {

$this->info['order_status'] = $GLOBALS[$payment]->order_status;

}

}

 

 

Move these lines:

 

//kgt - discount coupons
'coupon' => (isset($GLOBALS['coupon']) ? $GLOBALS['coupon'] : ''), <<Line 166<<
'applied_discount' => array(),
//end kgt - discount coupons

 

BEFORE:

 

'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : ''));


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
You have been a great help. I guess step 1A could have been step 4. I installed what you mentioned, but I also noted back in the install that that there was more to the list, do I need to install that as well? The reason I am asking is because now when I go into my commerce pannel I get this at the top.

 

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /mnt/w0201/d29/s37/b0282505/www/Products/nfoscomm/catalog/admin/includes/filenames.php:57) in /mnt/w0201/d29/s37/b0282505/www/Products/nfoscomm/catalog/admin/includes/functions/sessions.php on line 67

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /mnt/w0201/d29/s37/b0282505/www/Products/nfoscomm/catalog/admin/includes/filenames.php:57) in /mnt/w0201/d29/s37/b0282505/www/Products/nfoscomm/catalog/admin/includes/functions/sessions.php on line 67

 

 

Not sure what you mean about the steps. Perhaps you didn't understand about the new files? The new files listed in step 1 of the instructions aren't in step 1A because these are completely new files and need to be FTPed to the corresponding location on your site. So that would be why the number of files is different in step 1 vs step 1A.

 

If uploading those files doesn't fix your problem, then you will need to post the code you have in admin/includes/filenames.php on line 67. That's the important file to see when you get an error like this.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hi, I've tried installing this twice. I can create the coupons just fine, but the problem is that I'm not seeing it anywhere to put the code in. It will NOT show up on the confirmation page. I added this code here, as I saw this solution in the early part of this thread.... but that didn't work either.

 

if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
 if (tep_not_null($HTTP_POST_VARS['coupon'])) {
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
 }
 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

 

Now if I hit back, it goes to an unsecured part, checkout payment.php which I think I bypass entirely as I'm using the Fast Easy Check out contribution (another problem I need to solve but that's something else here). When a person checks out on my site, it goes to create_account3.php, then ... checkout_shipping.php, then to checkout_confirmation.php

 

Is there a way to add it to the checkout_shipping.php perhaps? I love this contribution and it was exactly what I was looking for but just can't get it to show up! Thank you.

 

Or in my create_account3.php?

 

here is the code in case anyone can help me here.

 

 

As long as you still go directly from checkout_shipping.php to checkout_confirmation.php, you just need to add the code from checkout_payment.php into checkout_shipping.php. The code from checkout_payment.php just displays the form field for entering the code.

 

Then change the code from checkout_confirmation to go back to the shipping page if there's an error:

 

if( count( $error_message ) > 0 ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $error_message ) ), 'SSL' ) ); //if there was an error, redirect to the payment page

 

Change to:

 

if( count( $error_message ) > 0 ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( implode( ' ', $error_message ) ), 'SSL' ) ); //if there was an error, redirect to the payment page

 

This isn't tested, so be sure to back up.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

Hi KGT,

 

The problem is gone. I'have some doubts, could you answer me, please?

 

- The date format is mm/dd/yyyy?

 

- Could I create coupons to speficific customers?

 

- How many coupons can I create?

 

Thank you very much

Share this post


Link to post
Share on other sites
Hi KGT,

 

The problem is gone. I'have some doubts, could you answer me, please?

 

- The date format is mm/dd/yyyy?

 

- Could I create coupons to speficific customers?

 

- How many coupons can I create?

 

Thank you very much

 

 

If you have the latest version, you need to make sure you enter dates in the format laid out in includes/languages/english.php (or french.php or whatever). If you don't have the latest, then you will need it to have the dates in another format.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
If you have the latest version, you need to make sure you enter dates in the format laid out in includes/languages/english.php (or french.php or whatever). If you don't have the latest, then you will need it to have the dates in another format.

 

 

Thanks.

 

And about the coupom code? where's after I'll create it? I leave the first field in blank* e wrote some description. In the manager page, only appears my description.

 

* Obs. I can not to write anithing in the fisrt play. It's normal?

 

Thanks again.

Edited by rdbello

Share this post


Link to post
Share on other sites
Thanks.

 

And about the coupom code? where's after I'll create it? I leave the first field in blank e wrote some description. In the manager page, only appears my description.

 

Thanks again.

 

 

If you upgraded to version 1.2 at any point, then you must uninstall and reinstall the module in you admin section at Modules > Order Total. Otherwise, I don't know. I'd need more information.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
If you upgraded to version 1.2 at any point, then you must uninstall and reinstall the module in you admin section at Modules > Order Total. Otherwise, I don't know. I'd need more information.

 

I get 2 pictures to show you my problem. Please, click the link

 

Screens of problems

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×