Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Apr 2012
    Location
    Los Angeles, CA
    Posts
    185
    Plugin Contributions
    2

    Idea or Suggestion How to display select information from database?

    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?

  2. #2
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: How to display select information from database

    Quote Originally Posted by sammirah View Post
    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!

  3. #3
    Join Date
    Jul 2012
    Posts
    16,719
    Plugin Contributions
    17

    Default Re: How to display select information from database

    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...

  4. #4
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: How to display select information from database

    That was my first thought too. It would be really easy for a bot to fill in a sequence and see what comes back. Ad there is a page on the account section for this.
    Quote Originally Posted by mc12345678 View Post
    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?

  5. #5
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: How to display select information from database

    Quote Originally Posted by Design75 View Post
    That was my first thought too. It would be really easy for a bot to fill in a sequence and see what comes back. Ad there is a page on the account section for this.
    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!

  6. #6
    Join Date
    Apr 2012
    Location
    Los Angeles, CA
    Posts
    185
    Plugin Contributions
    2

    Default Re: How to display select information from database

    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:
    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
    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?

  7. #7
    Join Date
    Apr 2012
    Location
    Los Angeles, CA
    Posts
    185
    Plugin Contributions
    2

    Default Re: How to display select information from database

    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:
    Code:
    [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
    I tried re-writing it as TABLE_zen_GIFTCARDS or even TABLE_zen_giftcards

    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.

  8. #8
    Join Date
    Jul 2012
    Posts
    16,719
    Plugin Contributions
    17

    Default Re: How to display select information from database

    Quote Originally Posted by sammirah View Post
    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:
    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
    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?
    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.

    Quote Originally Posted by sammirah View Post
    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:
    Code:
    [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
    I tried re-writing it as TABLE_zen_GIFTCARDS or even TABLE_zen_giftcards

    The page can be found here:http://atmospherebooks.com/webstore/...ftcards_lookup

    Sample Coupon(s):9094724036158481 or MW1D1-041V1-90V5X-ND7VM-R1
    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...

  9. #9
    Join Date
    Apr 2012
    Location
    Los Angeles, CA
    Posts
    185
    Plugin Contributions
    2

    Default Re: How to display select information from database

    Quote Originally Posted by mc12345678 View Post
    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');

    I'm sorry, I am confused...do I need to make a new file and put this line it? What do I name it so that it will be recognized?

  10. #10
    Join Date
    Apr 2012
    Location
    Los Angeles, CA
    Posts
    185
    Plugin Contributions
    2

    Default Re: How to display select information from database

    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:
    Code:
    <?php
    /**
     * define for the table called giftcards.
     **/
    
    define('TABLE_GIFTCARDS', DB_PREFIX . 'giftcards');
    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?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v153 How do I Display Additional Read Only Product Information from Custom Product Fields
    By FoodSourceDirect in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 5 Aug 2014, 08:42 PM
  2. Replies: 8
    Last Post: 24 Nov 2012, 02:12 PM
  3. how to move link from more information to information side box?
    By mrobson86 in forum General Questions
    Replies: 1
    Last Post: 21 Sep 2011, 09:01 PM
  4. How do I select tabular display ?
    By ruthnis in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 26 Jun 2007, 04:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR