Tips and Tricks HQ Support Portal › Forums › WP PDF Stamper › Can {serial_key} be made available as a dynamic variable in PDF Stamper
Tagged: {serial_key}, Tickets
- This topic has 4 replies, 2 voices, and was last updated 10 years, 6 months ago by wpsadmin.
-
AuthorPosts
-
May 12, 2014 at 1:32 pm #10815wpsadminMember
I am using both WP eStore and WP PDF Stamper, and would like to be able to include the {serial_Key} variable in the “stamp” that I put on my PDFs (which are tickets to an event – I would like to be able to stamp each ticket with its number).
According to the information on the following page, the {serial_key} variable is not available in the list of “Stamping Text Dynamic Variables”
http://www.tipsandtricks-hq.com/wp-pdf-stamper/how-to-configure-the-settings-menu-68
Can this variable be made available in PDF Stamper?
I have a feeling that the information in the following post might be relevant, but I’m not a programmer so am not sure….
https://support.tipsandtricks-hq.com/forums/topic/pdf-stamper-integration-with-variable-values
May 12, 2014 at 9:22 pm #62915wzpModeratorNo, it can’t be easily made available; without revisions to both plugins.
There ***is*** a way, that you can hack eStore, and sneak the serial number across into PDF Stamper. It does however, require some moderate code hacking; but in your “other thread,” you stated that you are not a programmer.
Hint: right before PDF Stamper is called from eStore, you replace the transaction ID with the serial number in the payment data that is normally passed to the PDF Stamper. You’d then use the {transaction_id} tag to stamp the serial number.
May 13, 2014 at 9:15 am #62916wpsadminMemberHmm, ok. So I said I’m not a programmer – I’m not a web/html programmer, but I used to be a C, COBOL and ABAP programmer so could probably install a “hack” if you told me what to cut & paste where, especially if it made it possible for this plugin to stamp a PDF ticket with a serial number.
Is it possible for you to tell me what I need to change, or give me a more detailed hint? I don’t know how to find where PDF Stamper is called from eStore.
May 13, 2014 at 5:22 pm #62917wzpModeratorWell, as one old C programmer to another (I wrote some of the System V code), you should find PHP quite familiar. I can only give you “general guidance” of what the hack entails; because we don’t want to provide future support for this, if you or anyone else tries it, and then needs “rescuing.”
First, the usual disclaimer…
********** DANGER WILL ROBINSON — RUNNING WITH SCISSORS AHEAD **********
********** DANGER WILL ROBINSON — RUNNING WITH SCISSORS AHEAD **********
********** DANGER WILL ROBINSON — RUNNING WITH SCISSORS AHEAD **********
We begin with these 3 understandings/assumptions:
- You have the latest version of eStore.
- This hack ONLY applies if you are using the PayPal gateway built into eStore.
- This hack will permanently change the way serial number & PDF stamping is handled for ALL (sorta/kinda) of your products.
Backup the following eStore files:
eStore_post_payment_processing_helper.php
eStore_serial_key_functions.php
paypal.php
What NORMALLY happens is:
- PDF files are normally stamped during post payment processing, so that download links to the stamped files can be displayed on the Thank You page.
- Serial numbers are normally issued when the post payment email is sent out, and ARE NOT displayed on the Thank You page.
Edit the eStore_serial_key_functions.php file. This will change things, so that only the serial number (and not the product name AND serial number) will be stamped.
- Look for the eStore_get_serial_key_for_product() function definition.
- The return value is $product_code_data which contains both the item name and the serial number.
- Backup until you find the spot where $product_code_data is “put together.” Now you know why you see both the product name and serial number in the sales table.
- You are going to create a “clone” of eStore_get_serial_key_for_product() called eStore_get_serial_key_for_product_id() and edit the function so that its only argument is a product ID, and that it returns just the serial number.
- For bonus points, insert some kind of hard breakpoint into the original eStore_get_serial_key_for_product() function, so that you can detect usage, after the hack. This situation can occur if another payment gateway (besides PayPal) is being used.
Edit the paypal.php file. We want to prevent the serial number from being issued when the post payment email is sent out. Otherwise, we’ll end up wasting serial numbers, and it will look like every other serial number is being stamped.
- Look for the spot where the eStore_post_sale_retrieve_serial_key_and_update() function is called.
- Comment out that line.
Edit the eStore_post_payment_processing_helper.php file. This will change things, so that the serial number is issued and substituted for the transaction ID, just before the PDF Stamper is called.
- Look for, and then study the definition for the eStore_stamp_pdf_file() function.
- Add a $product_id parameter to the function’s argument list.
- Find the spot within the function that says:
$data = $payment_data;
- This is where the {transaction_id} tag value gets set. You are going to replace $payment_data with a call to the eStore_get_serial_key_for_product_id() function you created earlier.
- Now backup until you find where eStore_stamp_pdf_file() is called, from the eStore_check_stamping_flag_and_generate_download_key() function.
- Edit that function call, so that it includes the $product_id argument.
At this point, you’ve hacked eStore so that when the PDF Stamper is called, {transaction_id} will really contain the serial number.
The modification to the paypal.php file can also be applied to the eStore_manual_gateway_functions.php file. This will let you process Manual Checkout orders necessary for “selling” free ($0.00) tickets.
Unpredictable results may occur if:
- You run out of serial numbers for your product, because we bypassed the normal safety mechanisms.
- You try using the Admin Functions to manually generate a ticket, because… we just don’t know what will happen until you try it!
Again, this is only “general guidance,” from one professional programmer to another. No rescuing services will be provided, except through our “Need Custom Work Done” program.
May 13, 2014 at 9:02 pm #62918wpsadminMemberWow, thank you so much. I will read that thoroughly, request an upgrade of eStore (as per your instructions in my other post) and then look into doing this (perhaps I’ll also track down a php programmer to help me). I note your warnings about no support – fair enough. If I decide this is beyond my skills I’ll request some custom work through the correct channel.
Thanks again.
-
AuthorPosts
- You must be logged in to reply to this topic.