PDA

View Full Version : Minimum Order Value based on Price Band


Pneumatus
05-Sep-2005, 11:06 AM
Hi,

I'd like to be able to set up minimum order values on a per-customer-group basis.

Eg.

Retail - No minimum
Trade1 - £150 Minimum
Trade2 - £300 Minimum

As far as i can see, the only option for setting a minimum order value is on the whole site for all groups, or a maximum order value on a per-buyer basis - Is there something I've missed or a hack i can make to ActinicOrder.pm to check the buyers price schedule using GetBuyerAndAccount() in CheckBuyerLimit() rather than GetBuyer() and then comparing $Account->{PriceSchedule} against some hard-coded Schedules for the minimum... Which looks completely possible... so will $Account->{PriceSchedule} return the number for the price schedule in the 'Price Schedules' table related to the buyer in ActinicCatalog.mdb

I hope this all makes sense because i've been trying to work things out as I go along :)

Pneumatus
05-Sep-2005, 11:28 AM
Well, I think i'm nearly there... Can you please confirm what format the number for $nLowerBound should be - Is it

$nLowerBound = 150.00;
_or_
$nLowerBound = 15000;

For a £150.00 minimum order value in the CheckBuyerLimit() sub, or something completely different?

Bruce
07-Sep-2005, 10:51 AM
Hi Pneumatus,

It should be 15000

Pneumatus
07-Sep-2005, 11:08 AM
Thanks Bruce,

Can you confirm that from this code:

($Status, $sMessage, $pAccount) = ACTINIC::GetCustomerAccount($$pBuyer{AccountID}, ACTINIC::GetPath());

$pAccount->{PriceSchedule} contains the nID field from the 'Price Schedules' table in ActinicCatalog.mdb

zmagyar
07-Sep-2005, 02:40 PM
If you need the schedule ID it is better to use ActinicOrder::GetScheduleID which is already tested and covers all the cases.

Probably the best bet if you set up a hash like
$::BuyerLimits =
{
$ActinicOrder::RETAILID => 0,
1 => 15000,
2 => 300
}
Then change the line

my $nLowerBound = $$::g_pSetupBlob{'MIN_ORDER_VALUE'};in CheckBuyerLimit tomy $nLowerBound = $::BuyerLimits{GetScheduleID()};

Something like this should work IMO. But please note it was written directly to the forum (IOW I haven't tested it) therefore some finetunning may be required.

I hope this helps.

Cheers

Pneumatus
07-Sep-2005, 03:11 PM
Thanks a lot Zoltan,

Didn't notice GetScheduleID() - looks like it will do the job nicely. The only change I think the above code needs is passing the Digest to the sub rather than passing with no params i.e.
my $nLowerBound = $::BuyerLimits{GetScheduleID($sDigest)};
Else it will always return $ActinicOrder::RETAILID.

Thanks again :)

zmagyar
07-Sep-2005, 03:16 PM
Yes, you are right, the digest is needed there. I'm always missing the obvious even if I should know that according to the function header :).