WeBid Bug Tracking

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000452WeBidAuctionspublic2013-07-25 14:522014-03-11 21:12
Reporterbradcoll 
Assigned To 
Priority@0@SeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version1.1.0 
Target VersionFixed in Version1.1.2 
Summary0000452: Shipping not calculating or being sent to paypal
DescriptionMy apologies if this is not the right place, but it was suggested I repost the problem as a bug, so here is the text from my initial post in the general forums. For responses to the original thread, this is it --> http://www.webidsupport.com/forums/showthread.php?6923-Shipping-not-calculating-or-being-sent-to-paypal" [^" title="]]http://www.webidsupport.com/forums/showthread.php?6923-Shipping-not-calculating-or-being-sent-to-paypal[/URL] [^]





Please forgive my ignorance as I have just found this product and am in the process of trialling it. I am sure that it must be me doing something wrong but no matter what combination of settings I use the shipping fees are not being added to the final cost.

 

If the buyer purchases an item that is listed for $3 + $7 postage only $3 is shown when they click the 'pay now' button and again only $3 is shown in the paypal screen.

 Now if the buyer looks at the invoice it will show the total owed as $3 for the item + $7 for shipping and states the full amount of $10 is now due, but when you click 'pay now' only the $3 is shown on the paypal screen

 

if someone would be so kind as to point out where I am going wrong in my setup it would be most appreciated.

 

I am using v1.1.0 and have spent almost the entire day searching threads for this answer

 

Thank You
TagsNo tags attached.
import_id454
Thread
Attached Files

- Relationships

-  Notes
(0001134)
CBG (reporter)
2013-07-25 18:03
edited on: 1970-01-01 00:00

I had posted a reply to you post on how to pass the shipping costs to paypal and should also do other payment providers.
(0001135)
bradcoll (reporter)
2013-07-25 23:42
edited on: 1970-01-01 00:00

This is the fix that CBG has kindly provided.

CBG;34319 wrote

Hi,

I think I have found the problem with the price passing to PayPal and maybe other payment providers.

Open pay.php

Find:

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


Replace with

$shipping_cost = ($data['shipping'] == 1) ? ($data['shipping_cost'] + $additional_shipping) : 0;
(0001137)
itze (reporter)
2013-07-26 09:38
edited on: 1970-01-01 00:00

Thank you! That worked!
(0001160)
Susan Skinner (viewer)
2013-09-21 19:01
edited on: 1970-01-01 00:00

I'm not having any luck getting this issue fixed. I see problems with the shipping cost in multiple places as mentioned below.

Buy_Now.php (total does not include shipping cost)
Pay.php (amount owed for the auction does not include shipping, as a result the amount sent to PayPal when pressing PayNow is incorrect)
Outstanding.php (total is calculated correctly, but shipping column shows as 0.00)
Order_Print.php (shipping cost shows correctly, but total does not include shipping)

Does anyone know what needs to be changed to fix this?
(0001161)
jjjason84 (reporter)
2013-09-21 23:09
edited on: 2013-09-21 23:12

Susan Skinner wrote

I'm not having any luck getting this issue fixed. I see problems with the shipping cost in multiple places as mentioned below.

Buy_Now.php (total does not include shipping cost)
Pay.php (amount owed for the auction does not include shipping, as a result the amount sent to PayPal when pressing PayNow is incorrect)
Outstanding.php (total is calculated correctly, but shipping column shows as 0.00)
Order_Print.php (shipping cost shows correctly, but total does not include shipping)

Does anyone know what needs to be changed to fix this?


Hello Susan Skinner

in the Outstanding.php it looks like there is a problem in the coding.
on line 55 you will have this code
[PHP]'SHIPPING' => ($row['shipping'] == 2) ? $system->print_money($row['shipping_cost']) : $system->print_money(0),[/PHP]

replace it with this
[PHP]'SHIPPING' => $system->print_money($row['shipping_cost']),[/PHP]

in the Pay.php it looks like there is a problem in the coding.
on line 73 you will have this code.
[PHP]$shipping_cost = ($shipping == 1) ? ($data['shipping_cost'] + $additional_shipping) : 0;[/PHP]

replace it with this
[PHP]$shipping_cost = ($data['shipping_cost'] + $additional_shipping);[/PHP]

in the buy_now.php it looks like there is a problem in the coding.
on line 299 you will have this
[PHP]$shipping_cost = ($shipping == 1) ? ($Auction['shipping_cost'] + $additional_shipping) : 0;[/PHP]

