
Originally Posted by
mc12345678
All files that have a suffix (end with) of '.php' and do not begin with an underscore that are within that folder are loaded by the system on each page load. So the define provided above will be loaded providing a sort of fill-in-the-blank result for php.
After that define is processed, anywhere in php code (after the opening tag of <?php and if present before the closing tag of ?>) anywhere that TABLE_GIFTCARDS is used (without quotes) it would be as if the entry is DB_PREFIX . 'giftcards' and note that DB_PREFIX is defined earlier in includes/configure.php so it's value is substituted in there as well such that in the case described above DB_PREFIX is 'zen_' making TABLE_GIFTCARDS to be 'zen_giftcards'.
Ok, so now I have the Define in place and I am getting this error now:
Code:
[09-Jul-2019 23:16:45 America/Los_Angeles] PHP Fatal error: Call to a member function RecordCount() on null in /home/sammirah/public_html/webstore/includes/modules/pages/giftcards_lookup/header_php.php on line 19
When I got to that file line 19 reads:
Code:
<?php
/**
* giftcard lookup info
*
* @package page
* @copyright Copyright 2003-2019 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version GIT: $Id: Author: Sammirah. Friday, April 12, 2019 18:36 PM Modified in v1.5.5f $
*/
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$text_giftcards_help = '';
if (isset($_POST['lookup_giftcards_lookup']) and $_POST['lookup_giftcards_lookup'] != '') {
// lookup requested giftcard
$giftcard = $db->Execute("select * from " . TABLE_GIFTCARDS . " where giftcard_code = '" . zen_db_input($_POST['lookup_giftcards_lookup']) . "' and giftcard_active != 'Y'");
$_POST['lookup_giftcards_lookup'] = zen_sanitize_string($_POST['lookup_giftcards_lookup']);
if ($giftcards->RecordCount(1) < 1) {
// invalid giftcard code
$text_giftcards_help = sprintf(TEXT_GIFTCARD_FAILED, zen_output_string_protected($_POST['lookup_giftcards_lookup']));
} else {
// valid giftcard code
$lookup_giftcard_id = $giftcards->fields['giftcard_id'];
$giftcard_value = $giftcards->fields['giftcard_value'];
switch ($giftcards->fields['giftcard_active']) {
case 'Y':
$text_giftcards_help .= sprintf(TEXT_GIFTCARDS_HELP_FIXED, $currencies->format($giftcards->fields['giftcard_balance']));
break;
case 'P':
$text_coupon_help .= sprintf(TEXT_COUPON_HELP_FIXED, number_format($coupon->fields['coupon_amount'],2). '%');
break;
default:
}
$text_giftcard_help .= sprintf(TEXT_GIFTCARD_HELP_DATE, zen_date_short($giftcard->fields['date_modified']));
}
}
// include template specific file name defines
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_GIFTCARDS_LOOKUP, 'false');
$breadcrumb->add(NAVBAR_TITLE);
?>
As I am modeling this after DISCOUNT_COUPON, I am afraid I have completely missed a step. Perhaps someone else can see something I can't.
Bookmarks