Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hey OSC Gurus..

 

I am trying to add another check in modules/shipping/freecount.php to check if the customers_group_id ( from seperate pricing per customer contribution) is 0 or not.

 

If the customer is retail ( customers_group_id will be 0 ) the free shipping will be enabled. If not ( value 1, 2, 3, etc.. ) it will check the check_flag as false.

 

Here is what I have so far but not working. Any help would greatly be appreciated.. I have commented the new code and described what I am trying to do..

 

    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREECOUNT_NUMBER <= $total_count) ) {
         if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREECOUNT_ZONE > 0) ) {
           $check_flag = false;
           $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREECOUNT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
           while ($check = tep_db_fetch_array($check_query)) {
             if ($check['zone_id'] < 1) {
               $check_flag = true;
               break;
             } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
               $check_flag = true;
               break;
             }
           }
 //make query again to see if customer is dropship, wholesale or retail
 //retail customers have a customers_group_id with a value of 0 
 //all other customers groups have higher value like 1, 2, 3
 //attempting to make a query that will make the check flag false if the 
 //customer who is making the order has a customers_group_id that is not 0
 
 $check_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . " where customers_id = $order['customers_id']");
           while ($check_group = tep_db_fetch_array($check_group_query)) {
             if ($check_group['customers_group_id'] != 0) {
               $check_flag = false;
               break;
             } 
    }
 //end of 2nd check query if customers_group_id is 0 then the $check_flag should still read last value before query
 
           if ($check_flag == false) {
             $this->enabled = false;
           }
         }
      }
      else{
          $this->enabled = false;
      }
   }

 

 

Any help would be very greatful, i think i have a mistake on the cutomers_id part of the querry..

 

Mike

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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