WeBid Bug Tracking

View Revisions: Issue #444 All Revisions ] Back to Issue ]
Summary 0000444: (Ver 1.1.0) Paying for multiple bought items doesn't work if user bought the same item before in a different amount
Revision 2016-07-19 08:12 by renlok
Description Example: A buyer buys one item from a 'buy now only' auction where an amount of i.e. 10 items is available (let's say 2,50$ each). If he then buys i.e. 3 more items from that auction and want's to pay for the 1 + 3 = 4 items, there are two positions in outstanding.php listed correctly with 1 * 2,50$ = 2,50 and 3 * 2,50$ = 7,50 Euro. When he wants to pay for the 3 items, and clicks on 'pay now' button, he will get to the pay.php page where the total amount to pay will be 2,50$ instead of 7,50$. That is because of the quantity in pay.php (case 2: //pay for an item) is always the amount of the first time the buyer bought the item. So if he had bought 2 items at first and after that 3 items, pay.php would say he had to pay 5,00$ for the 3 items instead of 7,50$.



So is there a way to read out the quantity of the second buying?



case 2: // pay for an item

  $query = "SELECT w.id, a.id AS auctid, a.title, a.shipping_cost, a.shipping_cost_additional, a.shipping, w.bid, u.paypal_email, u.authnet_id, u.authnet_pass,

                u.id As uid, u.nick, a.payment, u.worldpay_id, u.toocheckout_id, u.moneybookers_email, w.qty

                FROM " . $DBPrefix . "auctions a

                LEFT JOIN " . $DBPrefix . "winners w ON (a.id = w.auction)

                LEFT JOIN " . $DBPrefix . "users u ON (u.id = w.seller)

                WHERE a.id = " . intval($_POST['pfval']);

        $res = mysql_query($query);

        $system->check_mysql($res, $query, __LINE__, __FILE__);



        // check its real

        if (mysql_num_rows($res) < 1)

        {

            header('location: outstanding.php');

            exit;

        }



        $data = mysql_fetch_assoc($res);

        $payment = explode(', ', $data['payment']);

        $pp_paytoemail = (in_array('paypal', $payment)) ? $data['paypal_email'] : '';

        $extrastring = sprintf($MSG['778'], $data['uid'], $data['auctid'], $data['nick']);

        $an_paytoid = (in_array('authnet', $payment)) ? $data['authnet_id'] : '';

        $an_paytopass = (in_array('authnet', $payment)) ? $data['authnet_pass'] : '';

        $wp_paytoid = (in_array('worldpay', $payment)) ? $data['worldpay_id'] : '';

        $tc_paytoid = (in_array('toocheckout', $payment)) ? $data['toocheckout_id'] : '';

        $mb_paytoemail = (in_array('moneybookers', $payment)) ? $data['moneybookers_email'] : '';

        $additional_shipping = $data['additional_shipping_cost'] * ($data['qty'] - 1);

        $shipping_cost = ($shipping == 1) ? ($data['shipping_cost'] + $additional_shipping) : 0;

        $payvalue = ($data['bid'] * $data['qty']) + $shipping_cost;

        $custoncode = $data['id'] . 'WEBID2';

        $message = sprintf($MSG['581'], $system->print_money($payvalue));

        $title = $system->SETTINGS['sitename'] . ' - ' . $data['title'];

       



          

break;





the line



$extrastring = sprintf($MSG['778'], $data['uid'], $data['auctid'], $data['nick']);




was changed and is not the same as in the downloaded package



How can we get the correct data from the database? I can read the php code a littel bit but don't know hot to deal with databases. I already read http://www.webidsupport.com/forums/showthread.php?6399-Multiple-Buy-It-Now-Purchase-Charge-Fixed-%28Outstanding-and-Pay-PHP%29&highlight=multiple+items" [^" title="]another thread">]another thread where there was a solution, but i couldn't apply it becuase my pay.php (Version 1.1.0) seems to differ from the example that was given in that thread. May it's a customized or an older Version there. Does anybody have a fix for Ver 1.1.0 or can give an instruction how to modify the changes in the other thread to fit for Ver 1.1.0?



Thank you in advance!
Revision 2013-07-16 12:53 by itze
Description Example: A buyer buys one item from a 'buy now only' auction where an amount of i.e. 10 items is available (let's say 2,50$ each). If he then buys i.e. 3 more items from that auction and want's to pay for the 1 + 3 = 4 items, there are two positions in outstanding.php listed correctly with 1 * 2,50$ = 2,50 and 3 * 2,50$ = 7,50 Euro. When he wants to pay for the 3 items, and clicks on 'pay now' button, he will get to the pay.php page where the total amount to pay will be 2,50$ instead of 7,50$. That is because of the quantity in pay.php (case 2: //pay for an item) is always the amount of the first time the buyer bought the item. So if he had bought 2 items at first and after that 3 items, pay.php would say he had to pay 5,00$ for the 3 items instead of 7,50$.



So is there a way to read out the quantity of the second buying?



case 2: // pay for an item

  $query = "SELECT w.id, a.id AS auctid, a.title, a.shipping_cost, a.shipping_cost_additional, a.shipping, w.bid, u.paypal_email, u.authnet_id, u.authnet_pass,

                u.id As uid, u.nick, a.payment, u.worldpay_id, u.toocheckout_id, u.moneybookers_email, w.qty

                FROM " . $DBPrefix . "auctions a

                LEFT JOIN " . $DBPrefix . "winners w ON (a.id = w.auction)

                LEFT JOIN " . $DBPrefix . "users u ON (u.id = w.seller)

                WHERE a.id = " . intval($_POST['pfval']);

        $res = mysql_query($query);

        $system->check_mysql($res, $query, __LINE__, __FILE__);



        // check its real

        if (mysql_num_rows($res) < 1)

        {

            header('location: outstanding.php');

            exit;

        }



        $data = mysql_fetch_assoc($res);

        $payment = explode(', ', $data['payment']);

        $pp_paytoemail = (in_array('paypal', $payment)) ? $data['paypal_email'] : '';

        $extrastring = sprintf($MSG['778'], $data['uid'], $data['auctid'], $data['nick']);

        $an_paytoid = (in_array('authnet', $payment)) ? $data['authnet_id'] : '';

        $an_paytopass = (in_array('authnet', $payment)) ? $data['authnet_pass'] : '';

        $wp_paytoid = (in_array('worldpay', $payment)) ? $data['worldpay_id'] : '';

        $tc_paytoid = (in_array('toocheckout', $payment)) ? $data['toocheckout_id'] : '';

        $mb_paytoemail = (in_array('moneybookers', $payment)) ? $data['moneybookers_email'] : '';

        $additional_shipping = $data['additional_shipping_cost'] * ($data['qty'] - 1);

        $shipping_cost = ($shipping == 1) ? ($data['shipping_cost'] + $additional_shipping) : 0;

        $payvalue = ($data['bid'] * $data['qty']) + $shipping_cost;

        $custoncode = $data['id'] . 'WEBID2';

        $message = sprintf($MSG['581'], $system->print_money($payvalue));

        $title = $system->SETTINGS['sitename'] . ' - ' . $data['title'];

       



          

break;





the line



$extrastring = sprintf($MSG['778'], $data['uid'], $data['auctid'], $data['nick']);




was changed and is not the same as in the downloaded package



How can we get the correct data from the database? I can read the php code a littel bit but don't know hot to deal with databases. I already read http://www.webidsupport.com/forums/showthread.php?6399-Multiple-Buy-It-Now-Purchase-Charge-Fixed-%28Outstanding-and-Pay-PHP%29&highlight=multiple+items" [^" title="]another thread">]another thread where there was a solution, but i couldn't apply it becuase my pay.php (Version 1.1.0) seems to differ from the example that was given in that thread. May it's a customized or an older Version there. Does anybody have a fix for Ver 1.1.0 or can give an instruction how to modify the changes in the other thread to fit for Ver 1.1.0?



Thank you in advance!


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker