[ic] Price Tag Efficiency

Thomas J.M. Burton interchange-users@icdevgroup.org
Tue Mar 4 15:20:01 2003


Hello IC Users,

I tried searching the archives for an answer, but didn't come up with
anything about this. Hopefully someone out there has an answer.

I have the following code in my results page to display discount
pricing info for each item:

[if discount [item-code]]
  <s>[currency][item-param price][/currency]</s><br>
  [calc]int 100 * ( 1 - ([price code="[item-param code]" noformat=1 discount=1]/[item-param price]) )[/calc]% off!<br>
  <font color="red"><b>[price code="[item-param code]" discount=1]</b></font>
[/if]

As you can see, I'm using the discounted price with noformat=1 and the
regular price to calculate the percentage off.

The catalog uses a MySQL db with a few separate tables for different
product categories and I've noticed that the [price] tag (or using
[item-price] for that matter) creates two queries for each item, like
so:

  select code from seedpony where code = 'X711-13-218DK'
  select price from seedpony where code = 'X711-13-218DK'

Seems to me this could be done in one query, such as:

  select code,price from seedpony where code = 'X711-13-218DK'

or even just:
  select price from seedpony where code = 'X711-13-218DK'


When a page of results is returned, it does this for each product
that's displayed on the page. Does anyone know of a more efficient way
to do what I'm doing above? Something that wouldn't create so many
redundant queries.

Or, has the [price] tag been improved in a newer version of IC so that
these queries are simplified?

I'm running IC 4.8.6

Thanks in advance,
Tom

___________________________________
Thomas J.M. Burton
Global Focus Digital Media, LLC
www.globalfocusdm.com