Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

xmembers and pwa ... help requested


Sarah_h

Recommended Posts

Hi All

 

I have pwa installed and working. I wanted a simple member discount add-on and installed xmembers 2.2. In itself it works great, nice and simple and give anyone who adds an account a predeturmined discount. BUT this discount is given even when someone uses pwa!!!! My question therefore is: has anyone any experience with configuring xmembers to only give discount if the visitor has added an account??

 

Any help here would be very useful and appriciated.

 

Regards

 

Sarah

Link to comment
Share on other sites

Hi All

 

I have pwa installed and working. I wanted a simple member discount add-on and installed xmembers 2.2. In itself it works great, nice and simple and give anyone who adds an account a predeturmined discount. BUT this discount is given even when someone uses pwa!!!! My question therefore is: has anyone any experience with configuring xmembers to only give discount if the visitor has added an account??

 

Any help here would be very useful and appriciated.

 

Regards

 

Sarah

 

Seems I'm replying to my own post!!! Anyway I've made ome changes to catalog/includes/modules/order_total/ot_xmembers.php so that if the visitor uses PWA then they do not get a discount. These are the changes I've made:

 

I've changed the member_flag field in the DB so that it defaults to 1 so that it defaults to everyone getting a discount. Then I've amended ot_xmembers.php like this so that only members get a discount.

 

function calculate_credit($amount) {

global $order, $customer_id;

$od_amount=0;

$od_pc = $this->percentage;

if ($amount > $this->minimum) {

$query = tep_db_query("select member_flag, purchased_without_account from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'"); $query_result = tep_db_fetch_array($query);

if ($query_result['member_flag'] == '1' && $query_result['purchased_without_account'] == '0') {// Calculate tax reduction if necessary

if($this->calculate_tax == 'true') {

// Calculate main tax reduction

$tod_amount = round($order->info['tax']*10)/10*$od_pc/100;

$order->info['tax'] = $order->info['tax'] - $tod_amount;

// Calculate tax group deductions

reset($order->info['tax_groups']);

while (list($key, $value) = each($order->info['tax_groups'])) {

$god_amount = round($value*10)/10*$od_pc/100;

$order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;

}

}

 

$od_amount = round($amount/10);

 

$od_amount = $od_amount + $tod_amount;

}

}

return $od_amount;

}

 

I'm not sure if this is the right way to do it though (probably not!! My coding skills are fairly basic) but it does work.

 

Sarah.

Link to comment
Share on other sites

Seems I'm replying to my own post!!! Anyway I've made ome changes to catalog/includes/modules/order_total/ot_xmembers.php so that if the visitor uses PWA then they do not get a discount. These are the changes I've made:

 

I've changed the member_flag field in the DB so that it defaults to 1 so that it defaults to everyone getting a discount. Then I've amended ot_xmembers.php like this so that only members get a discount.

 

  function calculate_credit($amount) {

    global $order, $customer_id;

    $od_amount=0;

    $od_pc = $this->percentage;

    if ($amount > $this->minimum) {

    $query = tep_db_query("select member_flag, purchased_without_account from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");    $query_result = tep_db_fetch_array($query);

  if ($query_result['member_flag'] == '1' && $query_result['purchased_without_account'] == '0') {// Calculate tax reduction if necessary

    if($this->calculate_tax == 'true') {

// Calculate main tax reduction

      $tod_amount = round($order->info['tax']*10)/10*$od_pc/100;

      $order->info['tax'] = $order->info['tax'] - $tod_amount;

// Calculate tax group deductions

      reset($order->info['tax_groups']);

      while (list($key, $value) = each($order->info['tax_groups'])) {

        $god_amount = round($value*10)/10*$od_pc/100;

        $order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;

      } 

    }

 

$od_amount = round($amount/10);

 

    $od_amount = $od_amount + $tod_amount;

    }

    }

    return $od_amount;

  }

 

I'm not sure if this is the right way to do it though (probably not!! My coding skills are fairly basic) but it does work.

 

Sarah.

 

that works, you could also have done:

 

function ot_xmembers() {

if (tep_session_is_registered('noaccount')) {

$this->enabled = false;

} else {

$this->enabled = MODULE_XMEMBERS_STATUS;

}

......

......

Treasurer MFC

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