|
Posted by Kenneth Downs on 08/24/05 06:44
Mark wrote:
> I am a complete novice with php scrip but I am wiling to learn.
> I am in need of some help, please.
You don't have a code issue you have a data manipulation issue. You are
trying to hard-code some logic based on data values. This is best handled
by separating the code from the data.
>
> Can anyone sort this code out for me so that it works correctly and
> adjusts the price for the quantity selected on the front end.
Probably not. Instead i can offer the following re-write:
$info = array(
"croclight"=> array(
"item_number"=>'CRC',
"price"=>6.99),
"spray"=> array(
"item_number"=>"CRS",
"size"=>"50ml",
"price=6.99")
...etc..)
then your code looks like:
$item_info = $info($item_name);
and so forth.
All of the informatin in that associative array should come from database
tables.
hope this helps.
> _______________________________________________________________
>
> if(article_get_field('type')== 'Croclight Candle'){
> article_set_field('item_number', 'CRC');
> article_set_field('price', 6.99);
> }
> elseif(article_get_field('type')== 'Spray') {
> article_set_field('item_number', 'CRS');
> article_set_field('size', '50ml');
> article_set_field('price', 6.99);
> }
> elseif(article_get_field('size')== '15ml') {
> article_set_field('item_number', 'CRS');
> article_set_field('type', 'Spray');
> article_set_field('price', 2.99);
> }
> elseif(article_get_field('type')== 'Roll-on') {
> article_set_field('item_number', 'CRO');
> article_set_field('size', '50ml');
> article_set_field('price', 6.99);
> }
> ________________________________________________________________
>
> Thanks in advance
>
> Mark
--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec)ure(Dat)a(.com)
Navigation:
[Reply to this message]
|