Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] GroupDiscount


hozone

Recommended Posts

This contribution allow to create Customers Groups, and to bind a discount rate

to them.

The administrator can set groups, group's discount, and bind customers to

groups.

The prices in catalogue are already shown with the applied discount, unlike

other contributions like this that use the "order_total" method, to show a

final discount.

Discount rate is applied on every price, also on product attributes, but it is

not applied on special prices.

 

Download @

osCommerce Italia support: http://www.oscommerceitalia.com

Link to comment
Share on other sites

  • Replies 69
  • Created
  • Last Reply

Top Posters In This Topic

:rolleyes: Hello,

 

Great Contribution, i found that very usefull if you have many customers and they order a lot by month. so you can give them special prices with a discout.

 

but there is one question? in the manual is written this:

 

what is about the prices for non customers. are these prices already shown?

or do you have to loged in your account to the all the prices ??

 

i had installed the CGDiscountSpecials but all the prices are stiked out. is it the same for GDiscountSpecials

 

 

Thanks a lot for help

 

 

Joachim

Link to comment
Share on other sites

Hiya

Thanks for all the hard work on this mod.

I have installed it and it works great,, just having one glitch in it yet.

 

in the Admin side, under customers,, if you go into edit the customer account,, and you assign them to a discount group and click update,, it works,, and if u look in the dbase table,, it is set to the proper group. but if you go back into edit that customer again, at the bottom it shows default again instead of the group you assigned them to,, thus, if u go back in to make changes later to another part of there account. then when u click update, you would be changing them back to default discount status without realizing it.

 

Anyone have any ideals ont his issue?

 

Thanks in advance

Regards

Tom

Link to comment
Share on other sites

  • 2 weeks later...
:rolleyes: Hello,

 

Great Contribution, i found that very usefull if you have many customers and they order a lot by month. so you can give them special prices with a discout.

 

but there is one question? in the manual is written this:

 

what is about the prices for non customers. are these prices already shown?

or do you have to loged in your account to the all the prices ??

 

i had installed the CGDiscountSpecials but all the prices are stiked out. is it the same for GDiscountSpecials

 

 

Thanks a lot for help

 

 

Joachim

you must be logged to show prices.

it's the same of CGDiscountSpecials

osCommerce Italia support: http://www.oscommerceitalia.com

Link to comment
Share on other sites

Hiya

Thanks for all the hard work on this mod.

I have installed it and it works great,, just having one glitch in it yet.

 

in the Admin side, under customers,, if you go into edit the customer account,, and you assign them to a discount group and click update,, it works,, and if u look in the dbase table,, it is set to the proper group. but if you go back into edit that customer again, at the bottom it shows default again instead of the group you assigned them to,, thus, if u go back in to make changes later to another part of there account. then when u click update, you would be changing them back to default discount status without realizing it.

 

Anyone have any ideals ont his issue?

 

Thanks in advance

Regards

Tom

i don't have this issue :(

 

try to download lates GroupDiscount and upload customer_groups.php

osCommerce Italia support: http://www.oscommerceitalia.com

Link to comment
Share on other sites

Davide

Actually,,, version 1.2,, the latest,, is the one i installed

 

it all works,, except when I go into the customer information in the admin side,,

it defaults back to default,, and if u change anything and save it,, then u also drop there group back to default.

 

Any ideal where I would look for this problem?

Regards

Tom

Link to comment
Share on other sites

just a little quick fix:

 

catalog/includes/classes/currencies.php

on line 82

 

you should replace

 

