DC 1054 error, and error in 'Product Restrictions' section
I have created a discount coupon for new customers, and it is being mailed out with the welcome email correctly. On attempting to redeem the DC it generates a 1054 error. I have set restrictions to 'Allow' on 'Top' category, which means all categories. I am unable to set the same restrictions for products due to the following error:
Quote:
Catchable fatal error: Object of class queryFactoryResult could not be converted to string in /home/nilajah/public_html/sweetAfrikA999/includes/functions/html_output.php on line 334
When I try to offer new signups a GV for the same amount, it generates something like "Gift Certificate code is invalid" in a red box on top. The GV does show up under 'Sent' listing, but not in 'Queue'. I had my daughter test it, and in the admin section her GV shows a status of 'Redeemed' even though she has neither checked out, nor had the appropriate adjustment made in her subtotal.
Any help would be greatly appreciated.
Re: DC 1054 error, and error in 'Product Restrictions' section
Re: DC 1054 error, and error in 'Product Restrictions' section
Thanks for the reply, Dr. Byte. The debug logs did not show anything for this error, although the enable_error_logging.php file already exists in the extra_configures directory. Since the error specifically referenced a file name and a line number I thought I would go straight there first. Here is what I found:
Code:
if ($type=='button'){
// link button
$css_button = '<span class="' . $mouse_out_class . '" ' . $css_button_js . $style . ' > ' . $text . ' </span>'; // add $parameters ???
}
return $css_button;
}
The referenced line 334 of html_output.php is the last line of code, with a single closing curly bracket. Does this appear to be a problem? It is followed by 2 blank lines, and then the next bit of code continues. Perhaps I should reduce the 2 blank lines to 1, could that be it?
Re: DC 1054 error, and error in 'Product Restrictions' section
Perhaps I should quote the whole section of code, from line 298 to 334
Code:
/**
* generate CSS buttons in the current language
* concept from contributions by Seb Rouleau and paulm, subsequently adapted to Zen Cart
* note: any hard-coded buttons will not be able to use this function
**/
function zenCssButton($image = '', $text, $type, $sec_class = '', $parameters = '') {
// automatic width setting depending on the number of characters
$min_width = 80; // this is the minimum button width, change the value as you like
$character_width = 6.5; // change this value depending on font size!
// end settings
// added html_entity_decode function to prevent html special chars to be counted as multiple characters (like &)
$width = strlen(html_entity_decode($text)) * $character_width;
$width = (int)$width;
if ($width < $min_width) $width = $min_width;
$style = ' style="width: ' . $width . 'px;"';
// if no secondary class is set use the image name for the sec_class
if (empty($sec_class)) $sec_class = basename($image, '.gif');
if(!empty($sec_class))$sec_class = ' ' . $sec_class;
if(!empty($parameters))$parameters = ' ' . $parameters;
$mouse_out_class = 'cssButton' . $sec_class;
$mouse_over_class = 'cssButtonHover' . $sec_class . $sec_class . 'Hover';
// javascript to set different classes on mouseover and mouseout: enables hover effect on the buttons
// (pure css hovers on non link elements do work work in every browser)
$css_button_js .= 'onmouseover="this.className=\''. $mouse_over_class . '\'" onmouseout="this.className=\'' . $mouse_out_class . '\'"';
if ($type == 'submit'){
// form input button
$css_button = '<input class="' . $mouse_out_class . '" ' . $css_button_js . ' type="submit" value="' .$text . '"' . $parameters . $style . ' />';
}
if ($type=='button'){
// link button
$css_button = '<span class="' . $mouse_out_class . '" ' . $css_button_js . $style . ' > ' . $text . ' </span>'; // add $parameters ???
}
return $css_button;
}
Re: DC 1054 error, and error in 'Product Restrictions' section
My point was that you need to identify all the ways in which your code is different from original Zen Cart code, and then resolve the differences that are breaking your site from working the way an unaltered copy of the software normally works.
Re: DC 1054 error, and error in 'Product Restrictions' section
OK, thanks Dr. Byte, I will do that then.
Re: DC 1054 error, and error in 'Product Restrictions' section
OK, bring out the dunce cap! I forgot that the admin folder had been renamed, so the upgrade to 1.3.9h left the old admin folder of 1.3.7 untouched - I'm surprised it kept working just fine! Anyway, I decided to run WinMerge on it, and over wrote 294 old files. Now I am left with 25 files in the old folder that do not exist in the proper 1.3.9 admin folder. Some of these I can see are from add-ons, which I would rather re-install than attempt to merge. I hadn't kept a log of code changes I had made, and I didn't want to bother examining 294 files individually to see which ones to edit again.
I am now installing the latest versions of the add-ons to the local folder. When it's all done, I'll upload the folder and see how things work out. Thanks again, Dr. Byte, for the right idea.
Re: DC 1054 error, and error in 'Product Restrictions' section
OK, all admin directory files updated to default 1.3.9 versions. Now, the GV/DC page does not load at all, with error
Quote:
1054 Unknown column 'coupon_zone_restriction' in 'field list'
in:
[select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_p roducts, restrict_to_categories, date_created,date_modified, coupon_active, coupon_zone_restriction from zen_coupons where coupon_type != 'G' limit 0, 20]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
Does that look like an SQL error?
Re: DC 1054 error, and error in 'Product Restrictions' section
The error is from MySQL telling you that the requested field (from the SQL query built by your PHP files) doesn't exist in the database.
What's interesting is that the coupons table has had a coupon_zone_restriction table since at least v1.3.8, so either you've attempted an upgrade from a very old version and the upgrade failed, or your database is significantly damaged.
Re: DC 1054 error, and error in 'Product Restrictions' section
The upgrade was from 1.3.7, which ran for a long time, and it was executed by Cpanel/Fantastico built in script. I have looked at the discount_coupon and gv_* files in WinMerge and they are identical to the default version. Here is the patch history reported by the admin section:
v1.3.9h [2012-02-24 18:09:51] (Version Update 1.3.8->1.3.9h)
v1.3.9g [2012-02-24 18:09:51] (Version Update 1.3.8->1.3.9g)
v1.3.9d [2012-02-24 18:09:51] (Version Update 1.3.8b->1.3.9d)
v1.3.9b [2012-02-24 18:09:51] (Version Update 1.3.8->1.3.9b)
v1.3.8 [2012-02-24 18:09:51] (Version Update 1.3.7->1.3.8)
v1.3.7 [2007-01-17 04:13:46] (Version Update 1.3.6->1.3.7)
v1.3.5 [2007-01-16 23:52:33] (Version Update 1.3.0.2->1.3.5)
v1.3.0.2 [2007-01-16 23:52:31] (Version Update 1.3.0.1->1.3.0.2)
v1.3.0.1 [2007-01-16 23:52:31] (Version Update 1.3.0->1.3.0.1)
v1.3.0 [2006-06-19 19:42:31] (Fresh Installation)
I am an SQL ignoramus but I don't mind using either Zen or myAdmin from Cpanel to insert the missing table, if someone would be kind enough to write me the proper command.