Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12239
Latest: allershm
New This Month: 8
New This Week: 4
New Today: 0
Stats
Total Posts: 39378
Total Topics: 6932
Most Online Today: 134
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 53
Total: 54

Author Topic: Transaction ID on Packing Slip Incorrect  (Read 1115 times)

0 Members and 1 Guest are viewing this topic.

Offline KKOG

  • SMF Gallery Pro Customer
  • Newbie
  • *****
  • Posts: 26
    • View Profile
Transaction ID on Packing Slip Incorrect
« on: November 30, 2017, 11:01:53 pm »
Hi,

We currently have a problem that the transaction id on the packing slip is different to the actual transaction id.

All the other information on the packing slip is correct.

This difference may have been caused by activities undertaken during the initial setup and testing.

How is the transaction id sourced for the packing slip?  There appears to be a database query at line 9900 of store2.php.  Is this the query, if so how is the transaction id being returned incorrectly?

Thanking you in anticipation of your help

Greg Ralph
KKOG Forum Admin

Offline KKOG

  • SMF Gallery Pro Customer
  • Newbie
  • *****
  • Posts: 26
    • View Profile
Re: Transaction ID on Packing Slip Incorrect
« Reply #1 on: December 01, 2017, 12:34:16 am »
I see the transaction id is printed at the following

9870      echo $txt['store_trans_txn_id'] . ': ' . $transRow['id_trans'];

with id_trans defined in a query at line 9806.

The rest of the detail in the packing slip is defined using a query based on the store_basketid in line 9883

Somehow there seems to be a mismatch in the data retrieved

Regards
Greg Ralph
KKOG Forum Admin

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14712
    • View Profile
Re: Transaction ID on Packing Slip Incorrect
« Reply #2 on: December 01, 2017, 10:29:32 pm »
Made change for next update hotfix/change

Open Sources/Store2.php
Line 9803
Find
Code: [Select]
$context['store_basketid'] = $id;

$dbresult = $smcFunc['db_query']('', "
SELECT 
is_subscription, is_custompaypal, custom, cart_items,
totalprice, totalshipping, totaltax, currency, date, id_trans,
weight_unit, weight_total, notes, is_shipped, completed
FROM {db_prefix}store_basket   
WHERE ID_BASKET = " . $context['store_basketid'] . " LIMIT 1" );
$basketRow = $smcFunc['db_fetch_assoc']($dbresult);
$smcFunc['db_free_result']($dbresult);

$dbresult = $smcFunc['db_query']('', "
SELECT id_trans, txn_id
FROM ({db_prefix}store_transactions)
WHERE ID_BASKET = " . $context['store_basketid']. " LIMIT 1");
$transRow = $smcFunc['db_fetch_assoc']($dbresult);

Change to
Code: [Select]
$context['store_basketid'] = $id;

$dbresult = $smcFunc['db_query']('', "
SELECT 
is_subscription, is_custompaypal, custom, cart_items,
totalprice, totalshipping, totaltax, currency, date, id_trans,
weight_unit, weight_total, notes, is_shipped, completed
FROM {db_prefix}store_basket   
WHERE ID_BASKET = " . $context['store_basketid'] . " LIMIT 1" );
$basketRow = $smcFunc['db_fetch_assoc']($dbresult);
$smcFunc['db_free_result']($dbresult);

$dbresult = $smcFunc['db_query']('', "
SELECT id_trans, txn_id
FROM ({db_prefix}store_transactions)
WHERE ID_BASKET = " . $context['store_basketid']. " LIMIT 1");
$transRow = $smcFunc['db_fetch_assoc']($dbresult);

if (!empty($transRow['txn_id']))
$transRow['id_trans'] = $transRow['txn_id'];

Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline KKOG

  • SMF Gallery Pro Customer
  • Newbie
  • *****
  • Posts: 26
    • View Profile
Re: Transaction ID on Packing Slip Incorrect
« Reply #3 on: December 02, 2017, 12:29:31 am »
Hi,

I made the code change but the Transaction ID on the packing slip was not correct.

Attached is an image of the transaction showing the transaction id, an image of the packing slip transaction id prior to the code change and an image of the packing slip transaction id after the code change

Cheers
Greg Ralph
KKOG Forum Admin

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14712
    • View Profile
Re: Transaction ID on Packing Slip Incorrect
« Reply #4 on: December 02, 2017, 01:52:17 pm »
You want to show the order number from the basket id?
If so then use the following instead
Code: [Select]
$context['store_basketid'] = $id;

$dbresult = $smcFunc['db_query']('', "
SELECT 
is_subscription, is_custompaypal, custom, cart_items,
totalprice, totalshipping, totaltax, currency, date, id_trans,
weight_unit, weight_total, notes, is_shipped, completed
FROM {db_prefix}store_basket   
WHERE ID_BASKET = " . $context['store_basketid'] . " LIMIT 1" );
$basketRow = $smcFunc['db_fetch_assoc']($dbresult);
$smcFunc['db_free_result']($dbresult);

$dbresult = $smcFunc['db_query']('', "
SELECT id_trans, txn_id
FROM ({db_prefix}store_transactions)
WHERE ID_BASKET = " . $context['store_basketid']. " LIMIT 1");
$transRow = $smcFunc['db_fetch_assoc']($dbresult);


$transRow['id_trans'] = $id;
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline KKOG

  • SMF Gallery Pro Customer
  • Newbie
  • *****
  • Posts: 26
    • View Profile
Re: Transaction ID on Packing Slip Incorrect
« Reply #5 on: December 02, 2017, 06:28:54 pm »
Thank you, the latest code achieves what I was seeking.  Sorry for not explaining more clearly what I was trying to achieve. 

I have also changed the text in Store.English.php to read Order Number on the packing slip as the Order Number is referenced in the personal message sent to the customer when the product is shipped.  The changes were made because both the customer and the store administrator were looking to the Order Number as the reference for the transaction.

Thank you again for your help

Greg Ralph
KKOG Forum Admin

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
3938 Views
Last post November 29, 2006, 10:00:34 pm
by Hawk
12 Replies
11215 Views
Last post September 19, 2007, 09:38:23 pm
by SMFHacks
17 Replies
11369 Views
Last post February 15, 2012, 12:48:53 pm
by majorwood
3 Replies
2173 Views
Last post January 28, 2013, 03:12:40 pm
by SMFHacks
2 Replies
870 Views
Last post October 23, 2017, 04:59:47 pm
by SMFHacks

+- Recent Topics

GDPR Helper free doubts by Rock Lee
December 08, 2018, 06:20:57 pm

condition de livraison by alain54100
December 06, 2018, 12:33:38 pm

Downloads Pro 5.0 Released by SMFHacks
December 05, 2018, 03:11:32 pm

SMF Hacks Black Friday Sale! by SMFHacks
November 30, 2018, 09:03:04 am

Rewrite rule for IPN by diegolyanky
November 26, 2018, 10:58:55 am

EDITOR PRO by SMFHacks
November 25, 2018, 03:12:19 pm

SMF Gallery Pro 8.0 / PHP 7.0 onwards by SMFHacks
November 25, 2018, 12:33:10 pm

5.0 beta log errors by tfs
November 24, 2018, 10:37:06 pm

Download button doesn't initiate a download the first time by SMFHacks
November 24, 2018, 09:08:55 pm

Turn off Latest Posts? by tfs
November 23, 2018, 09:08:49 pm

Powered by EzPortal