if (strstr($customer_groups_discount, "+") != null) {

with this line:

 

if (strstr($customers_groups_discount, "+") != null) {

notice $customers_groups_discount

 

 

Now you can have positives or negatives discounts.

 

 

thanks hozone for this great contribution.

Link to comment
Share on other sites

...also in

catalog/includes/classes/shoping_cart.php

 

find and replace

 

if (strstr($customer_discount, "+") != null) {
      $products_price = $products_price + $products_price * abs($customer_discount) / 100;
      } else {
      $products_price = $products_price - $products_price * abs($customer_discount) / 100;
      }

 

with

 

if (strstr($customer_discount, "-") != null) {
      $products_price = $products_price - $products_price * abs($customer_discount) / 100;
      } else {
      $products_price = $products_price + $products_price * abs($customer_discount) / 100;
      }

 

you should have 3 occurrences.

Link to comment
Share on other sites

Florin

if you go into customers,, and edit a customer to show something besides a default group,,, and click update,,, then go back into it,, does it show default again,, or does it pick back up on what u had set it for ?

 

on me,, for some reason,, it keeps going back to default,,, it is stored in the dbase correctly,, but next time u go into edit that account,, it show's default,, and if u dont remember to change it from default back to what u had it set for,, it changes to default then,, and a customer is not gonna get there discount after that,,

can u check for me to see if it is doing that to you as well?

 

Tom

Link to comment
Share on other sites

Actually,, I found my problem,, there was a missing sql queery statement,,

after i tracked it down,, and added it,, it worked

i dont think it was left out of the mod,, but more that i have so many mod's added on that there was another one needed.

 

at anyrate,, Thanks to all

 

Regards

Tom

Link to comment
Share on other sites

this is customers_groups.php from contrib_GroupDiscount_1.2.zip, and it works for me.

 

<?php
/*
 Group Discount
 by hOZONE, [email protected], http://hozone.cjb.net
 
 visit osCommerceITalia, http://www.oscommerceitalia.com

 derived by:
 Discount_Groups_v1.1, by Enrico Drusiani, 2003/5/22
 
 for:
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 
 Copyright (c) 2003 osCommerce
 
 Released under the GNU General Public License 
*/

 require('includes/application_top.php');
 
 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if (tep_not_null($action)) {
   switch ($action) {

     case 'update':
       $error = false;
    $customers_groups_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
 $customers_groups_name = tep_db_prepare_input($HTTP_POST_VARS['customers_groups_name']);
 $customers_groups_discount_sign = tep_db_prepare_input($HTTP_POST_VARS['customers_groups_discount_sign']);
       $customers_groups_discount = tep_db_prepare_input($HTTP_POST_VARS['customers_groups_discount']);
       tep_db_query("update " . TABLE_CUSTOMERS_GROUPS . " set customers_groups_name='" . $customers_groups_name . "', customers_groups_discount='" . $customers_groups_discount_sign . $customers_groups_discount . "'  where customers_groups_id = " . tep_db_input($customers_groups_id) );
       tep_redirect(tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $customers_groups_id));
 break;
       
     case 'deleteconfirm':
       $group_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
       tep_db_query("delete from " . TABLE_CUSTOMERS_GROUPS . " where customers_groups_id= " . $group_id); 
       $customers_id_query = tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where customers_groups_id=" . $group_id);
       while($customers_id = tep_db_fetch_array($customers_id_query)) {
           tep_db_query("UPDATE " . TABLE_CUSTOMERS . " set customers_groups_id=1 where customers_id=" . $customers_id['customers_id']);
       }     
       tep_redirect(tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')))); 
       break;
       
     case 'newconfirm' :
       $customers_groups_name = tep_db_prepare_input($HTTP_POST_VARS['customers_groups_name']);
    $customers_groups_discount_sign = tep_db_prepare_input($HTTP_POST_VARS['customers_groups_discount_sign']);
       $customers_groups_discount = tep_db_prepare_input($HTTP_POST_VARS['customers_groups_discount']);
       tep_db_query("insert into " . TABLE_CUSTOMERS_GROUPS . " set customers_groups_name = '" . $customers_groups_name . "',customers_groups_discount = '" . $customers_groups_discount_sign . $customers_groups_discount . "'");
       tep_redirect(tep_href_link('customers_groups.php', tep_get_all_get_params(array('action'))));
       break;
   }
 }
?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php
 if ($HTTP_GET_VARS['action'] == 'edit') {
   $customers_groups_query = tep_db_query("select c.customers_groups_id, c.customers_groups_name, c.customers_groups_discount from " . TABLE_CUSTOMERS_GROUPS . " c  where c.customers_groups_id = '" . $HTTP_GET_VARS['cID'] . "'");
   $customers_groups = tep_db_fetch_array($customers_groups_query);
   $cInfo = new objectInfo($customers_groups);
?>

<script language="javascript"><!--
function check_form() {
 var error = 0;

 var customers_groups_name = document.customers.customers_groups_name.value;
 
 if (customers_groups_name == "") {
   error_message = "<?php echo ERROR_CUSTOMERS_GROUPS_NAME; ?>";
   error = 1;
 }

 if (error == 1) {
   alert(error_message);
   return false;
 } else {
   return true;
 }
}
//--></script>

     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>

  <tr><?php echo tep_draw_form('customers', 'customers_groups.php', tep_get_all_get_params(array('action')) . 'action=update', 'post', 'onSubmit="return check_form();"'); ?>
       <td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td>
     </tr>

     <tr>
       <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
         <tr>
           <td class="main"><?php echo ENTRY_GROUPS_NAME; ?></td>
           <td class="main"><?php echo tep_draw_input_field('customers_groups_name', $cInfo->customers_groups_name, 'maxlength="32"', false); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo ENTRY_DEFAULT_DISCOUNT; ?></td>
           <td class="main">
     <select name="customers_groups_discount_sign">
          <option name="minus" value="-" <?php if (strstr($cInfo->customers_groups_discount,"-")) echo "selected=\"selected\"" ?>>-</option>
  	 <option name="plus" value="+"  <?php if (strstr($cInfo->customers_groups_discount,"+")) echo "selected=\"selected\"" ?>>+</option>
     </select> <?php echo tep_draw_input_field('customers_groups_discount', substr($cInfo->customers_groups_discount,1,strlen($cInfo->customers_groups_discount)), 'maxlength="9"', false); ?> %
	 </td>
   </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
     <tr>
       <td align="right" class="main"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('action','cID'))) .'">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
     </tr>
     </form>

  <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '70'); ?></td>
     </tr>

