Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

Help me please

 

I have installed this contribution and on first attempt to login I get

 

1146 - Table 'xxxxxxxxxx.TABLE_CONFIGURATION' doesn't exist

 

select configuration_key as cfgKey, configuration_value as cfgValue from TABLE_CONFIGURATION

 

now I have checked the database and all the tables from this contrib are there, and I know that TABLE_CONFIGURATION is defined in

 

database_tables.php as 'configuration' and this table is also present in the db. this site was working perfectly until I installed this contrib I have now followed the instructions to remove and I still get the same error.

 

I have checked all the configure.php files in normal and local paths, and all the db settings are correct, the front end is working fine btw so obviously a db connection is being made.

 

this contrib did not seem to change the configuration table as far as I can see, so I do not understand why it just started as soon as I installed this contrib.

 

I am quite experienced and can program in php etc and I work with phpmyadmin all day , but still I am at a loss.

 

any thoughts anyone???

 

nb I am using osCommerce Online Merchant v2.3.3 and as stated before this site was working 100% fine I just wanted the ability for discount coupons, wish I hadn't now.

Share this post


Link to post
Share on other sites

Hello, hope I'm not asking too much.

 

I have bypassed the checkout_shipping.php and checkout_payment.php because i have only 1 shipping and 1 payment option. so the users are going directly from shopping_cart.php to checkout_confirmation.php

 

Is there a way to validate the coupon code in the checkout_confirmation page ?

 

thank you!

Edited by psytanium

Share this post


Link to post
Share on other sites

I have almost completed how to integrate the discount coupon in the Checkout Confirmation page. but i still need 1 last touch, as am not expert in php.

  1. Duplicate the file checkout_confirmation.php, now i have a new file checkout_confirmation_coupon.php
     
  2. Moved this code
    <?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"', $coupon); ?>

    from Checkout payment to Checkout Confirmation
     

  3. Added a button to verify the coupon code
    <?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM_COUPON, 'star', null, 'primary'); ?></div></div>


Now the Checkout Confirmation page has 2 buttons:

Verify Coupon : if click, the page send the information to checkout_confirmation_coupon.php

Confirm Order : if click, the page send the information to checkout_process.php

 

the problem is both buttons redirect to checkout_process.php, how can i make the Verify Coupon button redirect to checkout_confirmation_coupon.php ????

Share this post


Link to post
Share on other sites

Help! :( My discount codes don't work _at all_. The system does recognize an invalid code and says it's invalid, but when I apply a valid code, nothing happens. The discount doesn't show. I checked the common problems but couldn't find the answer.

 

I think the problem has something to do with the Min order / Min order type, because if I leave Min Order as 0, nothing happens at all. If I set any value in it, I get an error message saying - for example - that the coupon code may only be used on orders over $18 and that I have products that don't meet the criteria in my cart. And this happens even when the product in my cart is priced over $18 and isn't excluded in any way.

 

So: the only times I get any reaction at all is when I either type in an invalid code or if I use the Min Order / Min Order Type -fields.

Help? Anyone?

Share this post


Link to post
Share on other sites

Oookay, I'm starting to think this has something to do with SaleMaker. The discount codes worked when I installed the add-on, but they don't anymore - and pretty much the only thing that has changed was that I've also installed SaleMaker a couple of days after the Discount Coupon Codes. Has anyone else run into this problem? Any idea how the SaleMaker could be interfering with the Discount Coupon Codes? I'm not running a sale so none of the products are marked down at the moment.

Share this post


Link to post
Share on other sites

Hello,

 

I installed the module twice, very carefully. However the Catalog > Discount Coupons. Click the New Coupon never shows up un the administration area. My Oscommerce version is 2.3.3, it there something that I am doing wrong and/or missing?

 

Any help is appreciate,

Thank you for your time and help!


Andrea

Share this post


Link to post
Share on other sites

Hello,

 

I installed the module twice, very carefully. However the Catalog > Discount Coupons. Click the New Coupon never shows up un the administration area. My Oscommerce version is 2.3.3, it there something that I am doing wrong and/or missing?

 

Any help is appreciate,

Thank you for your time and help!


Andrea

Share this post


Link to post
Share on other sites

Hi,

 

I just installed this last evening. I am having the same problem as a previous member. I have only one payment method and one shipping method installed and everything is working perfectly in the admin side, but the coupon code does not show up at checkout. Any help would be greatly appreciated. :)

Share this post


Link to post
Share on other sites

Hi,

 

I have a free shipping module and have set it for orders of more than £30.

