Dear All,
I am trying to develop an add-on for zen cart and after reading posts and books and tutorials I still have two problems:
1. First I am trying to run the following piece of code (it is about a pop up windows where the user can search for other customers):
Inside: zencart\includes\templates\CUSTOM\popup_account_search\tpl_main_page.php:
PHP Code:
$search = '';
$search = " where c.customers_lastname like '%" . $sData['firstname'] . "%' and c.customers_firstname like '%" . $sData['lastname'] . "%' and c.customers_email_address like '%" . $sData['email'] . "%'";
$search = $db->bindVars($search, ':keywords:', $keywords, 'regexp');
$customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address " . "
from " . TABLE_CUSTOMERS . " c" .
$search . " order by c.customers_lastname";
//$customers_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER, $customers_query_raw, $customers_query_numrows);
$customers = $db->Execute($customers_query_raw);
}
var_dump($customers);
while (!$customers->EOF) {
echo "<a href=\"javascript:send_back(".$customers->fields['customers_id'] . ",'" . $customers->fields['customers_firstname'] . " " . $customers->fields['customers_lastname'] . "')\">";
//echo "<a href=\"javascript:void(window.opener.document.form.ref.value = " . $customers->fields['customers_id'] . ")\">";
echo $customers->fields['customers_id'] . " " . $customers->fields['customers_lastname'] . " " . $customers->fields['customers_firstname'] . "</a>";
echo "<br>\n";
$customers->MoveNext();
The strange thing is that the db query is run correctly, the result get displayed but in the myDebug file I get the following error:
Error: PHP Fatal error: Call to a member function MoveNext() on a non-object
2. Secondly I am trying to separate logic from view, so I created a main_template_vars.php file and placed it into /module/pages/popup_account_search/ dir. Well the system does not see it at all!!! If I insert the code above there its like it is not there. Only if it inside the tpl_main_page.php gets executed.
Any ideas??
Any help would be extremely welcomed.
I thank you all in advance for your time and help.
Bookmarks