<?php
 } else if($HTTP_GET_VARS['action'] == 'newdiscount') {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
     
<?php
 } else if($HTTP_GET_VARS['action'] == 'new') {
    
?>
<script language="javascript"><!--
function check_form() {
 var error = 0;

 var customers_groups_name = document.customers.customers_groups_name.value;
 
 if (customers_groups_name == "") {
   error_message = "<?php echo ERROR_CUSTOMERS_GROUPS_NAME; ?>";
   error = 1;
 }

 if (error == 1) {
   alert(error_message);
   return false;
 } else {
   return true;
 }
}
//--></script>

     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
     <tr><?php echo tep_draw_form('customers', 'customers_groups.php', tep_get_all_get_params(array('action')) . 'action=newconfirm', 'post', 'onSubmit="return check_form();"'); ?>
       <td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td>
     </tr>
     <tr>
       <td class="formArea"><table border="0" cellspacing="2" cellpadding="2">
         <tr>
           <td class="main"><?php echo ENTRY_GROUPS_NAME; ?></td>
           <td class="main"><?php echo tep_draw_input_field('customers_groups_name', '', 'maxlength="32"', false); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo ENTRY_DEFAULT_DISCOUNT; ?></td>
           <td class="main">
                <select name="customers_groups_discount_sign"><option name="minus" value="-" selected="selected">-</option><option name="plus" value="+">+</option></select> <?php echo tep_draw_input_field('customers_groups_discount', '0', 'maxlength="9"', false); ?> %
	 </td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
     <tr>
       <td align="right" class="main"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('action','cID'))) .'">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
     </tr>
     </form>