Anyway of making the discount unavailable for orders that qualify for free shipping?

 

Maybe I can edit the code and add a max order setting (the same as min order but reverse).

But Im not any good with php. If anyone could help that could be great

Edited by karoloydi

Share this post


Link to post
Share on other sites

I hope I am posting in the right area. and maybe I am doing something wrong here. But I have a test website and a prod website. But I went ahead and used the same database. On my test website I have been running some tests on modules and the prod website has been successful. I haven't made any code changes at all in prod but now all of a sudden I get errors on check outs. If anyone can shed some light on what happened all of a sudden

 

 

 

Fatal error: Call to a member function count() on a non-object in //includes/modules/order_total/ot_easy_discount.php on line 27

 

function process() {

global $order, $currencies, $ot_subtotal, $cart, $easy_discount;

$od_amount = 0;

if ($easy_discount->count() > 0) {

$easy_discounts = $easy_discount->get_all();

$n = sizeof($easy_discounts);

for ($i=0;$i < $n; $i++) {

$this->output[] = array('title' => $easy_discounts[$i]['description'].': ',

'text' => '<font color="red">-' . $currencies->format($easy_discounts[$i]['amount']).'</font>',

'value' => $easy_discounts[$i]['amount']);

$od_amount = $od_amount + $easy_discounts[$i]['amount'];

}

$this->deduction = $od_amount;

$order->info['total'] = $order->info['total'] - $od_amount;

if ($this->sort_order < $ot_subtotal->sort_order) $order->info['subtotal'] = $order->info['subtotal'] - $od_amount;

Share this post


Link to post
Share on other sites

Some addons make changes to the database, usually in the configuration table. Revert your configuration table to a known good backup and your site will probably work again. And use a different database for your test site.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I cannot fine the following code in order.php

 

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
       $this->info['subtotal'] += $shown_price;

 

I have done everything else and it all work to the point that I type in my promotional code at checkout - there is no button to confirm the code entry and when I press checkout/continue I get redirected to paypal (my only form of payment) but the full price is showing?

Share this post


Link to post
Share on other sites

Hey John. how did you fix the privacy notice and shipping and returns do you have a generic file or can you send me your file without your info. maybe only an indication to where type in the info that I need on PHP. sorry im very new at this

Share this post


Link to post
Share on other sites

Hi, great contribution! I have an issue that perhaps someone more experienced can help me with. I see that I can exclude all coupons from applying to specials (at the coupons admin) however, I need to allow one specific coupon to apply to specials and all others to not apply to specials. Is there a way to do this? Or perhaps there is a way to include the exclusion of specials as an option (false/true) at each coupon (in exclusions) not only at the general coupon admin which applies to all coupons? Thank you for any help!

Share this post


Link to post
Share on other sites

@@greasemonkey yep double checked I had the correct file.. cannot find that line of code at all at catalog/incudes/classes/order.php

 

here is my file

 

<?php
/*
 $Id$

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

 Copyright (c) 2007 osCommerce

 Released under the GNU General Public License
*/

 class order {
   var $info, $totals, $products, $customer, $delivery, $content_type;

   function order($order_id = '') {
     $this->info = array();
     $this->totals = array();
     $this->products = array();
     $this->customer = array();
     $this->delivery = array();

     if (tep_not_null($order_id)) {
       $this->query($order_id);
     } else {
       $this->cart();
     }
   }

   function query($order_id) {
     global $languages_id;

     $order_id = tep_db_prepare_input($order_id);

     $order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
     $order = tep_db_fetch_array($order_query);

     $totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");
     while ($totals = tep_db_fetch_array($totals_query)) {
       $this->totals[] = array('title' => $totals['title'],
                               'text' => $totals['text']);
     }

     $order_total_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_total'");
     $order_total = tep_db_fetch_array($order_total_query);

     $shipping_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_shipping'");
     $shipping_method = tep_db_fetch_array($shipping_method_query);

     $order_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . $order['orders_status'] . "' and language_id = '" . (int)$languages_id . "'");
     $order_status = tep_db_fetch_array($order_status_query);

     $this->info = array('currency' => $order['currency'],
                         'currency_value' => $order['currency_value'],
                         'payment_method' => $order['payment_method'],
                         'cc_type' => $order['cc_type'],
                         'cc_owner' => $order['cc_owner'],
                         'cc_number' => $order['cc_number'],
                         'cc_expires' => $order['cc_expires'],
                         'date_purchased' => $order['date_purchased'],
                         'orders_status' => $order_status['orders_status_name'],
                         'last_modified' => $order['last_modified'],
                         'total' => strip_tags($order_total['text']),
                         'shipping_method' => ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title'])));

     $this->customer = array('id' => $order['customers_id'],
                             'name' => $order['customers_name'],
                             'company' => $order['customers_company'],
                             'street_address' => $order['customers_street_address'],
                             'suburb' => $order['customers_suburb'],
                             'city' => $order['customers_city'],
                             'postcode' => $order['customers_postcode'],
                             'state' => $order['customers_state'],
                             'country' => array('title' => $order['customers_country']),
                             'format_id' => $order['customers_address_format_id'],
                             'telephone' => $order['customers_telephone'],
                             'email_address' => $order['customers_email_address']);

     $this->delivery = array('name' => trim($order['delivery_name']),
                             'company' => $order['delivery_company'],
                             'street_address' => $order['delivery_street_address'],
                             'suburb' => $order['delivery_suburb'],
                             'city' => $order['delivery_city'],
                             'postcode' => $order['delivery_postcode'],
                             'state' => $order['delivery_state'],
                             'country' => array('title' => $order['delivery_country']),
                             'format_id' => $order['delivery_address_format_id']);

     if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
       $this->delivery = false;
     }

     $this->billing = array('name' => $order['billing_name'],
                            'company' => $order['billing_company'],
                            'street_address' => $order['billing_street_address'],
                            'suburb' => $order['billing_suburb'],
                            'city' => $order['billing_city'],
                            'postcode' => $order['billing_postcode'],
                            'state' => $order['billing_state'],
                            'country' => array('title' => $order['billing_country']),
                            'format_id' => $order['billing_address_format_id']);

     $index = 0;
     $orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
     while ($orders_products = tep_db_fetch_array($orders_products_query)) {
       $this->products[$index] = array('qty' => $orders_products['products_quantity'],
                              'id' => $orders_products['products_id'],
                                       'name' => $orders_products['products_name'],
                                       'model' => $orders_products['products_model'],
                                       'tax' => $orders_products['products_tax'],
                                       'price' => $orders_products['products_price'],
                                       'final_price' => $orders_products['final_price']);

       $subindex = 0;
       $attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
       if (tep_db_num_rows($attributes_query)) {
         while ($attributes = tep_db_fetch_array($attributes_query)) {
           $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
                                                                    'value' => $attributes['products_options_values'],
                                                                    'prefix' => $attributes['price_prefix'],
                                                                    'price' => $attributes['options_values_price']);

           $subindex++;
         }
       }

       $this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';

       $index++;
     }
   }

   function cart() {
     global $HTTP_POST_VARS, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment, $comments, $customer_default_address_id;

     $this->content_type = $cart->get_content_type();

     if ( ($this->content_type != 'virtual') && ($sendto == false) ) {
       $sendto = $customer_default_address_id;
     }

     $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id");
     $customer_address = tep_db_fetch_array($customer_address_query);

     if (is_array($sendto) && !empty($sendto)) {
       $shipping_address = array('entry_firstname' => $sendto['firstname'],
                                 'entry_lastname' => $sendto['lastname'],
                                 'entry_company' => $sendto['company'],
                                 'entry_street_address' => $sendto['street_address'],
                                 'entry_suburb' => $sendto['suburb'],
                                 'entry_postcode' => $sendto['postcode'],
                                 'entry_city' => $sendto['city'],
                                 'entry_zone_id' => $sendto['zone_id'],
                                 'zone_name' => $sendto['zone_name'],
                                 'entry_country_id' => $sendto['country_id'],
                                 'countries_id' => $sendto['country_id'],
                                 'countries_name' => $sendto['country_name'],
                                 'countries_iso_code_2' => $sendto['country_iso_code_2'],
                                 'countries_iso_code_3' => $sendto['country_iso_code_3'],
                                 'address_format_id' => $sendto['address_format_id'],
                                 'entry_state' => $sendto['zone_name']);
     } elseif (is_numeric($sendto)) {
       $shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$sendto . "'");
       $shipping_address = tep_db_fetch_array($shipping_address_query);
     } else {
       $shipping_address = array('entry_firstname' => null,
                                 'entry_lastname' => null,
                                 'entry_company' => null,
                                 'entry_street_address' => null,
                                 'entry_suburb' => null,
                                 'entry_postcode' => null,
                                 'entry_city' => null,
                                 'entry_zone_id' => null,
                                 'zone_name' => null,
                                 'entry_country_id' => null,
                                 'countries_id' => null,
                                 'countries_name' => null,
                                 'countries_iso_code_2' => null,
                                 'countries_iso_code_3' => null,
                                 'address_format_id' => 0,
                                 'entry_state' => null);
     }

     if (is_array($billto) && !empty($billto)) {
       $billing_address = array('entry_firstname' => $billto['firstname'],
                                'entry_lastname' => $billto['lastname'],
                                'entry_company' => $billto['company'],
                                'entry_street_address' => $billto['street_address'],
                                'entry_suburb' => $billto['suburb'],
                                'entry_postcode' => $billto['postcode'],
                                'entry_city' => $billto['city'],
                                'entry_zone_id' => $billto['zone_id'],
                                'zone_name' => $billto['zone_name'],
                                'entry_country_id' => $billto['country_id'],
                                'countries_id' => $billto['country_id'],
                                'countries_name' => $billto['country_name'],
                                'countries_iso_code_2' => $billto['country_iso_code_2'],
                                'countries_iso_code_3' => $billto['country_iso_code_3'],
                                'address_format_id' => $billto['address_format_id'],
                                'entry_state' => $billto['zone_name']);
     } else {
       $billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$billto . "'");
       $billing_address = tep_db_fetch_array($billing_address_query);
     }

     if ($this->content_type == 'virtual') {
       $tax_address = array('entry_country_id' => $billing_address['entry_country_id'],
                            'entry_zone_id' => $billing_address['entry_zone_id']);
     } else {
       $tax_address = array('entry_country_id' => $shipping_address['entry_country_id'],
                            'entry_zone_id' => $shipping_address['entry_zone_id']);
     }

     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
                         'currency' => $currency,
                         'currency_value' => $currencies->currencies[$currency]['value'],
                         'payment_method' => $payment,
                         'cc_type' => '',
                         'cc_owner' => '',
                         'cc_number' => '',
                         'cc_expires' => '',
                         'shipping_method' => $shipping['title'],
                         'shipping_cost' => $shipping['cost'],
                         'subtotal' => 0,
                         'tax' => 0,
                         'tax_groups' => array(),
                         'comments' => (tep_session_is_registered('comments') && !empty($comments) ? $comments : ''));

     if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
       if (isset($GLOBALS[$payment]->public_title)) {
         $this->info['payment_method'] = $GLOBALS[$payment]->public_title;
       } else {
         $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;
       }
     }

     $this->customer = array('firstname' => $customer_address['customers_firstname'],
                             'lastname' => $customer_address['customers_lastname'],
                             'company' => $customer_address['entry_company'],
                             'street_address' => $customer_address['entry_street_address'],
                             'suburb' => $customer_address['entry_suburb'],
                             'city' => $customer_address['entry_city'],
                             'postcode' => $customer_address['entry_postcode'],
                             'state' => ((tep_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_name']),
                             'zone_id' => $customer_address['entry_zone_id'],
                             'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']),
                             'format_id' => $customer_address['address_format_id'],
                             'telephone' => $customer_address['customers_telephone'],
                             'email_address' => $customer_address['customers_email_address']);

     $this->delivery = array('firstname' => $shipping_address['entry_firstname'],
                             'lastname' => $shipping_address['entry_lastname'],
                             'company' => $shipping_address['entry_company'],
                             'street_address' => $shipping_address['entry_street_address'],
                             'suburb' => $shipping_address['entry_suburb'],
                             'city' => $shipping_address['entry_city'],
                             'postcode' => $shipping_address['entry_postcode'],
                             'state' => ((tep_not_null($shipping_address['entry_state'])) ? $shipping_address['entry_state'] : $shipping_address['zone_name']),
                             'zone_id' => $shipping_address['entry_zone_id'],
                             'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']),
                             'country_id' => $shipping_address['entry_country_id'],
                             'format_id' => $shipping_address['address_format_id']);

     $this->billing = array('firstname' => $billing_address['entry_firstname'],
                            'lastname' => $billing_address['entry_lastname'],
                            'company' => $billing_address['entry_company'],
                            'street_address' => $billing_address['entry_street_address'],
                            'suburb' => $billing_address['entry_suburb'],
                            'city' => $billing_address['entry_city'],
                            'postcode' => $billing_address['entry_postcode'],
                            'state' => ((tep_not_null($billing_address['entry_state'])) ? $billing_address['entry_state'] : $billing_address['zone_name']),
                            'zone_id' => $billing_address['entry_zone_id'],
                            'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']),
                            'country_id' => $billing_address['entry_country_id'],
                            'format_id' => $billing_address['address_format_id']);

     $index = 0;
     $products = $cart->get_products();
