Is there a way to get the exact table name in the DB? One of the frustration in this project is that I have to built this on a not fully accessible server... Since I don't have all the access I had to use some imagination. But first, here's the code I use in the file I called class.sendClubOrderNotices.php:
Code:
<?php
/**
* observer class to send custom extra order emails to supplier based on customer group membership
*
* @package classes
* @copyright Copyright 2003-2010 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: class.sendClubsOrderNotices.php 2010-05-26 20:05:22Z drbyte $
*/
class sendClubsOrderNotices extends base {
/** constructor method !
*
* Attach observer class to the global $zco_notifier and watch for a single notifier event.
*/
function sendClubsOrderNotices() {
$this->attach($this, array('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL'));
/**
* Set the email subject line for the messages being sent to the external supplier
* Use EMAIL_TEXT_SUBJECT for the default subject, or replace with 'My Custom Subject Line' instead.
*/
$this->orderEmailSubjectPrefix = 'Demande de confirmation de membre par ' . STORE_NAME;
}
/** Actual Method that does the desired activity
*
* Called by observed class when any of the notifiable events occur
*
* @param object $class
* @param string $eventID
*/
function update(&$class, $eventID, $paramsArray = array()) {
global $db;
list($zf_insert_id, $email_order, $extra_info, $html_msg) = $paramsArray;
$group_query = $db->Execute("select products_option_value_id from " . customers_basket_attributes . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
if (!$group_query->EOF) {
$this->ClubEmailAddress = '';
switch($group_query->fields['products_option_value_id']) {
case '6':
$this->ClubEmailAddress = '[email protected]';
$this->orderEmailSubjectPrefix = 'Demande de confirmation de membre par ' . STORE_NAME;
break;
case '9':
$this->ClubEmailAddress = '[email protected]';
$this->orderEmailSubjectPrefix = 'Demande de confirmation de membre par ' . STORE_NAME;
break;
case '10':
$this->ClubEmailAddress = '[email protected]';
$this->orderEmailSubjectPrefix = 'Demande de confirmation de membre par ' . STORE_NAME;
break;
case '12':
$this->ClubEmailAddress = '[email protected]';
$this->orderEmailSubjectPrefix = 'Demande de confirmation de membre par ' . STORE_NAME;
break;
default:
}
if ($this->ClubEmailAddress != '')
zen_mail('', $this->ClubEmailAddress,
$this->orderEmailSubjectPrefix . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
}
}
}
Off course, I also corrected the name of the config. file and his content. Note also that the class. file currently on the server has real email addresses in the code to test the differents options.
So, I was able to load the store without any blank page, which is great. I was also able to complete an order but after the payment on Paypal I get an error message on a blank page saying "WARNING: An Error occurred, please refresh the page and try again.". After a refresh the store loads up properly but I had this message in a red box:
10415 Transaction refused because of an invalid argument. See additional error messages for details. - A successful transaction has already been completed for this token.
With a quick search on the Forum I found a thread where you suggest a problem linked to a miscalled table : http://www.zen-cart.com/showthread.p...04#post1028104 This makes a lot of sens to me since I can't be sure about the table name. I suspected that the error was from this SQL query:
Code:
$group_query = $db->Execute("select products_option_value_id from " . customers_basket_attributes . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
By looking in the logs I found this error which confirm my thoughts:
Code:
PHP Fatal error: 1146:Table 'fc41320205382856.customers_basket_attributes' doesn't exist :: select products_option_value_id from customers_basket_attributes where customers_id = '10' in /home/content/06/8442606/html/boutique/includes/classes/db/mysql/query_factory.php on line 120
The payment was received on the Paypal account but Paypal send an email about this 10415 error and didn't returned any info about the payment to ZenCart. So the order details of the admin stayed empty.
So, the question is, is there a way to get the exact name of the table from distance?
And off course, do you see any other error in that code?
Bookmarks