[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Help! Still Lost in Perl
****** message to minivend-users from Mike Heins <mikeh@minivend.com> ******
Quoting Chris Rapier (rapier@psc.edu):
> To do this I've written:
>
> [item-list]
> [perl tables=products]
> $ref = $Db->{products};
> $column = "quantity";
> $cart_sku = $Items->[$i]{'code'};
> $cart_quantity = $Items->[$i]{'quantity'};
> $db_quantity = $ref->field($column, $cart_sku);
> $difference = $db_qauntity - $cart_quantity;
> if ($difference < 0){
> $Items->[$i]{'quantity'} = $db_quantity;
> }
> if ($difference > 0) {
> $ref->inc_field($column, $cart_sku, -1);
> }
> if ($difference == 0) {
> $ref->delete_record($cart_sku);
> }
> $i++;
> [/perl]
> [/item-list]
>
Questions, all rhetorical:
1. Where is $i coming from?
2. Do you have Safe::Hole installed (assuming you are using SQL)?
3. Have you seen your typo?
Name "main::db_qauntity" used only once: possible typo at - line 6.
--
Internet Robotics, 131 Willow Lane, Floor 2, Oxford, OH 45056
phone +1.513.523.7621 fax 7501 <mikeh@minivend.com>
Research is what I'm doing when I don't know what I'm doing.
-- Wernher Von Braun
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list