//kgt - discount coupons
     global $coupon;
     if( tep_session_is_registered( 'coupon' ) && tep_not_null( $coupon ) ) {
       require_once( DIR_WS_CLASSES.'discount_coupon.php' );
       $this->coupon = new discount_coupon( $coupon, $this->delivery );
       $this->coupon->total_valid_products( $products );
       $valid_products_count = 0;
     }
     //end kgt - discount coupons
     for ($i=0, $n=sizeof($products); $i<$n; $i++) {
       $this->products[$index] = array('qty' => $products[$i]['quantity'],
                                       'name' => $products[$i]['name'],
                                       'model' => $products[$i]['model'],
                                       'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
                                       'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
                                       'price' => $products[$i]['price'],
                                       'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),
                                       'weight' => $products[$i]['weight'],
                                       'id' => $products[$i]['id']);

       if ($products[$i]['attributes']) {
         $subindex = 0;
         reset($products[$i]['attributes']);
         while (list($option, $value) = each($products[$i]['attributes'])) {
           $attributes_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'");
           $attributes = tep_db_fetch_array($attributes_query);

           $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'],
                                                                    'value' => $attributes['products_options_values_name'],
                                                                    'option_id' => $option,
                                                                    'value_id' => $value,
                                                                    'prefix' => $attributes['price_prefix'],
                                                                    'price' => $attributes['options_values_price']);

           $subindex++;
         }
       }

       $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
       $this->info['subtotal'] += $shown_price;

       $products_tax = $this->products[$index]['tax'];
       $products_tax_description = $this->products[$index]['tax_description'];
       if (DISPLAY_PRICE_WITH_TAX == 'true') {
         $this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
         if (isset($this->info['tax_groups']["$products_tax_description"])) {
           $this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
         } else {
           $this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
         }
       } else {
         $this->info['tax'] += ($products_tax / 100) * $shown_price;
         if (isset($this->info['tax_groups']["$products_tax_description"])) {
           $this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price;
         } else {
           $this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price;
         }
       }

       $index++;
     }

     if (DISPLAY_PRICE_WITH_TAX == 'true') {
       $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
       $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 //kgt - discount coupon
     if( is_object( $this->coupon ) ) {
       $this->info['total'] = $this->coupon->finalize_discount( $this->info );
     }
     //end kgt - discount coupon
   }
 }
