Jump to content
Strider

Credit Class/Gift Vouchers/Discount Coupons 5.10

Recommended Posts

Oh yeah my sort order is:

  • Sub-Total 1
    Shipping 2
    Tax 3
    Customer Discount 4
    Discount Coupons 5
    Gift Vouchers 6
    Total 7

Share this post


Link to post
Share on other sites
In my previous post I said that my CC and GV install was working, but I was wrong, I have the following problem now:

 

The shopping cart is not being cleared on checkout when using payment methods like 'Paypal IPN' and 'Nochex'. (I tested it on Paypal by paying ?1.00 for an item and got a IPN back from Paypal). It does clear when using 'cheque/money order'.

 

The Admin > Orders is showing up the order after the checkout process for 'Paypal' and 'Check/Money Order' BUT NOT FOR 'Nochex'. 

 

The Gift Voucher Queue does not show the gv when paying by 'Paypal' and Nochex, only for Check/MO.

 

What could be the problem? Something has changed in the one of the checkout files.  :(

The GV/DC-contribution and PayPal IPN is not "compatible".

 

PayPal IPN is using it's own checkout process which is "checkout_paypal.php" and the GV/DC-contribution does not update this file etc. A while ago I posted in this thread (I think) a way to merge these two contributions.

 

/Fred

Share this post


Link to post
Share on other sites

I noticed a while ago that the coupon report in coupon admin did not support more then 20 redeemed coupons, i.e. there was no way to look at the next page of redeemed coupons.

 

This have become a problem for me since I am getting quite a lot of redeemed coupons.

 

I don't think this is implemented in 5.10b so I post a fix for this. I also changed the report to display the latest coupon first (i.e changed the SQL-query sort order).

 

//In admin/coupon_admin.php, find these two lines:
 switch ($HTTP_GET_VARS['action']) {
 case 'voucherreport':
...
//change the sort order of the SQL query :
   $cc_query_raw = "select * from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $HTTP_GET_VARS['cid'] . "' order by redeem_date desc";

...
//after this block
               <td class="dataTableContent" align="center"><?php echo tep_date_short($cc_list['redeem_date']); ?></td>
               <td class="dataTableContent" align="right"><?php if ( (is_object($cInfo)) && ($cc_list['unique_id'] == $cInfo->unique_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_COUPON_ADMIN, 'page=' . $HTTP_GET_VARS['page'] . '&cid=' . $cc_list['coupon_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
             </tr>
<?php
   }
?>


//add this block - BOF
             <tr>
               <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <td class="smallText" valign="top"><?php echo $cc_split->display_count($cc_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_COUPONS); ?></td>
                   <td class="smallText" align="right"><?php echo $cc_split->display_links($cc_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'],'action=voucherreport&cid='.$HTTP_GET_VARS['cid']); ?> </td>
                 </tr>
               </table></td>
             </tr>
//add this block - EOF

 

Enjoy!

 

/Fred

Share this post


Link to post
Share on other sites

Add quick links to Gift Voucher Queue and Product Returns

 

 

MOD REASON:

 

The less link clicking the better!

 

----------------------------

 

BACKUP:

 

admin/index.php

admin/includes/language/english.php

 

----------------------------

 

STEP:1, Open your admin/index.php

 

Find:

 

array('title' => BOX_HEADING_CUSTOMERS,

      'image' => 'customers.gif',

      'href' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers'),

      'children' => array(array('title' => BOX_CUSTOMERS_CUSTOMERS, 'link' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers')),

                    array('title' => BOX_CUSTOMERS_ORDERS, 'link' => tep_href_link(FILENAME_ORDERS, 'selected_box=customers')))),

 

Change to if you have both the Credit Class/Gift Vouchers/Discount Coupons (Version 5.10b) and the RMA RETURNS SYSTEM v2.1:

 

array('title' => BOX_HEADING_CUSTOMERS,

      'image' => 'customers.gif',

      'href' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers'),

      'children' => array(array('title' => BOX_CUSTOMERS_CUSTOMERS, 'link' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers')),

                    array('title' => BOX_CUSTOMERS_ORDERS, 'link' => tep_href_link(FILENAME_ORDERS, 'selected_box=customers')),

                    array('title' => BOX_GV_ADMIN, 'link' => tep_href_link(FILENAME_GV_QUEUE, 'selected_box=gv_admin')),

                    array('title' => BOX_RETURNS, 'link' => tep_href_link(FILENAME_RETURNS, 'selected_box=returns')))),

 

Change to if you have the Credit Class/Gift Vouchers/Discount Coupons (Version 5.10b), but **DO NOT** have the RMA RETURNS SYSTEM v2.1 installed:

 

array('title' => BOX_HEADING_CUSTOMERS,

      'image' => 'customers.gif',

      'href' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers'),

      'children' => array(array('title' => BOX_CUSTOMERS_CUSTOMERS, 'link' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers')),

                    array('title' => BOX_CUSTOMERS_ORDERS, 'link' => tep_href_link(FILENAME_ORDERS, 'selected_box=customers')),

                    array('title' => BOX_GV_ADMIN, 'link' => tep_href_link(FILENAME_GV_QUEUE, 'selected_box=gv_admin')))),

 

Save and close.

 

----------------------------

 

STEP:2, Open your admin/includes/language/english.php

 

Find the last '?>' in the file:

 

?>

 

Change to:

 

define('BOX_GV_ADMIN', 'Gift Voucher Queue');

define('BOX_RETURNS', 'Product Returns');

?>

 

If you have both the Credit Class/Gift Vouchers/Discount Coupons (Version 5.10b)

and the RMA RETURNS SYSTEM v2.1

 

OR

 

Find the last '?>' in the file:

 

?>

 

Change to:

 

define('BOX_GV_ADMIN', 'Gift Voucher Queue');

?>

 

If you have the Credit Class/Gift Vouchers/Discount Coupons (Version 5.10b),

but **DO NOT** have the RMA RETURNS SYSTEM v2.1 installed.

 

Save and close.

 

 

Upload both files and enjoy. :D


Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet!

Share this post


Link to post
Share on other sites
Just as an aside,

 

So far I have come across a few payment modules that do not work with the GV/Coupon code.

 

Authorize.net.

 

This is easily fixed, and I will be including the fix in the next update. Basically just a re-ordering of a couple of lines in one checkout file.

 

 

Paypal IPN

 

The problem here is that paypal IPN uses a custom checkout_process.php file. It should be possible to amend the paypal IPN page to be compatible. Something to look into.

 

 

Multicards.

 

Not nice. Multicards does not use $order->info['total'] to pass value for cc processing, but rather sends a list of each product in cart with price. Therefore bypassing gv/discount values. I do have a possible 'sneaky' workround which needs some testing.

 

 

Still plan to have update released tonight :D

Posted: May 14 2003, 04:37 PM  Ian C Wilson

 

 

Thanks for your post earlier, Fred. Can't find your fix though.

 

I see this was an issue with v5. Was it ever followed up? I am having a problem using Paypal IPN with the GV/DC v5.10b (shopping cart not being emptied).


Mary-Ann

Chief Cook and Bottlewasher

Jack-of-All-Trades

Running 2.2MS2

Share this post


Link to post
Share on other sites

mary look at your checkout_process.php and convert the code from that to the paypal ipn checkout_paypalipn.php code and you will be fine


(my knowledge is so small you would think that an ant was a genius in comparison)

Share this post


Link to post
Share on other sites

Strider: :D Thanks for that help. It appears to be working now! I will test it some more.


Mary-Ann

Chief Cook and Bottlewasher

Jack-of-All-Trades

Running 2.2MS2

Share this post


Link to post
Share on other sites

HI there,

 

It appears the version 5.10b works fine... I still have to check for the limitations but still ok for now... great job...

Share this post


Link to post
Share on other sites

Hi, Just been setting up this great contribution on my shop, but when i try to purchase a voucher the voucher does not go into the queue menu in admin and i can't find where the function is that does this task.

 

It seems to be only a problem with the latest CVS version of Oscommerce, which i'm having to use because of a PHP bug.

 

Could someone offer some help. I can supply more information if needed to help me solve this.

 

Cheers,

 

Mark

Share this post


Link to post
Share on other sites
Hi, Just been setting up this great contribution on my shop, but when i try to purchase a voucher the voucher does not go into the queue menu in admin and i can't find where the function is that does this task.

 

It seems to be only a problem with the latest CVS version of Oscommerce, which i'm having to use because of a PHP bug.

 

Could someone offer some help. I can supply more information if needed to help me solve this.

 

Cheers,

 

Mark

Did you setup your mod to queue vouchers?

 

if yes...what product name did you give to your voucher?

 

Sometime just a missspelling is the problem...

 

if you call your gift voucher "GIFT200" for a 200$ gift (for example), it should work....

Share this post


Link to post
Share on other sites

Yep i did set up the queue in admin and the product code is GIFT10, it works ok on Milestone version and not newer CVS

 

It all seems to work but i can't see why it not added to queue table.

Share this post


Link to post
Share on other sites

Northessex: I would really like to know what php version and bug you have that you can only use the latest cvs?


(my knowledge is so small you would think that an ant was a genius in comparison)

Share this post


Link to post
Share on other sites

i have PHP 4.2.3 on my hosting companies computer, and the bug is the well known one which cause the alignment of the right boxes and bottom bar to be messed up every so often.

 

I have tried a few ways to get round it.

Share this post


Link to post
Share on other sites

Boxes not displaying correctly

 

That's very interesting, northessex ... I have the same problem. I posted a query about this on the main forum but no reply yet.

 

Why does everything move to the left side of the page after opening the checkout_success page? <_< The other pages are displaying fine.

 

My webhost's server info

PHP Version: 4.2.3 (Zend: 1.2.0)

Apache/1.3.29 (Unix)


Mary-Ann

Chief Cook and Bottlewasher

Jack-of-All-Trades

Running 2.2MS2

Share this post


Link to post
Share on other sites

Does anyone know if this version 5.10b will work ok with 2.2 MS1?

 

Thanks,

Rickey

Share this post


Link to post
Share on other sites

sbizo: no it won't

 

mary and northessex: I don't think that is a bug in 4.2.3 .. that is a bug in osc because it is missing an end table.

I will try to find the place where this needs to be placed. They fixed it in the cvs northessex by putting the correct end table in place or at least that is what I have heard.

The missing table ( </table> ) messes with the alignment of the tables and the index.php page when loading  column_right.php.

 

The fix is below:

Around line 330 of index.php you need to add another </table> to correct the problem. See below for snip:

 

Line 328: <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

Line 329: <!-- right_navigation_eof //-->

Line 330: </table></table></td>

Line 331: </tr>

Line 332: </table>

Line 334: <!-- body_eof //-->

 

Makes it easier than downloading another index.php file.

 

I didn't write this donald harriman did.

 

Hope this helps some.


(my knowledge is so small you would think that an ant was a genius in comparison)

Share this post


Link to post
Share on other sites

Hi,

 

I'm using version 5.10b with the authorize.net mod. When a user redeems a discount code, the correct amount appears with the deduction. Unfortunately, when the order goes to authorize.net - the discount is not being applied. :(

 

Anyone know of a fix for this? I'd appreciate any suggestions.

 

Thanks,

Karen


festina lente

Share this post


Link to post
Share on other sites

Yahooo!! :lol: Thank You, Strider. I searched for the lines containing the code in the pages that weren't displaying correctly and added in an extra </table> in the following files. The alignment is spot on now:

 

catalog/checkout_confirmation.php

catalog/checkout_success.php

catalog/checkout_shipping.php

 

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></table></td>

 

The second </table> on the third line.


Mary-Ann

Chief Cook and Bottlewasher

Jack-of-All-Trades

Running 2.2MS2

Share this post


Link to post
Share on other sites

I have just installed this fabulous contribution and am getting this on my front catalog page.

 

Warning: The downloadable products directory does not exist: /hsphere/local/home/jade2001/jewelrycabin.com/catalogdownload/. Downloadable products will not work until this directory is valid.

 

Now I have enabled downloadable products in admin. Not sure why this message has appeared. Any help would be greatly appreciated.

 

www.jewelrycabin.com


We will not regret what we have done. We will regret what we didn't do.

Share this post


Link to post
Share on other sites

JaaMor: you don't have your configure.php setup correctly for your download directory or actually your fs_catalog

 

define('DIR_FS_CATALOG', '/home/oscworks/work/new_oscworks/');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

 

notice the endling slash on the DIR_FS_CATALOG define

 

Mary: glad to hear it works for you

 

karen_l: depends on which mod you are using


(my knowledge is so small you would think that an ant was a genius in comparison)

Share this post


Link to post
Share on other sites

Well this one has got me baffled.

 

I have installed the contribution smoothly except for if I create a new account I find that all the products are now 10% cheaper for this new user no matter what I do. My existing account works smoothly. Also with the new user I find that they cannot pay by credit card.

 

The welcome discount in the admin is set to "0".

 

Does anyone have any idea why this may be happening?

Share this post


Link to post
Share on other sites

Hi Strider,

 

Bao Nguyen's Authorizenet ADC Direct Connection with Austin Renfroe's Transaction Key, Sort Order update from Aug 13,2003.

 

Thanks, for responding so quickly and for all the work you've done on this! :)


festina lente

Share this post


Link to post
Share on other sites

Thanks so much for getting back to me so quickly. I am quite a novice at all of this. Am I supposed to add:

define('DIR_FS_CATALOG', '/home/oscworks/work/new_oscworks/');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

 

somewhere? Please let me know where to add those lines or modify the lines that exist to match the lines you have supplied. Thanks again Strider.

 

I would like to add a big Thank You for making this contribution fairly simple to install. Your install instructions are so easy to follow, that even a novice like myself was able to follow everything step by step without having any problems.


We will not regret what we have done. We will regret what we didn't do.

Share this post


Link to post
Share on other sites

Hi, it's me again. I posted a query in another part of the forum with a problem I was having and it turns out that it could be something to do with the coupon contrib that I installed, so I am repeating it here in case someone can help while reading this thread (I'm hoping Strider). :unsure:

 

Hi,

I have the following error when trying to look at "My Order History" when logged in.  B) Can someone please help ?

 

Warning: Division by zero in /homepages/45/d87589151/htdocs/miltongems/catalog/includes/classes/split_page_results.php on line 59

This is what my split_page_results.php file looks like.

 

<?php
/*
 $Id: split_page_results.php,v 1.15 2003/06/09 22:35:34 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class splitPageResults {
   var $sql_query, $number_of_rows, $current_page_number, $number_of_pages, $number_of_rows_per_page, $page_name;

/* class constructor */
   function splitPageResults($query, $max_rows, $count_key = '*', $page_holder = 'page') {
     global $HTTP_GET_VARS, $HTTP_POST_VARS;

     $this->sql_query = $query;
     $this->page_name = $page_holder;

     if (isset($HTTP_GET_VARS[$page_holder])) {
       $page = $HTTP_GET_VARS[$page_holder];
     } elseif (isset($HTTP_POST_VARS[$page_holder])) {
       $page = $HTTP_POST_VARS[$page_holder];
     } else {
       $page = '';
     }

     if (empty($page) || !is_numeric($page)) $page = 1;
     $this->current_page_number = $page;

     $this->number_of_rows_per_page = $max_rows;

     $pos_to = strlen($this->sql_query);
     $pos_from = strpos($this->sql_query, ' from', 0);

     $pos_group_by = strpos($this->sql_query, ' group by', $pos_from);
     if (($pos_group_by < $pos_to) && ($pos_group_by != false)) $pos_to = $pos_group_by;

     $pos_having = strpos($this->sql_query, ' having', $pos_from);
     if (($pos_having < $pos_to) && ($pos_having != false)) $pos_to = $pos_having;

     $pos_order_by = strpos($this->sql_query, ' order by', $pos_from);
     if (($pos_order_by < $pos_to) && ($pos_order_by != false)) $pos_to = $pos_order_by;

     if (strpos($this->sql_query, 'distinct') || strpos($this->sql_query, 'group by')) {
       $count_string = 'distinct ' . tep_db_input($count_key);
     } else {
       $count_string = tep_db_input($count_key);
     }

     $count_query = tep_db_query("select count(" . $count_string . ") as total " . substr($this->sql_query, $pos_from, ($pos_to - $pos_from)));
     $count = tep_db_fetch_array($count_query);

     $this->number_of_rows = $count['total'];

     $this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page);

     if ($this->current_page_number > $this->number_of_pages) {
       $this->current_page_number = $this->number_of_pages;
     }

     $offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1));

     $this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;
   }

/* class functions */

// display split-page-number-links
   function display_links($max_page_links, $parameters = '') {
     global $PHP_SELF, $request_type;

     $display_links_string = '';

     $class = 'class="pageResults"';

     if (tep_not_null($parameters) && (substr($parameters, -1) != '&')) $parameters .= '&';

// previous button - not displayed on first page
     if ($this->current_page_number > 1) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . ($this->current_page_number - 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' "><u>' . PREVNEXT_BUTTON_PREV . '</u></a>  ';

// check if number_of_pages > $max_page_links
     $cur_window_num = intval($this->current_page_number / $max_page_links);
     if ($this->current_page_number % $max_page_links) $cur_window_num++;

     $max_window_num = intval($this->number_of_pages / $max_page_links);
     if ($this->number_of_pages % $max_page_links) $max_window_num++;

// previous window of pages
     if ($cur_window_num > 1) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . (($cur_window_num - 1) * $max_page_links), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>';

// page nn button
     for ($jump_to_page = 1 + (($cur_window_num - 1) * $max_page_links); ($jump_to_page <= ($cur_window_num * $max_page_links)) && ($jump_to_page <= $this->number_of_pages); $jump_to_page++) {
       if ($jump_to_page == $this->current_page_number) {
         $display_links_string .= ' <b>' . $jump_to_page . '</b> ';
       } else {
         $display_links_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . $jump_to_page, $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' "><u>' . $jump_to_page . '</u></a> ';
       }
     }

// next window of pages
     if ($cur_window_num < $max_window_num) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . (($cur_window_num) * $max_page_links + 1), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a> ';

// next button
     if (($this->current_page_number < $this->number_of_pages) && ($this->number_of_pages != 1)) $display_links_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . ($this->current_page_number + 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' "><u>' . PREVNEXT_BUTTON_NEXT . '</u></a> ';

     return $display_links_string;
   }

// display number of total products found
   function display_count($text_output) {
     $to_num = ($this->number_of_rows_per_page * $this->current_page_number);
     if ($to_num > $this->number_of_rows) $to_num = $this->number_of_rows;

     $from_num = ($this->number_of_rows_per_page * ($this->current_page_number - 1));

     if ($to_num == 0) {
       $from_num = 0;
     } else {
       $from_num++;
     }

     return sprintf($text_output, $from_num, $to_num, $this->number_of_rows);
   }
 }
?>

 

Any help would be appreciated. Thanks!

 

Mary-at-Milton

 

I received this reply:

Hi,

 

i got that kind of problem wehn using the Coupon Contribution.

I added the following line to my split_page_result.php:

 

$reviews_count_query = tep_db_query("select count(*) as total " . substr($sql_query, $pos_from, ($pos_to - $pos_from)));

$reviews_count = tep_db_fetch_array($reviews_count_query);

$query_num_rows = $reviews_count['total'];

 

//Line added

if ($query_num_rows == 0) $query_num_rows = 1;

// End Line added

 

$num_pages = ceil($query_num_rows / $max_rows_per_page);

if ($current_page_number > $num_pages) {

$current_page_number = $num_pages;

 

I hope that helps....

 

Cheers

 

 

Guido AlexR Posted on Jan 15 2004, 02:49 AM

 

==========================================

 

I added the line of code into the catalog/admin/classes file but I still get that same error message which is in the catalog/includes file:

Warning: Division by zero in /homepages/45/d87589151/htdocs/miltongems/catalog/includes/classes/split_page_results.php on line 59

 

Is there another alteration that needs doing in the catalog/includes file and what is it?


Mary-Ann

Chief Cook and Bottlewasher

Jack-of-All-Trades

Running 2.2MS2

Share this post


Link to post
Share on other sites
Thanks so much for getting back to me so quickly. I am quite a novice at all of this. Am I supposed to add:

define('DIR_FS_CATALOG', '/home/oscworks/work/new_oscworks/');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

 

somewhere? Please let me know where to add those lines or modify the lines that exist to match the lines you have supplied. Thanks again Strider.

 

The two defines should already be in "\catalog\includes\configure.php" somewhere close to line 33. You need to adjust them to your settings.

 

/Fred

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

×