Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Posts
    427
    Plugin Contributions
    0

    Default Major attributes issues!

    Hello,
    I have asked before but no one seems to know what the issue is. When I add the pricing options and go to the controller, when i press insert I am directed back to the main admin screen.
    When i first got zen cart and when I deleted and updated it all (i know i didnt have to delete!) the attributes seemed to work. however, not now. I wondered if it was the template but I switched back to the zencart one and it didnt make it any difference. I am wondering if I have changed something somewhere but all I think I changed was the templates?

    Does anyone know of there is something i can do? Getting really annoyed now

    I am on newest zencart

    thankyou
    Amy

  2. #2
    Join Date
    Feb 2012
    Posts
    427
    Plugin Contributions
    0

    Default Re: Major attributes issues!

    Is it something to do with my debug logs?

    <?php
    /**
    * define_queries
    * defines queries used in various codeblocks
    * can be used to assist with special requirements for other database-abstraction configurations
    *
    * @package classes
    * @copyright Copyright 2003-2005 Zen Cart Development Team
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    * @version $Id: define_queries.php 4587 2006-09-23 00:46:06Z ajeh $
    */
    if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
    }
    DEFINE('SQL_CC_ENABLED', "select configuration_key from " . TABLE_CONFIGURATION . " where configuration_key RLIKE 'CC_ENABLED' and configuration_value= '1'");
    DEFINE('SQL_SHOW_PRODUCT_INFO_CATEGORY', "select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_key RLIKE 'SHOW_PRODUCT_INFO_CATEGORY' and configuration_value > 0 order by configuration_value");
    DEFINE('SQL_SHOW_PRODUCT_INFO_MAIN',"select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_key RLIKE 'SHOW_PRODUCT_INFO_MAIN' and configuration_value > 0 order by configuration_value");
    DEFINE('SQL_SHOW_PRODUCT_INFO_MISSING',"select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_key RLIKE 'SHOW_PRODUCT_INFO_MISSING' and configuration_value > 0 order by configuration_value");
    DEFINE('SQL_SHOW_PRODUCT_INFO_LISTING_BELOW',"select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_key RLIKE 'SHOW_PRODUCT_INFO_LISTING_BELOW' and configuration_value > 0 order by configuration_value");
    DEFINE('SQL_BANNER_CHECK_QUERY', "select count(*) as count from " . TABLE_BANNERS_HISTORY . " where banners_id = '%s' and date_format(banners_history_date, '%%Y%%m%%d') = date_format(now(), '%%Y%%m%%d')");
    DEFINE('SQL_BANNER_CHECK_UPDATE', "update " . TABLE_BANNERS_HISTORY . " set banners_shown = banners_shown +1 where banners_id = '%s' and date_format(banners_history_date, '%%Y%%m%%d') = date_format(now(), '%%Y%%m%%d')");
    DEFINE('SQL_BANNER_UPDATE_CLICK_COUNT', "update " . TABLE_BANNERS_HISTORY . " set banners_clicked = banners_clicked + 1 where banners_id = '%s' and date_format(banners_history_date, '%%Y%%m%%d') = date_format(now(), '%%Y%%m%%d')");
    DEFINE('SQL_ALSO_PURCHASED', "select p.products_id, p.products_image
    from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, "
    . TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p
    where opa.products_id = '%s'
    and opa.orders_id = opb.orders_id
    and opb.products_id != '%s'
    and opb.products_id = p.products_id
    and opb.orders_id = o.orders_id
    and p.products_status = 1
    group by p.products_id
    order by o.date_purchased desc
    limit " . MAX_DISPLAY_ALSO_PURCHASED);
    DEFINE('SQL_SHOW_SHOPPING_CART_EMPTY',"select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_key RLIKE 'SHOW_SHOPPING_CART_EMPTY' and configuration_value > 0 order by configuration_value");
    ?>


    OR...

    <?php
    /**
    * MySQL query_factory Class.
    * Class used for database abstraction to MySQL
    *
    * @package classes
    * @copyright Copyright 2003-2011 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 $Id: query_factory.php 18994 2011-06-30 20:04:18Z wilt $
    */
    if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
    }
    /**
    * Queryfactory - A simple database abstraction layer
    *
    */
    class queryFactory extends base {
    var $link, $count_queries, $total_query_time;

    function queryFactory() {
    $this->count_queries = 0;
    $this->total_query_time = 0;
    }

    function connect($zf_host, $zf_user, $zf_password, $zf_database, $zf_pconnect = 'false', $zp_real = false) {
    $this->database = $zf_database;
    $this->user = $zf_user;
    $this->host = $zf_host;
    $this->password = $zf_password;
    $this->pConnect = $zf_pconnect;
    $this->real = $zp_real;
    if (!function_exists('mysql_connect')) die ('Call to undefined function: mysql_connect(). Please install the MySQL Connector for PHP');
    $connectionRetry = 10;
    while (!isset($this->link) || ($this->link == FALSE && $connectionRetry !=0) )
    {
    $this->link = @mysql_connect($zf_host, $zf_user, $zf_password, true);
    $connectionRetry--;
    }
    if ($this->link) {
    if (@mysql_select_db($zf_database, $this->link)) {
    if (defined('DB_CHARSET') && version_compare(@mysql_get_server_info(), '4.1.0', '>=')) {
    @mysql_query("SET NAMES '" . DB_CHARSET . "'", $this->link);
    if (function_exists('mysql_set_charset')) {
    @mysql_set_charset(DB_CHARSET, $this->link);
    } else {
    @mysql_query("SET CHARACTER SET '" . DB_CHARSET . "'", $this->link);
    }
    }
    $this->db_connected = true;
    if (getenv('TZ') && !defined('DISABLE_MYSQL_TZ_SET')) @mysql_query("SET time_zone = '" . substr_replace(date("O"),":",-2,0) . "'", $this->link);
    return true;
    } else {
    $this->set_error(mysql_errno(),mysql_error(), $zp_real);
    return false;
    }
    } else {
    $this->set_error(mysql_errno(),mysql_error(), $zp_real);
    return false;
    }
    }

    function selectdb($zf_database) {
    @mysql_select_db($zf_database, $this->link);
    }

    function prepare_input($zp_string) {
    if (function_exists('mysql_real_escape_string')) {
    return mysql_real_escape_string($zp_string, $this->link);
    } elseif (function_exists('mysql_escape_string')) {
    return mysql_escape_string($zp_string, $this->link);
    } else {
    return addslashes($zp_string);
    }
    }

    function close() {
    @mysql_close($this->link);
    }

    function set_error($zp_err_num, $zp_err_text, $zp_fatal = true) {
    $this->error_number = $zp_err_num;
    $this->error_text = $zp_err_text;
    if ($zp_fatal && $zp_err_num != 1141) { // error 1141 is okay ... should not die on 1141, but just continue on instead
    $this->show_error();
    die();
    }
    }

    function show_error() {
    if ($this->error_number == 0 && $this->error_text == DB_ERROR_NOT_CONNECTED && !headers_sent() && file_exists('nddbc.html') ) include('nddbc.html');
    echo '<div class="systemError">';
    if (defined('STRICT_ERROR_REPORTING') && STRICT_ERROR_REPORTING == true)
    {
    echo $this->error_number . ' ' . $this->error_text;
    echo '<br />in:<br />[' . (strstr($this->zf_sql, 'db_cache') ? 'db_cache table' : $this->zf_sql) . ']<br />';
    } else {
    echo 'WARNING: An Error occurred, please refresh the page and try again.';
    }
    trigger_error($this->error_number . ':' . $this->error_text . ' :: ' . $this->zf_sql, E_USER_ERROR);
    if (defined('IS_ADMIN_FLAG') && IS_ADMIN_FLAG==true) echo '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.<br />';
    echo '</div>';
    }

    function Execute($zf_sql, $zf_limit = false, $zf_cache = false, $zf_cachetime=0) {
    // bof: collect database queries
    if (defined('STORE_DB_TRANSACTIONS') && STORE_DB_TRANSACTIONS=='true') {
    global $PHP_SELF, $box_id, $current_page_base;
    if (strtoupper(substr($zf_sql,0,6))=='SELECT' /*&& strstr($zf_sql,'products_id')*/) {
    $f=@fopen(DIR_FS_SQL_CACHE.'/query_selects_' . $current_page_base . '_' . time() . '.txt','a');
    if ($f) {
    fwrite($f, "\n\n" . 'I AM HERE ' . $current_page_base . /*zen_get_all_get_params() .*/ "\n" . 'sidebox: ' . $box_id . "\n\n" . "Explain \n" . $zf_sql.";\n\n");
    fclose($f);
    }
    unset($f);
    }
    }
    // eof: collect products_id queries
    global $zc_cache;
    if ($zf_limit) {
    $zf_sql = $zf_sql . ' LIMIT ' . $zf_limit;
    }
    $this->zf_sql = $zf_sql;
    if ( $zf_cache AND $zc_cache->sql_cache_exists($zf_sql, $zf_cachetime) ) {
    $obj = new queryFactoryResult;
    $obj->cursor = 0;
    $obj->is_cached = true;
    $obj->sql_query = $zf_sql;
    $zp_result_array = $zc_cache->sql_cache_read($zf_sql);
    $obj->result = $zp_result_array;
    if (sizeof($zp_result_array) > 0 ) {
    $obj->EOF = false;
    while (list($key, $value) = each($zp_result_array[0])) {
    $obj->fields[$key] = $value;
    }
    return $obj;
    } else {
    $obj->EOF = true;
    }
    } elseif ($zf_cache) {
    $zc_cache->sql_cache_expire_now($zf_sql);
    $time_start = explode(' ', microtime());
    $obj = new queryFactoryResult;
    $obj->sql_query = $zf_sql;
    if (!$this->db_connected)
    {
    if (!$this->connect($this->host, $this->user, $this->password, $this->database, $this->pConnect, $this->real))
    $this->set_error('0', DB_ERROR_NOT_CONNECTED);
    }
    $zp_db_resource = @mysql_query($zf_sql, $this->link);
    if (!$zp_db_resource) $this->set_error(@mysql_errno(),@mysql_error());
    if(!is_resource($zp_db_resource)){
    $obj = null;
    return true;
    }
    $obj->resource = $zp_db_resource;
    $obj->cursor = 0;
    $obj->is_cached = true;
    if ($obj->RecordCount() > 0) {
    $obj->EOF = false;
    $zp_ii = 0;
    while (!$obj->EOF) {
    $zp_result_array = @mysql_fetch_array($zp_db_resource);
    if ($zp_result_array) {
    while (list($key, $value) = each($zp_result_array)) {
    if (!preg_match('/^[0-9]/', $key)) {
    $obj->result[$zp_ii][$key] = $value;
    }
    }
    } else {
    $obj->Limit = $zp_ii;
    $obj->EOF = true;
    }
    $zp_ii++;
    }
    while (list($key, $value) = each($obj->result[$obj->cursor])) {
    if (!preg_match('/^[0-9]/', $key)) {
    $obj->fields[$key] = $value;
    }
    }
    $obj->EOF = false;
    } else {
    $obj->EOF = true;
    }
    $zc_cache->sql_cache_store($zf_sql, $obj->result);
    $time_end = explode (' ', microtime());
    $query_time = $time_end[1]+$time_end[0]-$time_start[1]-$time_start[0];
    $this->total_query_time += $query_time;
    $this->count_queries++;
    return($obj);
    } else {
    $time_start = explode(' ', microtime());
    $obj = new queryFactoryResult;
    if (!$this->db_connected)
    {
    if (!$this->connect($this->host, $this->user, $this->password, $this->database, $this->pConnect, $this->real))
    $this->set_error('0', DB_ERROR_NOT_CONNECTED);
    }
    $zp_db_resource = @mysql_query($zf_sql, $this->link);
    if (!$zp_db_resource) {
    if (@mysql_errno($this->link) == 2006) {
    $this->link = FALSE;
    $this->connect($this->host, $this->user, $this->password, $this->database, $this->pConnect, $this->real);
    $zp_db_resource = @mysql_query($zf_sql, $this->link);
    }
    if (!$zp_db_resource) {
    $this->set_error(@mysql_errno($this->link),@mysql_error($this->link));
    }
    }
    if(!is_resource($zp_db_resource)){
    $obj = null;
    return true;
    }
    $obj->resource = $zp_db_resource;
    $obj->cursor = 0;
    if ($obj->RecordCount() > 0) {
    $obj->EOF = false;
    $zp_result_array = @mysql_fetch_array($zp_db_resource);
    if ($zp_result_array) {
    while (list($key, $value) = each($zp_result_array)) {
    if (!preg_match('/^[0-9]/', $key)) {
    $obj->fields[$key] = $value;
    }
    }
    $obj->EOF = false;
    } else {
    $obj->EOF = true;
    }
    } else {
    $obj->EOF = true;
    }

    $time_end = explode (' ', microtime());
    $query_time = $time_end[1]+$time_end[0]-$time_start[1]-$time_start[0];
    $this->total_query_time += $query_time;
    $this->count_queries++;
    return($obj);
    }
    }

    function ExecuteRandomMulti($zf_sql, $zf_limit = 0, $zf_cache = false, $zf_cachetime=0) {
    $this->zf_sql = $zf_sql;
    $time_start = explode(' ', microtime());
    $obj = new queryFactoryResult;
    $obj->result = array();
    if (!$this->db_connected)
    {
    if (!$this->connect($this->host, $this->user, $this->password, $this->database, $this->pConnect, $this->real))
    $this->set_error('0', DB_ERROR_NOT_CONNECTED);
    }
    $zp_db_resource = @mysql_query($zf_sql, $this->link);
    if (!$zp_db_resource) $this->set_error(mysql_errno(),mysql_error());
    if(!is_resource($zp_db_resource)){
    $obj = null;
    return true;
    }
    $obj->resource = $zp_db_resource;
    $obj->cursor = 0;
    $obj->Limit = $zf_limit;
    if ($obj->RecordCount() > 0 && $zf_limit > 0) {
    $obj->EOF = false;
    $zp_Start_row = 0;
    if ($zf_limit) {
    $zp_start_row = zen_rand(0, $obj->RecordCount() - $zf_limit);
    }
    $obj->Move($zp_start_row);
    $obj->Limit = $zf_limit;
    $zp_ii = 0;
    while (!$obj->EOF) {
    $zp_result_array = @mysql_fetch_array($zp_db_resource);
    if ($zp_ii == $zf_limit) $obj->EOF = true;
    if ($zp_result_array) {
    while (list($key, $value) = each($zp_result_array)) {
    $obj->result[$zp_ii][$key] = $value;
    }
    } else {
    $obj->Limit = $zp_ii;
    $obj->EOF = true;
    }
    $zp_ii++;
    }
    $obj->result_random = array_rand($obj->result, sizeof($obj->result));
    if (is_array($obj->result_random)) {
    $zp_ptr = $obj->result_random[$obj->cursor];
    } else {
    $zp_ptr = $obj->result_random;
    }
    while (list($key, $value) = each($obj->result[$zp_ptr])) {
    if (!preg_match('/^[0-9]/', $key)) {
    $obj->fields[$key] = $value;
    }
    }
    $obj->EOF = false;
    } else {
    $obj->EOF = true;
    }


    $time_end = explode (' ', microtime());
    $query_time = $time_end[1]+$time_end[0]-$time_start[1]-$time_start[0];
    $this->total_query_time += $query_time;
    $this->count_queries++;
    return($obj);
    }

    function insert_ID() {
    return @mysql_insert_id($this->link);
    }

    function metaColumns($zp_table) {
    $sql = "SHOW COLUMNS from :tableName:";
    $sql = $this->bindVars($sql, ':tableName:', $zp_table, 'noquotestring');
    $res = $this->execute($sql);
    while (!$res->EOF)
    {
    $obj [strtoupper($res->fields['Field'])] = new queryFactoryMeta($res->fields);
    $res->MoveNext();
    }
    return $obj;
    }

    function get_server_info() {
    if ($this->link) {
    return mysql_get_server_info($this->link);
    } else {
    return UNKNOWN;
    }
    }

    function queryCount() {
    return $this->count_queries;
    }

    function queryTime() {
    return $this->total_query_time;
    }

    function perform ($tableName, $tableData, $performType='INSERT', $performFilter='', $debug=false) {
    switch (strtolower($performType)) {
    case 'insert':
    $insertString = "";
    $insertString = "INSERT INTO " . $tableName . " (";
    foreach ($tableData as $key => $value) {
    if ($debug === true) {
    echo $value['fieldName'] . '#';
    }
    $insertString .= $value['fieldName'] . ", ";
    }
    $insertString = substr($insertString, 0, strlen($insertString)-2) . ') VALUES (';
    reset($tableData);
    foreach ($tableData as $key => $value) {
    $bindVarValue = $this->getBindVarValue($value['value'], $value['type']);
    $insertString .= $bindVarValue . ", ";
    }
    $insertString = substr($insertString, 0, strlen($insertString)-2) . ')';
    if ($debug === true) {
    echo $insertString;
    die();
    } else {
    $this->execute($insertString);
    }
    break;
    case 'update':
    $updateString ="";
    $updateString = 'UPDATE ' . $tableName . ' SET ';
    foreach ($tableData as $key => $value) {
    $bindVarValue = $this->getBindVarValue($value['value'], $value['type']);
    $updateString .= $value['fieldName'] . '=' . $bindVarValue . ', ';
    }
    $updateString = substr($updateString, 0, strlen($updateString)-2);
    if ($performFilter != '') {
    $updateString .= ' WHERE ' . $performFilter;
    }
    if ($debug === true) {
    echo $updateString;
    die();
    } else {
    $this->execute($updateString);
    }
    break;
    }
    }
    function getBindVarValue($value, $type) {
    $typeArray = explode(':',$type);
    $type = $typeArray[0];
    switch ($type) {
    case 'csv':
    return $value;
    break;
    case 'passthru':
    return $value;
    break;
    case 'float':
    return (!zen_not_null($value) || $value=='' || $value == 0) ? 0 : $value;
    break;
    case 'integer':
    return (int)$value;
    break;
    case 'string':
    if (isset($typeArray[1])) {
    $regexp = $typeArray[1];
    }
    return '\'' . $this->prepare_input($value) . '\'';
    break;
    case 'noquotestring':
    return $this->prepare_input($value);
    break;
    case 'currency':
    return '\'' . $this->prepare_input($value) . '\'';
    break;
    case 'date':
    return '\'' . $this->prepare_input($value) . '\'';
    break;
    case 'enum':
    if (isset($typeArray[1])) {
    $enumArray = explode('|', $typeArray[1]);
    }
    return '\'' . $this->prepare_input($value) . '\'';
    case 'regexp':
    $searchArray = array('[', ']', '(', ')', '{', '}', '|', '*', '?', '.', '$', '^');
    foreach ($searchArray as $searchTerm) {
    $value = str_replace($searchTerm, '\\' . $searchTerm, $value);
    }
    return $this->prepare_input($value);
    default:
    die('var-type undefined: ' . $type . '('.$value.')');
    }
    }
    /**
    * method to do bind variables to a query
    **/
    function bindVars($sql, $bindVarString, $bindVarValue, $bindVarType, $debug = false) {
    $bindVarTypeArray = explode(':', $bindVarType);
    $sqlNew = $this->getBindVarValue($bindVarValue, $bindVarType);
    $sqlNew = str_replace($bindVarString, $sqlNew, $sql);
    return $sqlNew;
    }

    function prepareInput($string) {
    return $this->prepare_input($string);
    }
    }

    class queryFactoryResult {

    function queryFactoryResult() {
    $this->is_cached = false;
    }

    function MoveNext() {
    global $zc_cache;
    $this->cursor++;
    if ($this->is_cached) {
    if ($this->cursor >= sizeof($this->result)) {
    $this->EOF = true;
    } else {
    while(list($key, $value) = each($this->result[$this->cursor])) {
    $this->fields[$key] = $value;
    }
    }
    } else {
    $zp_result_array = @mysql_fetch_array($this->resource);
    if (!$zp_result_array) {
    $this->EOF = true;
    } else {
    while (list($key, $value) = each($zp_result_array)) {
    if (!preg_match('/^[0-9]/', $key)) {
    $this->fields[$key] = $value;
    }
    }
    }
    }
    }

    function MoveNextRandom() {
    $this->cursor++;
    if ($this->cursor < $this->Limit) {
    $zp_result_array = $this->result[$this->result_random[$this->cursor]];
    while (list($key, $value) = each($zp_result_array)) {
    if (!preg_match('/^[0-9]/', $key)) {
    $this->fields[$key] = $value;
    }
    }
    } else {
    $this->EOF = true;
    }
    }

    function RecordCount() {
    return @mysql_num_rows($this->resource);
    }

    function Move($zp_row) {
    global $db;
    if (@mysql_data_seek($this->resource, $zp_row)) {
    $zp_result_array = @mysql_fetch_array($this->resource);
    while (list($key, $value) = each($zp_result_array)) {
    $this->fields[$key] = $value;
    }
    @mysql_data_seek($this->resource, $zp_row);
    $this->EOF = false;
    return;
    } else {
    $this->EOF = true;
    $db->set_error(mysql_errno(),mysql_error());
    }
    }
    }

    class queryFactoryMeta {

    function queryFactoryMeta($zp_field) {
    $type = $zp_field['Type'];
    $rgx = preg_match('/^[a-z]*/', $type, $matches);
    $this->type = $matches[0];
    $this->max_length = preg_replace('/[a-z\(\)]/', '', $type);
    }
    }

  3. #3
    Join Date
    Feb 2012
    Posts
    427
    Plugin Contributions
    0

    Default Re: Major attributes issues!

    Ignore the above lol, posted the wrong thing. Wondering if it is since I added the wholesale/ dual pricing add on?

  4. #4
    Join Date
    Oct 2005
    Posts
    286
    Plugin Contributions
    0

    Default Re: Major attributes issues!

    Yep, it's a problem with dual pricing -

    http://www.zen-cart.com/forum/showth...35#post1113035

 

 

Similar Threads

  1. Replies: 2
    Last Post: 12 Sep 2013, 07:51 AM
  2. Major Speed Issues
    By beejay2020 in forum General Questions
    Replies: 3
    Last Post: 23 Mar 2009, 11:26 PM
  3. Major Email Issues
    By larojiblanca in forum General Questions
    Replies: 1
    Last Post: 5 Mar 2009, 06:17 AM
  4. Major Issues with template
    By Walltalkonline in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 21 Feb 2009, 06:26 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