?>

Share this post


Link to post
Share on other sites

Just completed a test purchase on my site and the discount does not seem to be pulling through to the final amount paid in Paypal and certainly isn't being listed on the order confirmation screen back in the store.

 

??

Share this post


Link to post
Share on other sites

@@srphotos Look around line 321 of your file...

 

                $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
               $this->info['subtotal'] += $shown_price;

 

The line you are looking for is there...

 

Also, if you are having trouble with PayPal try a different paypal module... if you are using PayPal Express try Standard...

Share this post


Link to post
Share on other sites

@@greasemonkey doh!!!

 

of course the code is there!!

 

I scrolled up to take a look and it jumped out at me immediately!!

 

Strange that the search function in Dreamweaver didn't pick this up when it found everything else.

 

Oh well, I'll get on at changing this when I finish work tonight.

Edited by srphotos

Share this post


Link to post
Share on other sites

I have installed this module and everything seems to be fine on the admin side.....

 

when i check out with paypal (sandbox)....the discount never applies....and when i finish the check out....i get this error:

 

1054 - Unknown column 'delivery_date' in 'field list'

 

insert into orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, delivery_date, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value) values ('2', 'test user', '', '2 fayette st.', '', 'burgettstown', '15021', 'Pennsylvania', 'United States', '7245317540', 'sgray1974@gmail.com', '2', 'test user', '', '2 fayette st.', '', 'burgettstown', '15021', 'Pennsylvania', 'United States', '2', '', 'test user', '', '2 fayette st.', '', 'burgettstown', '15021', 'Pennsylvania', 'United States', '2', 'PayPal (including Credit and Debit Cards)', '', '', '', '', now(), '1', 'USD', '1.00000000')

 

[TEP STOP]

 

..................

 

now when i try to check out it does not even take me to paypal....it goes straight to a confirmation page...when i click confirm order, i get this error:

 

"A successful transaction has already been completed for this token."

 

any ideas here......i really want to use these discounts...

 

thanks......

 

http://www.tinkerplayground.com

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

×