<?php 
 } else {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr><?php echo tep_draw_form('search', 'customers_groups.php', '', 'get'); ?>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
           <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search'); ?></td>
         </form></tr>
       </table></td>
     </tr>
     <tr>

         <?php
         switch ($listing) {
             case "id-asc":
             $order = "g.customers_groups_id";
             break;
             case "group":
             $order = "g.customers_groups_name";
             break;
             case "group-desc":
             $order = "g.customers_groups_name DESC";
             break;
             case "discount":
             $order = "g.customers_groups_discount";
             break;
             case "discount-desc":
             $order = "g.customers_groups_discount DESC";
             break;
             default:
             $order = "g.customers_groups_id ASC";
         }
         ?>
    <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr class="dataTableHeadingRow">
         <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NAME; ?> <a href="<?php echo "$PHP_SELF?listing=group"; ?>"><b>Asc</b></a> <a href="<?php echo "$PHP_SELF?listing=group-desc"; ?>"><b>Desc</b></a></td>
                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_DISCOUNT; ?> <a href="<?php echo "$PHP_SELF?listing=discount"; ?>"><b>Asc</b></a> <a href="<?php echo "$PHP_SELF?listing=discount-desc"; ?>"><b>Desc</b></a></td>
                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
     </tr>

<?php
   $search = '';
   if ( ($HTTP_GET_VARS['search']) && (tep_not_null($HTTP_GET_VARS['search'])) ) {
     $keywords = tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['search']));
     $search = "where g.customers_groups_name like '%" . $keywords . "%'";
   }

   $customers_groups_query_raw = "select g.customers_groups_id, g.customers_groups_name, g.customers_groups_discount from " . TABLE_CUSTOMERS_GROUPS . " g  " . $search . " order by $order";
   $customers_groups_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_groups_query_raw, $customers_groups_query_numrows);
   $customers_groups_query = tep_db_query($customers_groups_query_raw);

   while ($customers_groups = tep_db_fetch_array($customers_groups_query)) {
     $info_query = tep_db_query("select customers_info_date_account_created as date_account_created, customers_info_date_account_last_modified as date_account_last_modified, customers_info_date_of_last_logon as date_last_logon, customers_info_number_of_logons as number_of_logons from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customers_groups['customers_groups_id'] . "'");
     $info = tep_db_fetch_array($info_query);

     if (((!$HTTP_GET_VARS['cID']) || (@$HTTP_GET_VARS['cID'] == $customers_groups['customers_groups_id'])) && (!$cInfo)) {
       $cInfo = new objectInfo($customers_groups);
     }

     if ( (is_object($cInfo)) && ($customers_groups['customers_groups_id'] == $cInfo->customers_groups_id) ) {
       echo '          <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_groups_id . '&action=edit') . '\'">' . "\n";
     } else {
       echo '          <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID')) . 'cID=' . $customers_groups['customers_groups_id']) . '\'">' . "\n";
     }
?>
               <td class="dataTableContent"><?php echo $customers_groups['customers_groups_name']; ?></td>
               <td class="dataTableContent" align="right"><?php echo $customers_groups['customers_groups_discount']; ?>%</td>
               <td class="dataTableContent" align="right"><?php if ( (is_object($cInfo)) && ($customers_groups['customers_groups_id'] == $cInfo->customers_groups_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID')) . 'cID=' . $customers_groups['customers_groups_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
             </tr>
<?php
   }
?>
             <tr>
               <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <td class="smallText" valign="top"><?php echo $customers_groups_split->display_count($customers_groups_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td>
                   <td class="smallText" align="right"><?php echo $customers_groups_split->display_links($customers_groups_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></td>
                 </tr>
<?php
   if (tep_not_null($HTTP_GET_VARS['search'])) {
?>
                 <tr>
                   <td align="right" colspan="2"><?php echo '<a href="' . tep_href_link('customers_groups.php') . '">' . tep_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td>
                 </tr>
<?php
   } else {
?>
        <tr>
                   <td align="right" colspan="2" class="smallText"><?php echo '<a href="' . tep_href_link('customers_groups.php', 'page=' . $HTTP_GET_VARS['page'] . '&action=new') . '">' . tep_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>
                 </tr>
<?php
}
?>
               </table></td>
             </tr>
           </table></td>
<?php
 $heading = array();
 $contents = array();
 switch ($HTTP_GET_VARS['action']) {
   case 'confirm':
       if ($HTTP_GET_VARS['cID'] != 1) {
           $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_GROUP . '</b>');
           $contents = array('form' => tep_draw_form('customers_groups', 'customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_groups_id . '&action=deleteconfirm'));
           $contents[] = array('text' => TEXT_DELETE_INTRO . '<br><br><b>' . $cInfo->customers_groups_name . ' </b>');
           if ($cInfo->number_of_reviews > 0) $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('delete_reviews', 'on', true) . ' ' . sprintf(TEXT_DELETE_REVIEWS, $cInfo->number_of_reviews));
           $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_groups_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
       } else {
           $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_GROUP . '</b>');
           $contents[] = array('text' => 'Non e\' consentito cancellare il gruppo:<br><br><b>' . $cInfo->customers_groups_name . ' </b>');
       }
     break;
   default:
     if (is_object($cInfo)) {
       $heading[] = array('text' => '<b>' . $cInfo->customers_groups_name . ' </b>');
       $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_groups_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link('customers_groups.php', tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_groups_id . '&action=confirm') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>' );
     }
     break;
 }

 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
   echo '            <td width="25%" valign="top">' . "\n";

   $box = new box;
   echo $box->infoBox($heading, $contents);

   echo '            </td>' . "\n";
 }
?>
         </tr>
       </table></td>
     </tr>
<?php
 }
