I would like to make an E-Z page where my customers can go to type in their gift card code and it will display the code, value, and balance from the zen_giftcards table of my database. How can I do this?
I would like to make an E-Z page where my customers can go to type in their gift card code and it will display the code, value, and balance from the zen_giftcards table of my database. How can I do this?
Look at the files used in tpl_discount_coupon_default.php duplicate the files and rename to something that makes sense to you like tpl_giftcards_lookup_default.php
In the header file, point the database to your gift card table, add the language files, add a file name define, add a link somewhere pointing to the new page... by examining how it works for discount coupon look up, you should be able to convert the code for gift cards..
Dave
Always forward thinking... Lost my mind!
Generally speaking, I would have a concern about the page being abused to try to determine what coupon(s) might exist. Doesn't that information show elsewhere already say in the user's account?
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Zen cart installation / maintenance / customisation / hosting
Supported Modules: Dutch language pack, Multi site, Dynamic Price Updater and more.
Display coupon page has been in every version of ZC for some time that I can remember... the page has the standard built in filters for bots... I've gone a bit past the standard with mine, but the page makes a good example of what could be done with gift cards.
Yes, the page does not have lockout timers, but one could create them.
With any form there is a risk of abuse. Adding a email/user name field to test against would add another level or even something like the CCV number of the card... but I agree, one line is foolish for gift cards..
Dave
Always forward thinking... Lost my mind!
So, things were going well...I was using the Discount Coupon template files to make the page for the Gift Cards. I got the page to appear but not find a file, but before I could address that, in the process of testing things I ran into another problem that I had never taken note of before in my checkout process so after sifting through the logs I decided to go back to the test site logs to see if the issue was duplicated and when it first started and found this from March:
What is it asking me? Is the problem in google_analytics.php on line 247 or is it query_factory.php on line 171 that has the bad coding?Code:[12-Mar-2019 17:00:54 America/Detroit] PHP Fatal error: 1054:Unknown column 'final_price' in 'field list' :: select products_id, final_price, customers_basket_quantity from zen_customers_basket where customers_id = '1' ==> (as called by) /home/sammirah/public_html/webstore2/includes/templates/becaberry/google_analytics/google_analytics.php on line 247 <== in /home/sammirah/public_html/webstore2/includes/classes/db/mysql/query_factory.php on line 171
So far I have been able to get the page to appear, but I can not seem to get the database to connect. The logs show this:
I tried re-writing it as TABLE_zen_GIFTCARDS or even TABLE_zen_giftcardsCode:[13-Apr-2019 02:40:51 America/Los_Angeles] PHP Fatal error: 1146:Table 'sammirah_zenc152.TABLE_GIFTCARDS' doesn't exist :: select * from TABLE_GIFTCARDS where giftcard_code = '9094724036158481' and giftcard_active != 'Y' ==> (as called by) /home/sammirah/public_html/webstore/includes/modules/pages/giftcards_lookup/header_php.php on line 17 <== in /home/sammirah/public_html/webstore/includes/classes/db/mysql/query_factory.php on line 171
The page can be found here:http://atmospherebooks.com/webstore/...ftcards_lookup
Sample Coupon(s):9094724036158481 or MW1D1-041V1-90V5X-ND7VM-R1
Last edited by sammirah; 13 Apr 2019 at 11:15 AM.
This problem is that the table: zen_customers_basket does not have the field final_price. The field is/was requested in the google_analytics.php file at line 247. That request may have been built before that line. Considering that the table is used to recover items stored for future purchase, I wouldn't expect final_price to necessarily be present.
This error is a result of an absence of a catalog side define for TABLE_GIFTCARDS. Depending on what the table is actually called (zen_giftcards maybe), would expect a define such as below in: includes/extra_datafiles
Code:<?php /** * define for the table called giftcards. **/ define('TABLE_GIFTCARDS', DB_PREFIX . 'giftcards');
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...
Let me clarify, I am modeling this page after the DISCOUNT_COUPON module. But I can't find any in includes/extra_datafiles that defines the database is that because it is located somewhere else as a built in module?
Not to be a pain, but if I make a file for example: giftcards_lookup_database_tables.php and input the suggested:
How will it find it? Will I need to let it know to look for that file that has the define or is that an automatic process?Code:<?php /** * define for the table called giftcards. **/ define('TABLE_GIFTCARDS', DB_PREFIX . 'giftcards');
Bookmarks