Hello team - community , Iam new here
I Just purchaesd taskhive theme with its related extensions / woocomerce , I need custom redirection for a vendor after submittng a listing , I made a template file in Taskhive theme directory , but I couldnot asign that template to a page 'there is no choice for that ’ I also tried templates dashboard / add new then I couldnot find the template I made in the choices there … how can I set that if you have any idea ?
Thanks in advance
Hi,
You can modify this template in HivePress > Templates, select Add Listing (Completed), and add any custom content there. For more information, please see this document: How to customize templates - HivePress Help Center
I hope this is helpful to you.
Hello thanks for response … But I want not just add a content I want to customize that template codes file itself …
Because the content contain dynamic field from prevoius listing page which is the amount feild. … I also want to integrate webhook notification from thirdparty service. To read that transaction and publish it directly
So for this I need to edit or add custom template file that integrate with existing listing template file , isnot?
I made that file but donot know where is hivepress templates files located so I can edit or add new file
To better understand my purpose so you give me better approch
The listing fields contain
AMOUNT USDT ;
Rate ;
Other fields
…
When vendor fill that and submit
For example he made the amount : 200
He redirected to
Please send 200 USDT to Escrow address [TejceghGeghjjsjwbwv3883yeghejeieikeje]
Then submit button
After he send from outside then click submit … his listing is submitted
When he send that correctly , the webhook notification will read that and publish the listing , Also regarding Amount field should I make it the defult quantity field that hivepress has it (built in feature ) so when buyer burchase some it can ve deducted from lisitng ? … or I can manage that easily with custom attribute called 'amount ’
Also if Quantity built in feature is better
What is its id (field name )so I can integrate with the template , Also I see it is optional , how can I make it required and make it vesible to buyer ,
Hello … I tried editing this file ‘listing-complete-message.php’
And fortently it worked and the redirection is perfect ,
but
the only thing is that
It couldnot retrive the amount_usdt value from listing id …
Here is the file please confirm if the retriving way is correct or no
What other template needs to be adjusted also , your help means a lot to me
<?php
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
// Replace this with your actual TRC20 USDT escrow wallet address
$escrow_wallet_address = 'YOUR_TRC20_WALLET_ADDRESS';
// Get the listing ID
$listing_id = $listing->get_id();
// Retrieve the 'amount_usdt' meta value
$amount_usdt = get_post_meta($listing_id, 'amount_usdt', true); // Replace 'amount_usdt' with the actual meta key
// Fallback if the meta value is empty
$amount_usdt = !empty($amount_usdt) ? $amount_usdt : 'N/A'; // Default to 'N/A' if empty
?>
<p><?php printf( esc_html( 'Your listing "%s" has been submitted successfully.' ), $listing->get_title() ); ?></p>
<p><strong>Please send exactly <?php echo esc_html( $amount_usdt ); ?> USDT</strong> to the following wallet address:</p>
<p><strong>Wallet Address:</strong> <span style="word-break: break-word;"><?php echo esc_html( $escrow_wallet_address ); ?></span></p>
<p><strong>Note:</strong> Make sure to send the amount within 15 minutes. Once done, click the confirm button below.</p>
<!-- Timer script or display placeholder -->
<p><strong>Timer:</strong> 15:00 minutes</p>
<button type="button" class="button" data-component="link" data-url="<?php echo esc_url( hivepress()->router->get_url( 'user_account_page' ) ); ?>">Confirm Payment</button>
Yes, if you want to inject custom PHP code into the last step of the listing submission process then the best way is to override the listing/submit/listing-complete-message.php
template part via a child theme.
Please let me know how the amount is stored, if it’s a custom attribute you added in Listings/Attributes, then you don’t have to get the listing ID first, the listing object is available by default and you can do something like:
echo esc_html( $listing->display_attributenamehere() );
Where attributenamehere is the field name of the attribute. You can use var_dump($listing->serialize());
to view the full array of the listing values along with the field names.
Hope this helps
Big thanks for you Ihor … it really worked for both custom attribute … and quantity attribute which I decided to use it instead of custom attribute
But there is a little Issue when I make new listing it worked and the quantity retrives perfectly in submession message page …
But When i try make again new listings
The quantity suddenly doesnot retrive
I wonderd why it worked first then it doesnot work when new multiple listings is made … then I discover it cahs issue
I clicked on purge all then it worked perfectly … how I solve this cashing issue ??
I tried litespeed cash but it conflect with my bluehost built in cashing plugin
What is your suggestion for this
If you mean that the page content is the same (and the PHP code you added doesn’t run on every Listing Submitted page refresh) then the only way is to exclude this URL from cache or disable cache (please check if Bluehost has such settings). Another possible fix is adding a random parameter to the URL after the redirect (this should prevent caching), but this requires code customizations.
I mean after clicking purg all or purg this page
It works for the upcoming listings not the existing one … the existing one cannot retrive the quantity value even after refresh or purg all
But the fixed content which I injected works well only retriving function sometime work sometimes no , depends on the code mood
Is it still the same suggested solutions you provide ??
Please check if your website caches the Listing Submitted page (the last step of the listing process). For example, add echo $listing->get_id()
to the template part you override and try adding 2 listings. If for the second added listing you see the same ID this means that the page was cached the first time. If this is the case then yes, the only options are excluding this URL form caching somehow or adding a random number at the end of the URL.
Thank you Ihor , I will check that solution ,
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.