?>
   </table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

osCommerce Italia support: http://www.oscommerceitalia.com

Link to comment
Share on other sites

The problem I had:

 

Let's say we have a product that costs 10 euro.

 

Using this contrib, I could make discounts (-50%), i.e. 5 euro .

 

But I coundn't make the price be 15 euro. (+50%) .

 

assuming $customers_groups_discount= "+50" and $customer_discount ="+0" in db;

after the following line (in catalog/includes/classes/shopping_cart.php)

 

$customer_discount = $customer_discount + $customers_groups_discount;

 

$customer_discount would be "50", without the "+" sign , so this condition

if (strstr($customer_discount, "+") != null) {

 

will always be false, thus no addition to the initial price.

 

After those little fixes posted above, everything works just fine :)

Link to comment
Share on other sites

  • 2 weeks later...

I am using CGDiscount but want users not logged in to my sight to be able to see the base price of an item. I don't want the user to see "Must be logged in for prices!" Can anyone suggest what changes need to be made to make this happen. Thanks in advance.

Link to comment
Share on other sites

use this function in includes/classes/currencies.php

 

	//CGDiscountSpecials start
   function display_price($products_price, $products_tax, $quantity = 1) {
     global $customer_id;
        $query = tep_db_query("select g.customers_groups_discount from " . TABLE_CUSTOMERS_GROUPS . " g inner join  " . TABLE_CUSTOMERS  . " c on g.customers_groups_id = c.customers_groups_id and c.customers_id = '" . $customer_id . "'");
        $query_result = tep_db_fetch_array($query);
        $customers_groups_discount = $query_result['customers_groups_discount'];
        $query = tep_db_query("select customers_discount from " . TABLE_CUSTOMERS . " where customers_id =  '" . $customer_id . "'");
        $query_result = tep_db_fetch_array($query);
        $customer_discount = $query_result['customers_discount'];
        $customer_discount = $customer_discount + $customers_groups_discount;
     if ($customer_discount >= 0) {
     $products_price = $products_price + $products_price * abs($customer_discount) / 100;
     } else {
     $products_price = $products_price - $products_price * abs($customer_discount) / 100;
     }
     return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
   }

function display_price_nodiscount($products_price, $products_tax, $quantity = 1) {
     global $customer_id;
         return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
   }
   //CGDiscountSpecials end

osCommerce Italia support: http://www.oscommerceitalia.com

Link to comment
Share on other sites

Any ideal where I would look for this problem?

Regards

Tom

Make sure that the *group* is in the query/array that populates the fields containing the customer info, otherwise it will default.

 

I have not used this contribution, but often see this problem.

 

HTH

 

Matti

Link to comment
Share on other sites

I installed the CGDiscount and at some points it displays a message:

1146 - Table 'computer_osc1.TABLE_CUSTOMERS_GROUPS' doesn't exist

select g.customers_groups_discount from TABLE_CUSTOMERS_GROUPS g inner join customers c on g.customers_groups_id = c.customers_groups_id and c.customers_id = ''

 

i inserted the table as instructed in the SQL file and everthing in the admin panel works fine. When the browser tries to display prices it put out this error.

 

Can anyone help?

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