[freeside-users] Dynamically defining a pkgpart price in perl

Tim Yardley tyardley at fusionbroadband.com
Tue Feb 28 16:12:49 PST 2006


Peter;

What you described is how our system was set up.  We have to move away
from that because we want to vary price without creating new packages.
We also want to limit the number of "types" we create in the same step.
If that wasn't the case, your suggestion would have been fine.  Sadly,
the pricing differs enough that we can't simply lump them into "groups"
and it ends up being nearly a 1:1 relationship of agent to agent type in
our current configuration.

We have a plan to do so now, leveraging freeside's dynamic price plan
notions.  Although, I do admit that I am making the assumption that I
properly understand Ivan's previous reply and corresponding code.  At
this point, I am mainly asking if my understanding of Ivan's
implementation is correct.

/tmy

----

Tim Yardley
Vice President of Research and Development
Fusion Broadband, Inc.

----
 
-----Original Message-----
From: freeside-users-bounces at sisd.com
[mailto:freeside-users-bounces at sisd.com] On Behalf Of Bowen, Peter
Sent: Tuesday, February 28, 2006 4:18 PM
To: Freeside users mailing list
Subject: RE: [freeside-users] Dynamically defining a pkgpart price in
perl

Tim,
	What you want to do is to segment your agents into groups....
super agents, big whiners, big winners, whatever and make those your
agent types.  Then you assign the agents to the proper agent type.
Create your packages, and assign them the proper agent types.  I think
you'll find that your agents will fall into groupings pretty quickly.

-Peter  

-----Original Message-----
From: freeside-users-bounces at sisd.com
[mailto:freeside-users-bounces at sisd.com] On Behalf Of Tim Yardley
Sent: Tuesday, February 28, 2006 10:35 AM
To: freeside-users at sisd.com
Subject: RE: [freeside-users] Dynamically defining a pkgpart price in
perl

 
Ivan;

I assume by custom price plan you mean utilizing FS::part_pkg::PLAN
(with PLAN being defined by us).  In the docs it says to take a look at
eg/plan_template.pm but I do not see that in the 1.5.7 tarball or in
cvs.  As such, I assume leveraging something like
FS/part_pkg/subscription.pm and rewriting the calc_recur function would
demonstrate the same as the below original attempt.  Something like this
perhaps:

sub calc_recur {
  my($self, $cust_pkg) = @_;

  if (1) {
    # default to $29.95
    29.95;
  else {
    $self->option{'recur_fee'}; # assuming this is say $19.95 in this
case
  }
}

Is there any available documentation for the info array or calling
mechanisms for this?  My assumption is the info array can have anything
we want in it and that just maps directly to part_pkg_option entries of
the same name.  In our case, we want to vary the price based on agent,
looking up the values correspondingly from the database, so a good start
for us would seemingly be FS/part_pkg/sql_generic.pm with some simple
logic to pull prices from a table based on the combination of pkgpart
and agent.

Is this the intended method of use for this?  Also, is there any
documentation hidden somewhere for this other than the code itself?  I
checked around, but was unable to find anything.  Any help you can
provide is appreciated.

/tmy


-----Original Message-----
From: freeside-users-bounces at sisd.com
[mailto:freeside-users-bounces at sisd.com] On Behalf Of Ivan Kohler
Sent: Monday, February 27, 2006 3:57 PM
To: Freeside users mailing list
Subject: Re: [freeside-users] Dynamically defining a pkgpart price in
perl

On Mon, Feb 27, 2006 at 03:45:52PM -0600, Lee Sharpe wrote:
> My overall goal is to make the setup and recurring fees for a package
> definition be different, depending on which agent purchased the
package.
> 
> To accomplish this, my plan was to insert perl code into the
optionvalue
> column of the part_pkg_option table.  For example (using some test
code
> that would obviously always return 29.95):
> 
>  optionnum | pkgpart |  optionname   |            optionvalue
> 
>  
>
----------+---------+---------------+-----------------------------------
>        596 |    2282 | recur_fee     | if (1) { 29.95; } else { 19.95;
}
> 
> Is this allowed, and, if so, is this the correct way of doing this?

No and no.  You could use separate package definitions for each agent, 
or write a custom price plan in FS/FS/part_pkg/

-- 
_ivan
_______________________________________________
freeside-users mailing list
freeside-users at sisd.com
http://420.am/cgi-bin/mailman/listinfo/freeside-users
_______________________________________________
freeside-users mailing list
freeside-users at sisd.com
http://420.am/cgi-bin/mailman/listinfo/freeside-users
_______________________________________________
freeside-users mailing list
freeside-users at sisd.com
http://420.am/cgi-bin/mailman/listinfo/freeside-users


More information about the freeside-users mailing list