[ic] Adding code to order processing area

Peter peter at pajamian.dhs.org
Fri Apr 24 05:17:05 UTC 2009

On 04/16/2009 08:22 AM, Rick Bragg wrote:
> 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:
> http://www.icdevgroup.org/pipermail/interchange-users/2005-May/043065.html

I completely forgot about that.  That is four years old!  Anyways, I'll
look back into it, test it and commit the patch when I get the chance.
It has been a while since I looked into that.

> 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.";
>                                 return;
>                         };
>                 if($dotime) {
>                         $odb->set_field($code, 'update_date', $update_date)
>                                 or do {
>                                         $::Scratch->{ui_message} = "Orderline $code ship date update failed.";
>                                         return;
>                                 };
>                 }
> ### 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
> block
> 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?

I'll have to look more closely, but it would not be out of the realm of
reasonableness for us to add a specialsub hook that would be called when
the status of a line item or of an order changes.  Then you would be
able to simply add a specialsub into catalog.cfg to do whatever you want
at that point.  Of course someone has to have time to implement it in core.


More information about the interchange-users mailing list