[ic] Re: intercept item insert in cart

Brian J. Miller brian at endpoint.com
Thu Aug 11 18:32:46 EDT 2005


Ethan Rowe wrote:
> ic at 3edge.com wrote:
> 
>> Alessandro Poletto writes:
>>
>>> I'am searching to make a logger for some actions that can generate
>>> interesting reports in my shops.
>>> One of them is a report of the items that is inserted in the cart and
>>> after is dropped out without buying.
>>> I've thinked that a simple sql insert in a logger table of the item
>>> was enough, but I've noticed that there isn't a simple way to
>>> intercept the item's insert moment.
>>> I go to explain: when the customer insert a item in the cart the form
>>> with [process-target] method and "mv_order_item", "mv_oder_quantity"
>>> hidden fields send to the "process-target" page all the datas.
>>> I suppose that the [process-target] page is ord/basket.html so i've
>>> tried in that page with: [scratch mv_order_item] or [cgi
>>> mv_order_item] or [value mv_order_item] (disperation-mode), but
>>> nothing will be displayed.
>>> Where and how can I "intercept" the item's adding?
>>> Many thanks to all in advance
>>
>>
>>
>> If you are using the foundation store I think you want to take a look in:
>> templates/components/cart
>> There's the information that is shown in the shopping cart ... and the
>> SKU of the item in the basket is then [item-code] afaik.
>> I would think though that on average the placing of an item in the
>> shopping cart is logged (in some session files(?)) and you could
>> probably write something to analyse those? But not sure about that.
>>
> I have a CartTrigger directive I'm planning on submitting to the core
> group for inclusion in the main Interchange distribution once I've
> tested it a bit more... it's only a week old or so.  It allows you to
> specify subroutines to execute whenever the cart contents change; the
> changes are passed to the subroutine such that the sub gets a reference
> to the affected cart, the new row, the old row, the action that
> occurred, and the cart name.  But it isn't ready just yet, and will of
> course need review by the IC core group.  Thus far it's working
> reasonably well, but my tests have been pretty simple.
> 

This sounds like a nice addition by Ethan. But another simple way to
handle this is to create a form profile for the form being submitted
when the item is added, in which you can do essentially anything. Note
that you will have to process the arguments in $CGI by hand rather than
using any specific IC tricks. I am currently using this method, a hack
to be sure, to add an on-the-fly item to the cart at the same time as
another specific item, among other things. Obviously if you have lots of
static item pages this can be tedious to add.

HTH,

B


More information about the interchange-users mailing list