[ic] overriding MaxQuantityField in admin order entry UI -admin/entry.html

Mike Heins mike at perusion.com
Sun Jul 25 00:21:06 EDT 2004


Quoting Akash Shah (ic_user at hotmail.com):
> >From: Mike Heins <mike at perusion.com>
> >
> >Quoting Jon Jensen (jon at endpoint.com):
> >> On Fri, 23 Jul 2004, Ed LaFrance (New Media E.M.S.) wrote:
> >>
> >> > >We use the MaxQuantityField configuration setting to prevent ordering 
> >more
> >> > >than stock. However, for the admin order entry UI, we want to 
> >override
> >> > >this behavior, (probably add a checkbox to override it 
> >conditionally). Is
> >> > >there any hidden parameter which can be set to achieve this 
> >functionality ?
> >> >
> >> > Try adding this near the top of admin/entry.html:
> >> >
> >> >          [calc]
> >> >                  $Config->{MaxQuantityField} = '';
> >> >          [/calc]
> >> >
> >> >
> >> > ...I'm not sure if this is sticky from page to page. If it is not, you 
> >may
> >> > have problems retaining your quantities when submitting the order.
> >>
> >> It's not sticky. (Except unpredictably in older IC versions in PreFork
> >> mode due to a bug.)
> >>
> >> You could put that code in your admin Autoload
> >> ($VENDROOT/lib/UI/pages/admin/.autoload) and then anywhere in the admin
> >> should be free of the MaxQuantity restriction. There still may be 
> >trouble
> >> on process or ui actions, though, come to think of it.
> >>
> >
> >You could do:
> >
> >GlobalSub <<EOS
> >sub remove_max_restriction {
> >	if($Vend::admin) {
> >	    $Vend::Cfg->{MaxQuantityField} = '';
> >	}
> >	return;
> >}
> >EOS
> >
> >Then in catalog.cfg:
> >
> >	Autoload  remove_max_restriction
> >
> >
> >--
> >Mike Heins
> 
> Thx for the help.
> 
> I tried doing this using as a Sub as I don't have access to interchange.cfg 
> at my ISP.

Boo, hiss.

> I added  to my catalog.cfg as a Sub and added the Autoload line 
> as under:
> 
> #### begin snippet from my catalog.cfg
> 
> ## not to allow people to order more than available inventory
> MaxQuantityField  inventory:quantity
> 
> ## Define a Sub routine to remove the MaxQuantity requirement for admin user
> Sub <<EOS
> sub remove_max_restriction {
> 	if($Vend::admin) {

Here you want instead:

	if($Session->{admin}) {

> 	    $Config->{MaxQuantityField} = '';
> 	}
> 	return;
> }
> EOS
> ## Autoload above defined routine
> Autoload  remove_max_restriction
> 
> ### end code snippet
> 
> I applied the changes and tested using the entry.html page. It does not 
> work :(.  Is there any way to debug what can be going wrong here ? For the 
> subroutine, I tried both $Config->... and $Vend::Cfg->..., but the same 
> result. There are no errors in my catalog's error.log.

The above should fix it.

> 
> One of the things that I found is that if the inventory values is not-null, 
> it sets the mv_max_quantity for that item in the cart (looked thru the 
> session info on getconfig.html page) to that value. But if the entry is 
> null (there is no entry for that sku in the inventory table), then there is 
> no restriction for the maximum quantity. This happens even without applying 
> the changes mentioned above.

That is how it is designed -- it allows you to have certain items that
are not subject to checking, without putting an artificial number in.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

"Laughter is inner jogging." -- Norman Cousins


More information about the interchange-users mailing list