[ic] Adding code to order processing area

Rick Bragg lists at gmnet.net
Thu Apr 16 15:22:12 UTC 2009

On Wed, 2009-04-15 at 18:49 -0700, Peter wrote:
> On 04/15/2009 09:41 AM, Rick Bragg wrote:
> > Hi,
> > 
> > Where is the best place to add some custom code to where the order gets
> > processed?  
> etc/log_transaction
> > I don't mind if it means changing core IC code, as I already do that.
> You should try to avoid that.  In fact, the only time you should ever
> have to really do that is to fix bugs and then you should be sending us
> patches so we can fix them in our core code.  There are some rare cases
> where you might need to add new functionality to core as well, but keep
> in mind that whenever you go to upgrade the IC core all your changes
> will be lost.
> Peter

Hi Peter,

update_order_status is what I was looking for.  I agree about making
changes to core files.  Speaking of this file and changes to core, This
is one of the changes that I made.  Actually, I didn't make it, it was
suggested here:

I hope this fix gets into the next version of IC.

Anyway, I need to make an additional change in order to call an outside
program.  the outside program takes 3 args, a store ID, a sku, and a
quantity.  The outside program decrements the inventory of the store's
POS system.

I think my change should be in the following area:


        # Actually update the orderline database
        for(@$lines_ary) {
                my $code = $_->[$odb_keypos];
                my $line = $code;
                $line =~ s/.*\D//;
                next if $already{$line};
               my $status = $shipping{$line} ? $target_status : $linestatus{$code};
#::logDebug("Setting $code to $status");
                $odb->set_field($code, 'status', $status)
                        or do {
                                $::Scratch->{ui_message} = "Orderline $code ship status update failed.";
                if($dotime) {
                        $odb->set_field($code, 'update_date', $update_date)
                                or do {
                                        $::Scratch->{ui_message} = "Orderline $code ship date update failed.";

### Call my outside program code here for inventory syncing...
###           something like:
###           my catalogname = $Config->{CatalogName};
###           system `mycustomsyncprogram --catid $catalogname --sku $sku --quantity $quantity`;



In order to make it compatible with stores that don't use this, I will
need to set a system variable like __USE_CUSTOM_INVENTORY_SYNC__ and
pass that in somehow... Also I should put it through some kind of try

The point is I want the POS sync to happen ONLY when the item is
actually shipped, not at checkout.  I will keep the IC inventory in
place as is, but this is a separate inventory database for the POS.

Does this sound like I'm on the right track? Any suggestions?


This message has been scanned for viruses and
dangerous content by Green Mountain Network, and is
believed to be clean.

More information about the interchange-users mailing list