7, September 2008

to recompute form - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  DB_cart Class (Moderator: Olaf)
Topic: to recompute form
« previous next »
Pages: [1] Print

Author Topic: to recompute form  (Read 1200 times)
Atari ST fan
*
Posts: 8
56 credits
Members referred : 0


« on: Feb 20, 2007, 12:38:01 PM »

Hi !!

good class !!

i want to know how write a shopping form with only recompute button ?

to recompute total price with all quantity lines, in one time  ...

thanks
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Feb 20, 2007, 12:54:59 PM »

Hi and welcome

what is 'recompute' and do you have an example (maybe you can build a quick and dirty static form?)


Last blog : Is your website is down? Know before your visitors do!
Atari ST fan
*
Posts: 8
56 credits
Members referred : 0


« Reply #2 on: Feb 20, 2007, 02:38:49 PM »

in place to have a buttom to calculate price * quantity, by line of products (when i want to change quantity) , i want to have only one button which calculate all quantity*price for all shopping.

it's better when you have many quantities products change

do you unterstand more ? Smiley
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Feb 20, 2007, 02:45:46 PM »

in place to have a buttom to calculate price * quantity, by line of products (when i want to change quantity) , i want to have only one button which calculate all quantity*price for all shopping.

it's better when you have many quantities products change

do you unterstand more ? Smiley

this is not possible in most of the shopping carts if this is only to raie the amount on one page you should try some javascript code


Last blog : Is your website is down? Know before your visitors do!
Atari ST fan
*
Posts: 8
56 credits
Members referred : 0


« Reply #4 on: Feb 20, 2007, 04:55:04 PM »

ok

i finish without javascript and it runs

thanks
Total Zero
*
Posts: 5
30 credits
Members referred : 0


« Reply #5 on: Jun 15, 2007, 10:09:26 PM »

I would like to do the same.  The website I'm trying to work into is the db_cart is http://www.debmoe.com/slidesorderform.php Visit through proxy.

Mine works the same as db_cart but all I want to do is have a unit price and total for each $row  of db_cart_btn_only.php.

Please help.

Deb

Atari ST fan
*
Gender: Female
Posts: 7
46 credits
Members referred : 0


Let's code!


« Reply #6 on: Jun 17, 2007, 11:00:26 AM »

It would be great if you could post how you worked this out for other users. I would have just used javascript, but if PHP can/will do it - I'd like to try it next time I have the need (which could be any day).
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Jun 17, 2007, 12:20:41 PM »

I guess there is no other way than some Ajax function to calculate the (new) price without refreshing the page


Last blog : Is your website is down? Know before your visitors do!
Total Zero
*
Posts: 5
30 credits
Members referred : 0


« Reply #8 on: Jun 25, 2007, 02:16:51 PM »

Quote
I believe I'm close but can't figure it out.  I'm getting the title for each row and also for the total of the cart but I get this error:

Total value ROW:
Notice: Undefined variable: val in /home/debmoe3/public_html/classes/db_cart/db_cart_example.php on line 91

Notice: Undefined variable: val in /home/debmoe3/public_html/classes/db_cart/db_cart_example.php on line 91
$ 0,00

I have :

Code:
<?php while ($prod_obj mysql_fetch_object($prod_result)) { ?>
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <label for="prod_<?php echo $prod_obj->id?>">
    <b><?php echo $prod_obj->name?></b><br>
    <?php echo $prod_obj->description." - price: ".$myCart->format_value($prod_obj->price); ?>

    </label>
    <input type="text" name="quantity" size="5" value="0">
<input type="hidden" name="price" value="<?php echo $prod_obj->price?>">
<input type="hidden" name="art_no" value="<?php echo $prod_obj->art_no?>">
<input type="hidden" name="product" value="<?php echo $prod_obj->name?>">
<input type="hidden" name="amount" value="<?php echo $prod_obj->amount?>">

<p>Total value ROW:  <b> <input type="hidden" name="amount" value="0"><?php echo $myCart->format_value($val['price'] * $val['quantity']); ?></b></p>
<input type="submit" name="add" value="Update">

   
   
  </form>
Quote
]Row 91 is:

Code:
<p>Total value ROW:  <b> <input type="hidden" name="amount" value="0"><?php echo $myCart->format_value($val['price'] * $val['quantity']); ?></b></p>
Quote
Any ideas?
Deb
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #9 on: Jun 25, 2007, 03:39:29 PM »

not sure what you're doing but the variable doesn't exists:

$val['quantity']


Last blog : Is your website is down? Know before your visitors do!
Total Zero
*
Posts: 5
30 credits
Members referred : 0


« Reply #10 on: Jun 25, 2007, 04:26:22 PM »

I guess I don't understand because $val('quantity) is in db_cart example.php where this code is. What I did was just took the $val("quantity) out of the table and installed it in the label section above.

What I want it to do is like the checkout have it to do update per line and also give you the total of the line or row.

Deb
Total Zero
*
Posts: 5
30 credits
Members referred : 0


« Reply #11 on: Jun 29, 2007, 05:38:00 PM »

I have the db_cart example.php having an update button and recalculating like the checkout.  The only thing is that when you first enter the different number in the update button it brings up another product line with no info on it with $0 price with the same quantity you entered in the update button.  How do I get it so it doesn't bring up another product line?

This is still not what I really looking for it's like http://www.debmoe.com/slidesorderform.html Visit through proxy but I want it in php and on mysql.

The changes I made was in the db_cart example: I added after new db_cart: // update a single order row
if (isset($_POST['add']) && $_POST['add'] == "Update") {
   $myCart->update_row($_POST['row_id'], $_POST['quantity']);
}

and replaced the table with: <table>
  <tr>
    <th>Art. no.</th>
    <th>Product</th>
   <th>Price</th>
   <th>Amount</th>
   <th>Quantity</th>
  </tr>
  <?php foreach ($myCart->order_array as $val) { ?>
  <tr>
    <td><?php echo $val['product_id']; ?></td>
   <td><?php echo $val['product_name']; ?></td>
   <td align="right"><?php echo $myCart->format_value($val['price']); ?></td>
   <td align="right"><?php echo $myCart->format_value($val['price'] * $val['quantity']); ?></td>
   <td>
      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
       <input type="hidden" name="row_id" value="<?php echo $val['id']; ?>">
       <input type="text" name="quantity" size="5" value="<?php echo $val['quantity']; ?>">
       <input type="submit" name="add" value="Update">
      </form>
   </td>
  </tr>
  <?php } // end foreach loop ?>
</table>




Deb 
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #12 on: Jun 29, 2007, 11:08:57 PM »

do you called this function?

$myCheckout->show_ordered_rows();


Last blog : Is your website is down? Know before your visitors do!
Total Zero
*
Posts: 5
30 credits
Members referred : 0


« Reply #13 on: Jun 30, 2007, 07:05:46 AM »

No in db_cart example it's Called  $myCart.  I tried $myCheckout and I get the error:  to a member function on a non-object in mypathway on line 35

Deb
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #14 on: Jun 30, 2007, 11:07:58 AM »

Deb, sorry I can't explain you all the baiscs check the the php manual how to use objects


Last blog : Is your website is down? Know before your visitors do!
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6052
Tags : recompute shopping form Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  DB_cart Class (Moderator: Olaf)
Topic: to recompute form
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Sep 07, 2008, 06:48:03 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 36.301
Total Topics: 7.479
Total Members: 3.905
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: indiecorporate

21 Guests, 3 Users online :

8 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.