Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Discounts


dotDigital

Recommended Posts

Posted

Is there a way in OScommerce to add a % discount to the beginning or end of a transaction that is based on a customers "criteria" We want to give "Corporate Discounts" to those who are corporations buying in certain price ranges. i.e $100 - $500 would receive a 5% discount.

 

Will anyone point in the direction of how this is done if it can be?

 

Thanks in advance

Posted

Perhaps the easiest way I can think of would be to apply the discount before the product was added to the shopping cart - then everything else would follow in suit.

You could do this by editing this file:

catalog/includes/classes/shopping_cart.php

specifically this function:

function calculate()

 

The variable:

$this->total

returns the price that is sent to the payment modules.

 

You would have to use the global $customer_id as an identifier for corporations - fetching this info from the database - if there is no identifier in the database for corporations then you would either have to create a new field for create_account or create an array within the function with product_id's that == corporation.

Then compare global $customer_id to array in a loop to determine if discount is applicable. Write in function -

if ($this->total > 100 && $this->total < 500)

{ $this->total = $this->total * .5;

}

 

Something like that..

Lloyd

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...