Jump to content



Latest News: (loading..)

Help for installing discount code


  • Please log in to reply
17 replies to this topic

#1   krys

krys
  • Members
  • 18 posts
  • Real Name:Krystal

Posted 11 June 2011 - 01:46 AM

Hi Everyone :)

I'm new and I'm trying to install the discount module to my oscommerce site. I have the latest version.

I'm trying to follow the instructions in the readme file and I ran the SQL query and it was fine,

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`)
);

Then I wasn't sure if the second part was also supposed to go in that same window, but when I pasted this- I get the following error
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE `discount_codes` ( `discount_codes_id` int(11) NOT NULL auto_inc' at line 7

Can anyone help? Have I put it in the wrong spot? I'm so new to this and only just learning. Thanks :)

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',
  `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`)
);

#2   geoffreywalton

geoffreywalton

    Contact me for Support

  • Community Sponsor
  • 8,036 posts
  • Real Name:Geoffrey Walton
  • Gender:Male
  • Location:Norfolk, UK (close to the centre of the universe)

Posted 11 June 2011 - 08:32 AM

Try deleting the line breaks and remove the "tic" single quotes

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',  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 ) );

Have not tested it but .....

HTH

G
Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.

#3   JLewis

JLewis
  • Members
  • 84 posts
  • Real Name:John Lewis
  • Gender:Male
  • Location:Chesterfield

Posted 11 June 2011 - 08:40 AM

Have just tried both SQL queries and they work, using MYSQL 5.0.92.

Edit: geoffreywalton query also works

Edited by JLewis, 11 June 2011 - 08:43 AM.

Driving Lorry £500.00 per week – Website design £0.00 per week – Website Sales £0.00 per week – Continuing to learn html & css Priceless

#4   krys

krys
  • Members
  • 18 posts
  • Real Name:Krystal

Posted 11 June 2011 - 08:45 AM

Hey guys! Thanks for your replies

I realised that all I was missing was the ;

silly me!!

Anyway I'm up to this step and Ive found the checkout_payment php file and it says the following to do but I can't FIND the file ...do I just pase all of the code in there?
6. Modify the catalog/checkout_payment.php file.
Find:

<?php
    $radio_buttons++;
  }
?>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>

Add after:

<?php
  // Discount Code 2.9 - start
  if (MODULE_ORDER_TOTAL_DISCOUNT_STATUS == 'true') {
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><b><?php echo TEXT_DISCOUNT_CODE; ?></b></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" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td class="main"><?php echo tep_draw_input_field('discount_code', $sess_discount_code, 'size="10"'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }
  // Discount Code 2.9 - end
?>

#5   JLewis

JLewis
  • Members
  • 84 posts
  • Real Name:John Lewis
  • Gender:Male
  • Location:Chesterfield

Posted 11 June 2011 - 08:53 AM

Find

<?php
$radio_buttons++;
}
?>

Add after:

<?php
// Discount Code 2.9 - start
if (MODULE_ORDER_TOTAL_DISCOUNT_STATUS == 'true') {
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><b><?php echo TEXT_DISCOUNT_CODE; ?></b></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" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><?php echo tep_draw_input_field('discount_code', $sess_discount_code, 'size="10"'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
// Discount Code 2.9 - end
?>

Edited by JLewis, 11 June 2011 - 08:53 AM.

Driving Lorry £500.00 per week – Website design £0.00 per week – Website Sales £0.00 per week – Continuing to learn html & css Priceless

#6   krys

krys
  • Members
  • 18 posts
  • Real Name:Krystal

Posted 11 June 2011 - 08:59 AM

Thanks..but can't find the code?

THis is all thats in there
<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright © 2002 osCommerce

  Released under the GNU General Public License
*/

define('NAVBAR_TITLE_1', 'Checkout');
define('NAVBAR_TITLE_2', 'Payment Method');

define('HEADING_TITLE', 'Payment Information');

define('TABLE_HEADING_BILLING_ADDRESS', 'Billing Address');
define('TEXT_SELECTED_BILLING_DESTINATION', 'Please choose from your address book where you would like the invoice to be sent to.');
define('TITLE_BILLING_ADDRESS', 'Billing Address:');

define('TABLE_HEADING_PAYMENT_METHOD', 'Payment Method');
define('TEXT_SELECT_PAYMENT_METHOD', 'Please select the preferred payment method to use on this order.');
define('TITLE_PLEASE_SELECT', 'Please Select');
define('TEXT_ENTER_PAYMENT_INFORMATION', 'This is currently the only payment method available to use on this order.');

define('TABLE_HEADING_COMMENTS', 'Add Comments About Your Order');

define('TITLE_CONTINUE_CHECKOUT_PROCEDURE', 'Continue Checkout Procedure');
define('TEXT_CONTINUE_CHECKOUT_PROCEDURE', 'to confirm this order.');

#7   JLewis

JLewis
  • Members
  • 84 posts
  • Real Name:John Lewis
  • Gender:Male
  • Location:Chesterfield

Posted 11 June 2011 - 09:05 AM

your in the wrong file, that is the languages folder

you need to find checkout_payment.php in the root directory or if you have your shop in a folder the look in there.
Driving Lorry £500.00 per week – Website design £0.00 per week – Website Sales £0.00 per week – Continuing to learn html & css Priceless

#8   krys

krys
  • Members
  • 18 posts
  • Real Name:Krystal

Posted 11 June 2011 - 09:38 AM

Thanks JL.. its always something simple yet stumps me!

I just got through all the steps..went to log into my oscommerce site to add the module and got this... cant even log in!

define('FILENAME_DISCOUNT_CODES', 'discount_codes.php'); // Discount Code 2.9 // Discount Code 2.9 - start define('TABLE_CUSTOMERS_TO_DISCOUNT_CODES', 'customers_to_discount_codes'); define('TABLE_DISCOUNT_CODES', 'discount_codes'); // Discount Code 2.9 - end
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/flishclo/public_html/admin/includes/filenames.php:57) in /home/flishclo/public_html/admin/includes/functions/sessions.php on line 102

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/flishclo/public_html/admin/includes/filenames.php:57) in /home/flishclo/public_html/admin/includes/functions/sessions.php on line 102

Warning: Cannot modify header information - headers already sent by (output started at /home/flishclo/public_html/admin/includes/filenames.php:57) in /home/flishclo/public_html/admin/includes/functions/general.php on line 34

#9   JLewis

JLewis
  • Members
  • 84 posts
  • Real Name:John Lewis
  • Gender:Male
  • Location:Chesterfield

Posted 11 June 2011 - 09:56 AM

define('FILENAME_DISCOUNT_CODES', 'discount_codes.php');

look in discount module instructions about adding 'discount_codes.php' to file 'filenames.php'

read instructions again and see if you have missed anything else.
Driving Lorry £500.00 per week – Website design £0.00 per week – Website Sales £0.00 per week – Continuing to learn html & css Priceless

#10   krys

krys
  • Members
  • 18 posts
  • Real Name:Krystal

Posted 11 June 2011 - 10:57 AM

Slowly getting there, but so many errors... I didnt realise I was putting things at the 'end end' and they were supposed to go before ?>
for a newbie like me the instructions have many flaws!

Having trouble with this link now... Couldn't find this.. and pasted the below anyway and its not working.
Error message: Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/flishclo/public_html/admin/includes/boxes/catalog.php on line 41


3. Modify the catalog/admin/includes/boxes/catalog.php file.
Find:

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

Add after:

                                   '<a href="' . tep_href_link(FILENAME_DISCOUNT_CODES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_CODE . '</a><br>' . // Discount Code 2.9

Thinking theres a reason why people get paid the big bucks to do this haha

#11   JLewis

JLewis
  • Members
  • 84 posts
  • Real Name:John Lewis
  • Gender:Male
  • Location:Chesterfield

Posted 11 June 2011 - 11:16 AM

Not to sure where you are with it now.

are you saying that you have modified the catalog/admin/includes/boxes/catalog.php file?

and are getting an error message


Edit: just looked at what add-on you are using, Discount Code 2.9 is for OSC 2.2 and 2.3.1, is that what you are using?

Edited by JLewis, 11 June 2011 - 11:25 AM.

Driving Lorry £500.00 per week – Website design £0.00 per week – Website Sales £0.00 per week – Continuing to learn html & css Priceless

#12   krys

krys
  • Members
  • 18 posts
  • Real Name:Krystal

Posted 11 June 2011 - 11:23 AM

I just followed the instructions and did the following
13. Modify the catalog/admin/includes/boxes/catalog.php file.
Find:

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

Add after:

                                   '<a href="' . tep_href_link(FILENAME_DISCOUNT_CODES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_CODE . '</a><br>' . // Discount Code 2.9

Now when trying to log into my oscommerce site I get that error message.

#13   JLewis

JLewis
  • Members
  • 84 posts
  • Real Name:John Lewis
  • Gender:Male
  • Location:Chesterfield

Posted 11 June 2011 - 11:29 AM

do you no that this section of the forum is for help with osc V3.x

What version of OSC are you using?

edit: Post catalog/admin/includes/boxes/catalog.php and i'll have a look

Edited by JLewis, 11 June 2011 - 11:35 AM.

Driving Lorry £500.00 per week – Website design £0.00 per week – Website Sales £0.00 per week – Continuing to learn html & css Priceless

#14   krys

krys
  • Members
  • 18 posts
  • Real Name:Krystal

Posted 11 June 2011 - 11:43 AM

I have version 2.3.1

I just downloaded this.. discount_code_2.9_for_oscommerce_online_merchant.2.3.1 & discount_code_module_for_oscommerce.2.9.full

I haven't looked in the forum, just in the readme file of the downloads itself.

Thanks :)

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright © 2010 osCommerce

  Released under the GNU General Public License
*/

  $cl_box_groups[] = array(
    'heading' => BOX_HEADING_CATALOG,
    'apps' => array(
      array(
        'code' => FILENAME_CATEGORIES,
        'title' => BOX_CATALOG_CATEGORIES_PRODUCTS,
        'link' => tep_href_link(FILENAME_CATEGORIES)
      ),
      array(
        'code' => FILENAME_PRODUCTS_ATTRIBUTES,
        'title' => BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES,
        'link' => tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES)
      ),
      array(
        'code' => FILENAME_MANUFACTURERS,
        'title' => BOX_CATALOG_MANUFACTURERS,
        'link' => tep_href_link(FILENAME_MANUFACTURERS)
      ),
      array(
        'code' => FILENAME_REVIEWS,
        'title' => BOX_CATALOG_REVIEWS,
        'link' => tep_href_link(FILENAME_REVIEWS)
      ),
      array(
        'code' => FILENAME_SPECIALS,
        'title' => BOX_CATALOG_SPECIALS,
        'link' => tep_href_link(FILENAME_SPECIALS)

<a href="' . tep_href_link(FILENAME_DISCOUNT_CODES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_CODE . '</a><br>' . // Discount Code 2.9
      ,
      array(
        'code' => FILENAME_PRODUCTS_EXPECTED,
        'title' => BOX_CATALOG_PRODUCTS_EXPECTED,
        'link' => tep_href_link(FILENAME_PRODUCTS_EXPECTED)
      )
    )
  );

#15   JLewis

JLewis
  • Members
  • 84 posts
  • Real Name:John Lewis
  • Gender:Male
  • Location:Chesterfield

Posted 11 June 2011 - 11:47 AM

this code

<a href="' . tep_href_link(FILENAME_DISCOUNT_CODES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_CODE . '</a><br>' . // Discount Code 2.9

is for osc 2.2 not 2.3.1
Driving Lorry £500.00 per week – Website design £0.00 per week – Website Sales £0.00 per week – Continuing to learn html & css Priceless

#16   krys

krys
  • Members
  • 18 posts
  • Real Name:Krystal

Posted 11 June 2011 - 11:52 AM

ahh great, the readme for the 2.3.1 didn't have much to it though and nothing about editing anything in the catalog.
How do I find the right code?

#17   JLewis

JLewis
  • Members
  • 84 posts
  • Real Name:John Lewis
  • Gender:Male
  • Location:Chesterfield

Posted 11 June 2011 - 12:00 PM

you might be better restoring osc back to how is was before you started adding this module. then have a look at Discount Code for osCommerce 2.3.1

Edited by JLewis, 11 June 2011 - 12:01 PM.

Driving Lorry £500.00 per week – Website design £0.00 per week – Website Sales £0.00 per week – Continuing to learn html & css Priceless

#18   krys

krys
  • Members
  • 18 posts
  • Real Name:Krystal

Posted 11 June 2011 - 12:35 PM

Thanks, I already have that one, and have applied the changes it had said I needed to do anyway.. so odd!