replace it with this
[PHP]$shipping_cost = ($Auction['shipping_cost'] + $additional_shipping);[/PHP]

and for the Order_Print.php i am not to sure how that coding works i would have to look at more and seen Renlok added my additional shipping cost mod to webid so he maybe got confused on all the coding he did but the replacements shown above should fix the problems.

Hope this helps everyone with these problems.
(0001162)
Susan Skinner (viewer)
2013-09-22 03:23
edited on: 2013-09-22 10:28

jjjason84,

That gets me closer, but still not quite there. Now the buy_now.php page is showing a total that only reflects shipping and does not include the per item price or the additional shipping price. In other words if my Buy it Now Only auction has a price of $1.00, shipping of $0.10, and additional shipping of $0.15, then buy_now.php will show a total of $0.10 when I was expecting to see $1.25.

Pay.php is working except in instances of multiple quantity auctions. I know that there are several issues around listings of multiple quantities (both standard auctions with buy it now only and dutch auctions) that are being discussed in other threads. So, for now I'll just disable the item quantity box on the sell.tpl until these issues can be resolved.

For order_print.php, there were quite a few errors. Instead of going through them line by line I'll just provide a copy of my file. Please note that I also changed the date format on line 150 to reflect the USA date format.

[PHP]<?php
/***************************************************************************
 * copyright : (C) 2008 - 2013 WeBid
 * site : http://www.webidsupport.com/ [^]
 ***************************************************************************/

/***************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. Although none of the code may be
 * sold. If you have been sold this script, get a refund.
 ***************************************************************************/

include 'common.php';
include $include_path . 'functions_invoices.php';

// If user is not logged in redirect to login page
if (!$user->is_logged_in())
{
    header('location: user_login.php');
    exit;
}

// is this an auction invoice or fee invoice
$auction = false;
if (isset($_POST['pfval']) && isset($_POST['pfwon']))
{
    $auction = true;
    // check input data
    if (intval($_POST['pfval']) == 0 || intval($_POST['pfwon']) == 0)
    {
        invaildinvoice();
    }
}
else
{
    // check input data
    if (intval($_GET['id']) == 0 || !isset($_GET['id']))
    {
        invaildinvoice();
    }
}

$vat = 20; // NEEDS TO BE SET TO AN ADMIN OPTION
if ($auction)
{
    // get auction data
    $query = "SELECT w.id, w.winner, w.closingdate As date, a.id AS auc_id, a.title, a.shipping_cost, a.shipping_cost_additional, a.shipping, a.shipping_terms, w.bid, w.qty, a.user As seller_id, a.tax, a.taxinc
            FROM " . $DBPrefix . "auctions a
            LEFT JOIN " . $DBPrefix . "winners w ON (a.id = w.auction)
            WHERE a.id = " . intval($_POST['pfval']) . " AND w.id = " . intval($_POST['pfwon']);
}
else
{
    // get fee data
    $query = "SELECT * FROM " . $DBPrefix . "useraccounts WHERE useracc_id = " . intval($_GET['id']);
}
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);

// check its real
if (mysql_num_rows($res) < 1)
{
    invaildinvoice();
}

$data = mysql_fetch_assoc($res);

