I know I am going to sound like a pure moron with this question, but HOW do I perform the SQL Query? I know I have to go into my phpadmin, select my database, select sql.
I guess I am attempting to create these 2 tables?
CREATE TABLE `customers_to_discount_codes` (
`customers_id` int(11) NOT NULL default '0',
`discount_codes_id` int(11) NOT NULL default '0',
KEY `customers_id` (`customers_id`),
KEY `discount_codes_id` (`discount_codes_id`)
);
CREATE TABLE `discount_codes` (
`discount_codes_id` int(11) NOT NULL auto_increment,
`products_id` text,
`categories_id` text,
`manufacturers_id` text,
`excluded_products_id` text,
`customers_id` text,
`orders_total` tinyint(1) NOT NULL default '0',
`order_info` tinyint(1) NOT NULL default '0',
`exclude_specials` tinyint(1) NOT NULL default '0',
`discount_codes` varchar(8) NOT NULL default '',
`discount_values` varchar(8) NOT NULL default '',
`minimum_order_amount` decimal(15,4) NOT NULL default '0.0000',
`expires_date` date NOT NULL default '0000-00-00',
`number_of_orders` int(4) NOT NULL default '0',
`number_of_use` int(4) NOT NULL default '0',
`number_of_products` int(4) NOT NULL default '0',
`status` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`discount_codes_id`)
);
Now my question is what exactly are these? Do I need to do 2 seperate queries? I kinda like to know I am not going to destroy my database even though I took backups. I just don't want to get into the position of trying to fix something that I am not 100% sure I can fix.
Latest News: (loading..)
Newbie Question with Discount Code 3.1.1
Started by MTG Mania, Jul 28 2012 12:40 AM
discount coupon add on
3 replies to this topic
#1
Posted 28 July 2012 - 12:40 AM
#2 ONLINE
Posted 28 July 2012 - 12:50 AM
MTG Mania, on 28 July 2012 - 12:40 AM, said:
Now my question is what exactly are these? Do I need to do 2 seperate queries? I kinda like to know I am not going to destroy my database even though I took backups. I just don't want to get into the position of trying to fix something that I am not 100% sure I can fix.
Looks like you are working on the same add on I am.
You run those queries in php My Admin, which you should be able to access from the control panel on the web host where your site is. If you are not sure, contact your host support about how to get there.
I'd read a little about that before you do it. It's not that hard, but first time through, it's all new and unfamiliar.
Basically in your control panel you interact with your database with php my admin, in php my admin, there's a place to run queries. You paste that what you put above in the box there, click run and there you go.
But again, read up on the topic a bit first, it's a skill you'll use time and time again.
and always...backup like you said just in case.
good luck
I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.
I remember what it was like when I first started with osC. It can be overwhelming.
However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.
There are several good pros here on osCommerce. Look around, you'll figure out who they are.
I remember what it was like when I first started with osC. It can be overwhelming.
However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.
There are several good pros here on osCommerce. Look around, you'll figure out who they are.
#3
Posted 28 July 2012 - 01:48 AM
Ok, I have done everything step my step, but I am having a bit of trouble with the coding. I am putting it in exactly as it says in the readme, but it doesn't like this part of the code:
<?php
// Discount Code 3.1.1 - start
if (MODULE_ORDER_TOTAL_DISCOUNT_STATUS == 'true') {
?>
$(document).ready(function() {
var a = 0;
discount_code_process();
$('#discount_code').blur(function() { if (a == 0) discount_code_process(); a = 0 });
$("#discount_code").keypress(function(event) { if (event.which == 13) { event.preventDefault(); a = 1; discount_code_process() } });
function discount_code_process() { if ($("#discount_code").val() != "") { $("#discount_code").attr("readonly", "readonly"); $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_progress.gif'); ?>'); $.post("discount_code.php", { discount_code: $("#discount_code").val() }, function(data) { data == 1 ? $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_success.gif'); ?>') : $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_failed.gif'); ?>'); $("#discount_code").removeAttr("readonly") }); } }
});
<?php
}
// Discount Code 3.1.1 - end
?>
Here's MY coding from my php file:
function rowOutEffect(object) {
if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
//--></script>
<?php
// Discount Code 3.1.1 - start
if (MODULE_ORDER_TOTAL_DISCOUNT_STATUS == 'true') {
?>
$(document).ready(function() {
var a = 0;
discount_code_process();
$('#discount_code').blur(function() { if (a == 0) discount_code_process(); a = 0 });
$("#discount_code").keypress(function(event) { if (event.which == 13) { event.preventDefault(); a = 1; discount_code_process() } });
function discount_code_process() { if ($("#discount_code").val() != "") { $("#discount_code").attr("readonly", "readonly"); $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_progress.gif'); ?>'); $.post("discount_code.php", { discount_code: $("#discount_code").val() }, function(data) { data == 1 ? $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_success.gif'); ?>') : $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_failed.gif'); ?>'); $("#discount_code").removeAttr("readonly") }); } }
});
<?php
}
// Discount Code 3.1.1 - end
?>
<?php echo $payment_modules->javascript_validation(); ?>
<h1><?php echo HEADING_TITLE; ?></h1>
<?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true); ?>
<div class="contentContainer">
<?php
// Discount Code 3.1.1 - start
if (MODULE_ORDER_TOTAL_DISCOUNT_STATUS == 'true') {
?>
$(document).ready(function() {
var a = 0;
discount_code_process();
$('#discount_code').blur(function() { if (a == 0) discount_code_process(); a = 0 });
$("#discount_code").keypress(function(event) { if (event.which == 13) { event.preventDefault(); a = 1; discount_code_process() } });
function discount_code_process() { if ($("#discount_code").val() != "") { $("#discount_code").attr("readonly", "readonly"); $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_progress.gif'); ?>'); $.post("discount_code.php", { discount_code: $("#discount_code").val() }, function(data) { data == 1 ? $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_success.gif'); ?>') : $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_failed.gif'); ?>'); $("#discount_code").removeAttr("readonly") }); } }
});
<?php
}
// Discount Code 3.1.1 - end
?>
Here's MY coding from my php file:
function rowOutEffect(object) {
if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
//--></script>
<?php
// Discount Code 3.1.1 - start
if (MODULE_ORDER_TOTAL_DISCOUNT_STATUS == 'true') {
?>
$(document).ready(function() {
var a = 0;
discount_code_process();
$('#discount_code').blur(function() { if (a == 0) discount_code_process(); a = 0 });
$("#discount_code").keypress(function(event) { if (event.which == 13) { event.preventDefault(); a = 1; discount_code_process() } });
function discount_code_process() { if ($("#discount_code").val() != "") { $("#discount_code").attr("readonly", "readonly"); $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_progress.gif'); ?>'); $.post("discount_code.php", { discount_code: $("#discount_code").val() }, function(data) { data == 1 ? $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_success.gif'); ?>') : $("#discount_code_status").empty().append('<?php echo tep_image(DIR_WS_ICONS . 'dc_failed.gif'); ?>'); $("#discount_code").removeAttr("readonly") }); } }
});
<?php
}
// Discount Code 3.1.1 - end
?>
<?php echo $payment_modules->javascript_validation(); ?>
<h1><?php echo HEADING_TITLE; ?></h1>
<?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true); ?>
<div class="contentContainer">
#4
Posted 28 July 2012 - 01:49 AM
haha nevermind! lol I put the coding in the wrong spot. I iz an idjit. LOL









