Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Posts
    16
    Plugin Contributions
    0

    Default Please could I have help with a function

    Hi there everyone,
    If anyone's passing here please could you help me with a function to multiply 2 values from the same table to give a new value.

    This is what I've done but cant seem to make it work.
    I do appreciate that I may well have got this wrong so could someone correct this for me.
    (I've tried to work it out by studying other functions)

    So if I wanted to multiply products_price by products_quantity to give products_sumtotal would I do it like this?


    <?php
    function zen_get_products_sumtotal($products_price, $products_quantity) {
    global $db;
    $products_sumtotal = $db->Execute("SELECT $products_price * $products_quantity
    from " . TABLE_PRODUCTS . "
    where products_ourprice = '" . (int)$products_price . "'
    and products_quantity = '" . (int)$products_quantity . "'");

    return $products_sumtotal->fields['products_sumtotal'];
    }
    ?>


    Many thanks

  2. #2
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Please could I have help with a function

    The cart already does that - What are you trying to do?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  3. #3
    Join Date
    Aug 2007
    Posts
    16
    Plugin Contributions
    0

    Default Re: Please could I have help with a function

    Hello.
    Thanks for the reply.

    I just wanted to try and display something in admin only.
    What I'd previously done is added a box in the admin products page (collect_info.php and preview_info.php etc) which displays the price we pay for an item just above the 'products price (net) box' and the value was stored in the products table so it was called whenever we went to admin at a later date.

    What I have added now is another row to the products table and another box to the admin new products page under quantity and was trying to multiply the price we pay for an item by the quantity in stock to show the value in the new box right below quantity.

    I hope I've explained that ok.

    Thanks once again.

 

 

Similar Threads

  1. New to ZC and could do with a little help please!
    By martin_j in forum Basic Configuration
    Replies: 2
    Last Post: 20 Mar 2014, 12:59 PM
  2. Could someone help me with additional images please?
    By Best Price Accessori in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 21 Mar 2009, 07:54 PM
  3. Replies: 1
    Last Post: 9 Oct 2006, 08:45 PM
  4. Could someone please confirm if I have set chmod right please
    By angelicdezigns in forum Templates, Stylesheets, Page Layout
    Replies: 19
    Last Post: 30 Jul 2006, 03:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg