[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] Re: Accessing looped data in a usertag


Grant wrote:
My perl skills are weak.  Could anyone tell me the best way to access
 all orderline table data for an order inside a usertag?

 - Grant

I've been working on this for many hours and am still stuck.  I
basically need something like this to work:

$Tag->loop({ search =>
"fi=orderline/ml=999999/st=db/sf=order_number/se=1234/op=eq/nu=0" },
$text->text("$Tag->loop-code");

I've fiddled with the syntax ad nauseum and tried every different
approach I can think of but I can't get it to behave like it does
outside of a usertag.  Could someone point me in the right direction?

- Grant

Hi Grant,

You may want to try using a query to pull the orderline data, something like this in a usertag:

my $db = Vend::Data::database_exists_ref('orderline');
my $sql = "SELECT code, sku FROM orderline WHERE order_number = '1234'";

my $dbh = $db->[$Vend::Table::DBI::DBI];
my $sth = $dbh->prepare($sql);
$sth->execute();

if ($sth) {
	while (my $sql_results = $sth->fetchrow_hashref()) {
		my $code = $$sql_results{code};
		my $sku = $$sql_results{sku};
	}
}

Take it easy,

--
Ron Phipps
End Point Corporation
suppressed
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.