if ($auction)
{
    // sort out auction data
    $seller = getSeller($data['seller_id']);
    $winner = getAddressWinner($data['winner']);
    $vat = getTax(true, $winner['country'], $seller['country']);
    $title = $system->SETTINGS['sitename'] . ' - ' . $data['title'];
    $additional_shipping = $data['shipping_cost_additional'] * ($data['qty']);
    $shipping_cost = ($data['shipping'] == 1) ? ($data['shipping_cost'] + $additional_shipping) : 0;
    $payvalue = (($data['bid'] * $data['qty']) + $shipping_cost);
    $payvalueperitem = $data['bid'];
    $paysubtotal = ($data['bid']* $data['qty']);

    // build winners address
    $winner_address = '';
    $winner_address .= (!empty($winner['address'])) ? '
' . $winner['address'] : '';
    $winner_address .= (!empty($winner['city'])) ? '
' . $winner['city'] : '';
    $winner_address .= (!empty($winner['prov'])) ? '
' . $winner['prov'] : '';
    $winner_address .= (!empty($winner['country'])) ? '
' . $winner['country'] : '';
    $winner_address .= (!empty($winner['zip'])) ? '
' . $winner['zip'] : '';

    if ($data['tax'] == 'n') // no tax
    {
        $unitexcl = $unitpriceincl = $paysubtotal;
        $subtotal = $paysubtotal;
        $totalinc = $payvalue;
        $vat = 0;
    }
    else // tax is included in price
        {
            $unitexcl = vatexcluding($paysubtotal); // auction price - tax
            $unitpriceincl = vat($paysubtotal); // auction price & tax
            $subtotal = vatexcluding($payvalue); // total invoice - tax
            $totalinc = vat($payvalue); // total invoice & tax
        }

    $totalvat = $totalinc - $shipping_cost - $subtotal;
    $unitpriceincl = ($totalinc - $shipping_cost) / $data['qty'];
    $unitexcl = $subtotal / $data['qty'];

    // auction specific details
    $template->assign_vars(array(
            'AUCTION_TITLE' => strtoupper($title),
            'ITEM_QUANTITY' => $data['qty'],

            'UNIT_PRICE' => $system->print_money($unitexcl, true, false), // auction price
            'UNIT_PRICE_WITH_TAX' => $system->print_money($unitpriceincl, true, false),// auction price & tax
            'TOTAL' => $system->print_money($subtotal, true, false), // total invoice
            'TOTAL_WITH_TAX' => $system->print_money($totalinc, true, false) // total invoice & tax
            ));
}
else
{
    $seller = getSeller($user->user_data['id']); // used as user: ??
    $vat = getTax(true, $seller['country']);
    $winner_address = '';
    $data['shipping_terms'] = '';
    $shipping_cost = 0;
    $title = $system->SETTINGS['sitename'] . ' - ' . $MSG['766'] . '#' . $data['id'];
    $payvalue = $data['total'];
    // create fee data ready for template & get totals
    $totals = setfeetemplate($data);

    // fee specific details
    $template->assign_vars(array(
            'TOTAL' => $system->print_money($totals[1], true, false),
            'TOTAL_WITH_TAX' => $system->print_money($totals[0], true, false)
            ));
}

$template->assign_vars(array(
        'DOCDIR' => $DOCDIR,
        'LOGO' => $system->SETTINGS['siteurl'] . 'themes/' . $system->SETTINGS['theme'] . '/' . $system->SETTINGS['logo'],
        'CHARSET' => $CHARSET,
        'LANGUAGE' => $language,
        'SENDER' => $seller['nick'],
        'WINNER_NICK' => $winner['nick'],
        'WINNER_ADDRESS' => $winner_address,
        'AUCTION_ID' => $data['auc_id'],
        'SHIPPING_METHOD' => (empty($data['shipping_terms'])) ? strtoupper($MSG['000']) : $data['shipping_terms'],
        'INVOICE_DATE' => gmdate('m/d/Y', $data['date'] + $system->tdiff),
        'SALE_ID' => (($auction) ? 'AUC' : 'FEE') . $data['id'],
        // tax start
        'TAX' => $vat . '%',
        'SHIPPING_COST' => $system->print_money($shipping_cost, true, false),
        'VAT_TOTAL' => $system->print_money($totalvat, true, false),
        'TOTAL_SUM' => $system->print_money($payvalue, true, false),
        // tax end
        'YELLOW_LINE' => $system->SETTINGS['invoice_yellow_line'],
        'THANKYOU' => $system->SETTINGS['invoice_thankyou'],

        'B_INVOICE' => true,
        'B_IS_AUCTION' => $auction
        ));

$template->set_filenames(array(
        'body' => 'order_invoice.tpl'
        ));
$template->display('body');
?>
[/PHP]

Thanks to everyone for the help so far.
(0001163)
Susan Skinner (viewer)
2013-09-22 18:01
edited on: 1970-01-01 00:00

Ok, I figured out the buy_now.php issue. I replaced lines 298-300 as follows. Please note that on line 298 I took out the ($qty - 1) and replaced it with ($qty) because I want additional shipping to be charged on the very first item a user buys. If you only want the buyer to pay additional shipping charges for items 2 through whatever, then leave the - 1 in the code.

[PHP]$additional_shipping = $Auction['shipping_cost_additional'] * ($qty);
$shipping_cost = ($Auction['shipping_cost'] + $additional_shipping);
$BN_total = ($Auction['buy_now'] * $qty) + $shipping_cost;[/PHP]

- Issue History
Date Modified Username Field Change
2015-04-01 13:17 renlok New Issue
2015-04-01 13:17 renlok import_id => 454
2015-04-01 13:17 renlok Date Submitted 2015-04-01 13:17 => 2013-07-25 14:52
2015-04-01 13:17 renlok Last Update 2015-04-01 13:17 => 2014-03-11 21:12


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker