Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Newbie Question with Discount Code 3.1.1


MTG Mania

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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">

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...