Jump to content

Christopher Short

Member
  • Posts

    432
  • Joined

  • Last visited

Posts posted by Christopher Short

  1. I'll look at the log but all us zip codes have parcel post as an option....I can print it in PayPal. I need to figure out why the USPS response doesn't include it and the tech support for them says my web developer has to troubleshoot it. 

  2. The page real estate for an image is controlled by CSS. CubeCart does not make changes to CSS. That is, the use of {$PLACEHOLDERS} will not work in CSS files.

    What we can do is use Smarty to test if the name of the image source has "noimage" in the <img> tag, then add some "on-demand" css styling that will collapse the area.

    What did you have in mind for that?

  3. A category "level" is very arbitrary. An effect that happens on a third generation descendant for one category may also be wanted on the fifth generation descendant of a different category.

    So, any solution would probably have to identify a specific category and work on a per category basis.

    What we might think about doing is to replace the skin's existing "no_photo.jpg" image with a 1x1 transparent PNG file. The thing is, every skin I've seen gives a fixed amount of layout real estate to the image, so removing the image won't collapse the space around it. Unless you make edits to the CSS to solve that.

    ​I created a blank white image but it still spaces the names out with it.I wish we had a "use image" check box on the category when created and same thing for the products. Maybe have it default no image and when you turn the image option on it will adjust the spacing for it.

  4. Is it possible to have images be turned off on certain category levels? A simple check box for photo enabled would work for me. I would like to images for the manufacture tab, but do not need it for every sub level. Also, same thing for product images. Not all of them need image and it looks bad to have photo not available.

  5. They don't look related to me either, but then, "Duplicate entry" errors aren't supposed to happen either.

     

    Does this happen reliably? Can you give a sequence of steps that will absolutely cause this error to appear?

     

    If so, I have a diagnostic file that may be able to trace out where the problem begins, which the trail ends at line 77.

     

    If you cannot determine what steps would reliably cause this error, then finding the cause will be more difficult.

     

    In the meantime, you can try this edit:

          if ( isset($GLOBALS['cache']) && is_object($GLOBALS['cache']) ) { // << == NEW LINE
            $cache = (bool)$this->_config['config']['cache'];
            $GLOBALS['cache']->enable($cache);
            if(!$cache || (defined('CC_IN_ADMIN') && CC_IN_ADMIN)) {
                $GLOBALS['cache']->clear();
            }
          } // << == NEW LINE

    This says that only if Cache is present, then do this part.

     

    I compared CC600 and CC601 to see if there is any code changes related to this, and there isn't.

    Um, you're the man!!! this fixed ECC login issues. Now to find out why ecc pulledmy quickbooks data with a - sign in front of the numbers to give me negative inventory. Thanks for your help again.

  6. The Cache class is created before the Config class is created, so for Config to not find Cache means that PHP maybe has crashed, is shutting down, and in the shutting down, is processing the destruction of a class that calls on Config -- which has already been destroyed.

     

    Check the admin, System Logs, Error Log tab for any other errors near this one.

    I have sever similar to:

    File: [seo.class.php] Line: [624] "INSERT INTO `cc_CubeCart_seo_urls` (`type`,`item_id`,`path`,`custom`) VALUES ('cat','15','rocket-motors/loki-research/nozzles','0');" - Duplicate entry 'rocket-motors/loki-research/nozzles' for key 'PRIMARY'

     

    but they are 2 days old and don't look related to me.

  7. <?php

    /**

     * CubeCart v6

     * ========================================

     * CubeCart is a registered trade mark of CubeCart Limited

     * Copyright CubeCart Limited 2015. All rights reserved.

     * UK Private Limited Company No. 5323904

     * ========================================

     * Web:   http://www.cubecart.com

     * Email:  {removed}

     * License:  GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html

     */

    /**

     * Configuration controller

     *

     * @author Technocrat

     * @author Al Brookbanks

     * @since 5.0.0

     */

    class Config {

        /**

         * Current config

         *

         * @var array

         */

        private $_config = array();

        /**

         * Temp configs that should not be written to the db

         *

         * @var array

         */

        private $_temp  = array();

        /**

         * Write the config to the DB

         *

         * @var bool

         */

        private $_write_db = false;

        /**

         * Array of variables before config is written used for validation

         *

         * @var array

         */

        private $_pre_enc_config = array();

        /**

         * Class instance

         *

         * @var instance

         */

        protected static $_instance;

        ##############################################

        final protected function __construct($glob) {

            //Get the main config because it will be used

            if (isset($GLOBALS['db']) && ($result = $GLOBALS['db']->select('CubeCart_config', array('array'), array('name' => 'config'), false, 1, false, false)) !== false) {

                $array_out = $this->_json_decode($result[0]['array']);

            }

            //Remove the db password for safety

            unset($glob['dbpassword']);

            if (!empty($array_out)) {

                $this->_config['config'] = $this->_clean($array_out);

                //Merge the main global with the config

                if (is_array($this->_config['config'])) {

                    $this->_config['config'] = array_merge($this->_config['config'], $glob);

                }

            } else {

                $this->_config['config'] = $glob;

            }

            

            $cache = (bool)$this->_config['config']['cache'];

            $GLOBALS['cache']->enable($cache);

            if(!$cache || (defined('CC_IN_ADMIN') && CC_IN_ADMIN)) {

                $GLOBALS['cache']->clear();

            }

        }

        public function __destruct() {

            //Do we need to write to the db

            if ($this->_write_db) {

                $this->_writeDB();

            }

        }

        /**

         * Setup the instance (singleton)

         *

         * @param $glob array Current globals

         *

         * @return Config

         */

        public static function getInstance($glob = array()) {

            if (!(self::$_instance instanceof self)) {

                self::$_instance = new self($glob);

            }

            return self::$_instance;

        }

        //=====[ Public ]=======================================

        /**

         * Is there a config element

         *

         * @param string $config_name

         * @param string $element

         *

         * @return bool

         */

        public function has($config_name, $element) {

            return ($this->get($config_name, $element)) !== false;

        }

        /**

         * Get a value from the config

         *

         * Not all config types are loaded from the start this

         * is done to save cycles and memory

         *

         * If element is empty the entire array of the config

         * is returned

         *

         * @param string $config_name

         * @param string $element

         *

         * @return mixed / false

         */

        public function get($config_name, $element = '') {

            //If there is an config

            if (isset($this->_config[$config_name])) {

                //If there is not an element the entire array

                if (empty($element)) {

                    return $this->_config[$config_name];

                } else if (isset($this->_config[$config_name][$element])) {

                    return $this->_config[$config_name][$element];

                }

                return false;

            }

            //If we reached this part try to fetch it

            $this->_fetchConfig($config_name);

            //Return it if found

            return $this->get($config_name, $element);

        }

        /**

         * Is an element empty

         *

         * @param string $config_name

         * @param string $element

         *

         * @return bool

         */

        public function isEmpty($config_name, $element) {

            //If the element isn't there then it is empty

            if (!$this->has($config_name, $element)) {

                return true;

            }

            return empty($this->_config[$config_name][$element]);

        }

        /**

         * Merge an emlemet to the config

         *

         * This is done for items that do not need to be recorded to the db

         * or are single use config items.  For example ssl enable/disable.

         *

         * @param string $config_name

         * @param string $element

         * @param string $data

         */

        public function merge($config_name, $element, $data) {

            if (!empty($element)) {

                $this->_temp[$config_name][$element] = $data;

                $this->_config[$config_name][$element] = $data;

            } else {

                if (is_array($data)) {

                    if (isset($this->_temp[$config_name])) {

                        $this->_temp[$config_name] = merge_array($this->_temp[$config_name], $data);

                    } else {

                        $this->_temp[$config_name] = $data;

                    }

                    $this->_config[$config_name] = merge_array($this->_config[$config_name], $data);

                }

            }

        }

        /**

         * Set a config value

         *

         * If no element is set then the entire config is

         * set to the data

         *

         * @param string $config_name

         * @param string $element

         * @param string $data

         * @param bool $force_write

         *

         * @return bool

         */

        public function set($config_name, $element, $data, $force_write = false) {

            //Clean up the config array

            if (is_array($data) && !empty($element)) {

                array_walk_recursive($data, create_function('&$s, $k', '$s=stripslashes($s);'));

                $data = $this->_json_encode($data);

            } else if (is_array($data)) {

                    array_walk_recursive($data, create_function('&$s, $k', '$s=stripslashes($s);'));

                } else {

                $data = stripslashes($data);

            }

            /**

             * Check to see if the data is the same as it was.

             * If it is we dont need to do anything

             */

            if ($this->get($config_name, $element) == $data) {

                return true;

            }

            //If there isn't an element assign the entire thing

            if (empty($element)) {

                $this->_config[$config_name] = $data;

            } else {

                $this->_config[$config_name][$element] = $data;

            }

            //Write the to the db

            if (!$force_write) {

                $this->_write_db = true;

            } else {

                $this->_writeDB();

                $this->_write_db = false;

            }

            return true;

        }

        //=====[ Private ]=======================================

        /**

         * Strip slashes

         *

         * @param array $array

         *

         * @return array

         */

        private function _clean($array) {

            array_walk_recursive($array, create_function('&$s,$k', '$s=stripslashes($s);'));

            return $array;

        }

        /**

         * Fetch config data

         *

         * @param string $name

         */

        private function _fetchConfig($name) {

            //Clean up the entire config array

            $this->_config[$name] = array();

            //If the DB class exists and the config row exists

            if (isset($GLOBALS['db']) && ($result = $GLOBALS['db']->select('CubeCart_config', array('array'), array('name' => $name), false, 1, false)) !== false) {

                $array_out = $this->_json_decode($result[0]['array']);

                if (($module = $GLOBALS['db']->select('CubeCart_modules', array('status', 'countries'), array('folder' => $name), false, 1, false)) !== false) {

                    $array_out = array_merge($module[0], $array_out);

                }

                if (!empty($array_out)) {

                    $this->_config[$name] = $this->_clean($array_out);

                }

            }

        }

        /**

         * Json decode but convert if serialized

         */

        private function _json_decode($string) {

            if (preg_match('/^a:[0-9]/', $string)) { // convert from serialized and next save will convert

                $array = unserialize($string);

                if (isset($array['offline_content']) && !empty($array['offline_content'])) {

                    $array['offline_content'] = base64_decode($array['offline_content']);

                }

                if (isset($array['store_copyright']) && !empty($array['store_copyright'])) {

                    $array['store_copyright'] = base64_decode($array['store_copyright']);

                }

                return $array;

            } else {

                return json_decode(base64_decode($string), true);

            }

        }

        /**

         * Json encode

         */

        private function _json_encode($array) {

            $this->_pre_enc_config = $array;

            return base64_encode(json_encode($array));

        }

        /**

         * Write config to db

         */

        private function _writeDB() {

            if (!empty($this->_config) && is_array($this->_config)) {

                foreach ($this->_config as $config => $data) {

                    //Remove data that was merged in

                    if (!empty($this->_temp) && isset($this->_temp[$config])) {

                        $match = array_intersect_key($this->_temp[$config], $this->_config[$config]);

                        if (!empty($match)) {

                            foreach ($match as $k => $v) {

                                unset($data[$k]);

                            }

                        }

                    }

                    //If there is a problem abort

                    if (empty($data)) {

                        continue;

                    }

                    $record = array('array' => $this->_json_encode($data));

                    if (strlen($record['array']) > 65535 || strlen($config) > 100) {

                        trigger_error('Config write size error: '.$config, E_USER_ERROR);

                    }

                    if (Database::getInstance()->count('CubeCart_config', 'name', array('name' => $config))) {

                        //Safeguard to prevent config loss

                        if ($config=='config' && !isset($this->_pre_enc_config['store_name'])) {

                            return false;

                        } else {

                            Database::getInstance()->update('CubeCart_config', $record, array('name' => $config));

                        }

                    } else {

                        $record['name'] = $config;

                        Database::getInstance()->insert('CubeCart_config', $record);

                    }

                }

            }

        }

    }

  8. 2015-03-17 19:22:38.0407 Debug CommonUtility Custom Error <br />
    <b>Fatal error</b>:  Call to a member function enable() on a non-object in <store/classes/config.class.php</b> on line <b>77</b><br />
     

     

    I get this error. I attached the config file. Any ideas?

  9. In the skin template file content.category.php, the variable {$product.stock_level} is available.

     

     

    Ok. Now if I only wrote code. Is there anywhere I could learn to code for this stuff? I have some Matlab experience so I follow along sort of. I am using the Mican skin

  10. Is there a way to display quantity on the items when they are listed in a category? www,csrocketry.com, select rocket motors, Cessaroni, 29-3G and have the listed product show how many are available without clicking on each item.

  11. Fedex and UPS are both making major changes in the way shipping charges are calculated as of Jan, 2015 - dimensional weight pricing on ALL package sizes. Perhaps Fedex has made some intermediary change in preparation?

    I still have box dimensions in there, as I have forever.

  12. Then there should be $9.36 showing, and maybe the phrase "FedEx Ground".

     

    Let's look at what used to be line 195:

    'name' => (string)"FedEx ".$this->friendlyServiceName($rateReply->ServiceType),

    Getting the type caster affixed to the proper variable has been discussed with Devellion before. Change to:

    'name' => "FedEx ".$this->friendlyServiceName((string)$rateReply->ServiceType),

    Hopefully, making this edit will reveal the 'friendly name' of the service.

    Please remind me of the exact version of PHP that is running your site.

    PHP 5.4.33

     

    What is this change supposed to do? I don't see any change. The fedex option shows FEDEX, then the choice is $0.00(Fedex ground)

  13. Well, there is this:

    if($this->_settings['FDXG_'.$rateReply->ServiceType]==1){
    which tells me that the FedEx module will record what types of services you have enabled.

    Examples:

    FDXG_FIRST_OVERNIGHT

    FDXG_PRIORITY_OVERNIGHT

    FDXG_STANDARD_OVERNIGHT

    FDXG_FEDEX_2_DAY_AM

    FDXG_FEDEX_2_DAY

    and a couple more.

    In the response you posted above, these are coming back with prices.

    So, which of the FedEx services do you have enabled?

    Just ground

  14.  

    Freaky interesting!

    Let's try something funky for line 186:

    $fedex_tmp_array = (array)$fedex_tmp1; $fedex_tmp2 = array_shift($fedex_tmp_array); // get first element of array, the value of which is an object
    

    I wonder if line 187 now needs to go all the way:

    Was:
    $value = $fedex_tmp2->ShipmentRateDetail->TotalNetCharge->Amount;
     
    Now:
    $fedex_tmp3 = $fedex_tmp2->ShipmentRateDetail;
    $fedex_tmp4 = $fedex_tmp3->TotalNetCharge;
    $value = $fedex_tmp4->Amount;

    hmmmm.....Seems to fix it. The page loads. However, it does not pull a shipping quote.

  15.  

    Ok, the Fatal Error is now on line 186:

    $fedex_tmp2 = array_shift($fedex_tmp1); // get first element of array, the value of which is an object

    Let's try to make the (supposed) array into an actual array:

    $fedex_tmp2 = array_shift((array)$fedex_tmp1); // get first element of array, the value of which is an object

    [24-Nov-2014 23:57:57 America/New_York] PHP Fatal error:  Only variables can be passed by reference in /home/clarkword/public_html/csrocketry.com/store/modules/shipping/FedEx/shipping.class.php on line 187

    [24-Nov-2014 23:58:01 America/New_York] PHP Fatal error:  Only variables can be passed by reference in /home/clarkword/public_html/csrocketry.com/store/modules/shipping/FedEx/shipping.class.php on line 187

  16. Is the file as discussed in post#10 still present? And yet, there is no 'error_log' file in CubeCart's main folder?

    Fixed that, some how the file was renamed .php.php. Here is the log.

     

    [24-Nov-2014 23:34:59 America/New_York] PHP Notice:  Error: Hook 'Featured_Products/hooks/admin.navigation.php' was not found in /home/clarkword/public_html/csrocketry.com/store/classes/hookloader.class.php on line 163

    [24-Nov-2014 23:35:01 America/New_York] PHP Fatal error:  Cannot use object of type stdClass as array in /home/clarkword/public_html/csrocketry.com/store/modules/shipping/FedEx/shipping.class.php on line 186

    [24-Nov-2014 23:35:08 America/New_York] PHP Notice:  Error: Hook 'Featured_Products/hooks/admin.navigation.php' was not found in /home/clarkword/public_html/csrocketry.com/store/classes/hookloader.class.php on line 163

    [24-Nov-2014 23:35:09 America/New_York] PHP Warning:  Invalid argument supplied for foreach() in /home/clarkword/public_html/csrocketry.com/store/modules/plugins/GWorks_Featured_Item/hooks/class.gui.display_random_product.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 200

    [24-Nov-2014 23:35:09 America/New_York] PHP Warning:  implode() [<a href='http://docs.php.net/manual/en/function.implode.php'>function.implode.php</a>]: Invalid arguments passed in /home/clarkword/public_html/csrocketry.com/store/modules/plugins/GWorks_Featured_Item/hooks/class.gui.display_random_product.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 203

    [24-Nov-2014 23:35:09 America/New_York] PHP Warning:  Invalid argument supplied for foreach() in /home/clarkword/public_html/csrocketry.com/store/modules/plugins/GWorks_Featured_Item/hooks/class.gui.display_random_product.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 208

    [24-Nov-2014 23:35:09 America/New_York] PHP Warning:  implode() [<a href='http://docs.php.net/manual/en/function.implode.php'>function.implode.php</a>]: Invalid arguments passed in /home/clarkword/public_html/csrocketry.com/store/modules/plugins/GWorks_Featured_Item/hooks/class.gui.display_random_product.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 211

    [24-Nov-2014 23:35:09 America/New_York] PHP Warning:  array_rand() expects parameter 1 to be array, boolean given in /home/clarkword/public_html/csrocketry.com/store/modules/plugins/GWorks_Featured_Item/hooks/class.gui.display_random_product.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 230

    [24-Nov-2014 23:35:09 America/New_York] PHP Notice:  Error: Hook 'Featured_Products/hooks/class.gui.display.php' was not found in /home/clarkword/public_html/csrocketry.com/store/classes/hookloader.class.php on line 163

    [24-Nov-2014 23:35:09 America/New_York] PHP Warning:  Invalid argument supplied for foreach() in /home/clarkword/public_html/csrocketry.com/store/modules/plugins/GWorks_Featured_Item/hooks/class.gui.display_random_product.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 200

    [24-Nov-2014 23:35:09 America/New_York] PHP Warning:  implode() [<a href='http://docs.php.net/manual/en/function.implode.php'>function.implode.php</a>]: Invalid arguments passed in /home/clarkword/public_html/csrocketry.com/store/modules/plugins/GWorks_Featured_Item/hooks/class.gui.display_random_product.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 203

    [24-Nov-2014 23:35:09 America/New_York] PHP Warning:  Invalid argument supplied for foreach() in /home/clarkword/public_html/csrocketry.com/store/modules/plugins/GWorks_Featured_Item/hooks/class.gui.display_random_product.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 208

    [24-Nov-2014 23:35:09 America/New_York] PHP Warning:  implode() [<a href='http://docs.php.net/manual/en/function.implode.php'>function.implode.php</a>]: Invalid arguments passed in /home/clarkword/public_html/csrocketry.com/store/modules/plugins/GWorks_Featured_Item/hooks/class.gui.display_random_product.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 211

    [24-Nov-2014 23:35:09 America/New_York] PHP Warning:  array_rand() expects parameter 1 to be array, boolean given in /home/clarkword/public_html/csrocketry.com/store/modules/plugins/GWorks_Featured_Item/hooks/class.gui.display_random_product.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code on line 230

    [24-Nov-2014 23:35:09 America/New_York] PHP Notice:  Error: Hook 'Featured_Products/hooks/class.gui.display.php' was not found in /home/clarkword/public_html/csrocketry.com/store/classes/hookloader.class.php on line 163

     

×
×
  • Create New...