MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] help with [calc] please



Hi Otis,

i am not sure...

Otis Gospodnetic wrote:
> Can [calc] be used like I'm trying to use it below?
> I'm looping through items in a cart and trying to add their prices so that I
> can show the total ([subtotal] doesn't work for me, probably because of a
> different db design).
> It doesn't really work - I see MV tags where the Total should be.
> 
> Is there another/better/proper/working way to do this?
> 
> [if items] [then] [item-list]
> [sql type=list query="SELECT our_retail_price
> FROM product_term WHERE term_id = '[item-code]'"]
>         [set our_retail_price][sql-param our_retail_price][/set]

If you want to use a [scratch our_retail_price], you hat to use this

         [set scratch our_retail_price][sql-param
our_retail_price][/set]

or

[perl arg=scratch]
       $Safe{'scratch'}->{'our_retail_price'} = [sql-param
our_retail_price];
       return '';
[/set]

> 
>         [set total-price]

         [set scratch total-price]

>                 [calc][scratch total-price] + [scratch our_retail_price][/calc]
>         [/set]
> 
> [/sql]
> [/item-list][/then][/if]
> 
> Total: [scratch total-price]


Maybe you can use this...

 [if items] [then] [item-list]
 [sql type=list query="SELECT our_retail_price
 FROM product_term WHERE term_id = '[item-code]'"]

[perl arg=scratch]
	$retailprice = [sql-param our_retail_price];
	$b = $Safe{'scratch'}->{'our_total_price'};
	$c = $b + $retailprice;
	$Safe{'scratch'}->{'our_total_price'} = $c;
       return '';
[/set]
[/sql]
[/item-list][/then][/if]
 
 Total: [scratch our_total-price]


or

 [if items] [then] [item-list]
 [sql type=list query="SELECT our_retail_price
 FROM product_term WHERE term_id = '[item-code]'"]

[perl arg=scratch]
	$retailprice = [sql-param our_retail_price];
	$c = [total-price noformat] + $retailprice;
	$Safe{'scratch'}->{'our_total_price'} = $c;
       return '';
[/set]
[/sql]
[/item-list][/then][/if]
 
 Total: [scratch our_total-price]

or

[if items] [then] [item-list]
 [sql type=list query="SELECT our_retail_price
 FROM product_term WHERE term_id = '[item-code]'"]

[perl arg=scratch]
	$retailprice = [sql-param our_retail_price noformat=1];
	$c = [total-price noformat=1] + $retailprice;
	$Safe{'scratch'}->{'our_total_price'} = $c;
       return '';
[/set]
[/sql]
[/item-list][/then][/if]
 
 Total: [scratch our_total-price]

Regards,

[set value holiday] Joachim [/set]
[if value holiday] 
Who is on vacation next week?	Name : [value holiday]<BR>
[/if]

;-)
-- 
-------------Hans-Joachim Leidinger---------------------




Search for: Match: Format: Sort by: