Jump to content

lexijade

Member
  • Posts

    41
  • Joined

  • Last visited

Posts posted by lexijade

  1. SELECT I.* FROM `CubeCart_inventory` AS I JOIN `CubeCart_category` AS C ON C.cat_id=I.cat_id AND C.`status`=1 AND I.status = '1' ORDER BY I.date_added DESC, I.product_id DESC LIMIT 4

    That's the line I get on the debug, so clearly that's part of the issue since it's missing the latest part.

    I noticed a new problem, which may also be a factor. When I check the "include in latest products" box it doesn't save that when I update the product. I can make other changes at the same time and it'll save those, but it will revert back to unchecked for the latest product box.

    and this is Line 95-104 in cubecart.class.php

     

            $products = array();

            $where = $GLOBALS['catalogue']->outOfStockWhere(array('I.status' => '1', 'I.latest' => '1'), 'I');

            if ($GLOBALS['config']->get('config', 'catalogue_latest_products')) {
                $query = sprintf("SELECT I.* FROM `%1\$sCubeCart_inventory` AS I JOIN `%1\$sCubeCart_category` AS C ON C.cat_id=I.cat_id AND C.`status`=1 AND $where ORDER BY I.date_added DESC, I.product_id DESC", $GLOBALS['config']->get('config', 'dbprefix'));
                $latestProducts = $GLOBALS['db']->query($query, (int)$GLOBALS['config']->get('config', 'catalogue_latest_products_count'));
                foreach ($GLOBALS['hooks']->load('class.cubecart.latest_products') as $hook) {
                    include $hook;
                }

     

  2. On 1/11/2023 at 11:13 PM, bsmither said:

    In CubeCart's Store Settings, Advanced tab, enable Debug mode and enter your local IP address in the next field (www.showmyip.com). Save.

    View the storefront.

    Below the page of content, there will be a debug section showing all the database queries made. Find the query that looks like the following (line split apart for clarity):

    SELECT
      I.* 
      FROM `CubeCart_inventory` AS I 
      JOIN `CubeCart_category` AS C 
      ON C.cat_id=I.cat_id 
    
    AND C.`status`=1 
    AND I.status = '1' 
    AND I.latest = '1' 
    AND ((I.stock_level > 0 AND I.use_stock_level = 1) OR I.use_stock_level = 0)
    
    ORDER BY I.date_added DESC,
    I.product_id DESC
    LIMIT 100

    where the LIMIT is set in Store Settings, Layout tab, "Number of 'Latest Products' to display" setting.

    This query is constructed in the file /classes/cubecart.class.php, near line 100.

    So, the query does use the value in the CubeCart_inventory, 'latest' column.

    The result of the query is cached, so be sure that after changes made in admin, that CubeCart's cache is cleared.

    A hard edit to the query, from I.data_added to I.updated will order the result by the date the product was last Saved in admin.

    I don't understand what I'm looking for in the debug and once I find that, how it helps me fix it.

    My limit is set to 4. That part is working correctly.

  3. All of my products show up whether or not the "Include in latest products" box is checked. Checking the box does nothing. My guess is I messed up the coding for that at some point, but have no idea how or where to look to fix it. But it would be really nice to be able to actually pick what shows up in that list and not just the 4 most recent products created.

    In a related question, is there a way to have it show products that were recently updated vs just created. For example if I update a product and have it selected as "Include in latest products", can I make that item show up in latest even if it wasn't just created?

  4. 16 hours ago, havenswift-hosting said:

    It is almost impossible to say what is causing your issue based on the information we have to date.  It could be lack of Server resources, it could be that the files haven’t been correctly updated (a manual upgrade instead of the built in admin function is the only reliable way to upgrade)or it could be any number of other causes.

    If you previously tried to follow the Admin upgrade, then I suggest that you try a manual upgrade from scratch

    Ian

    How do I do a manual upgrade without losing all of the changes/customization that I've done?

  5. Here's the code from line 110 to line 155  

     

         ## If version is less then 4 or 5 try to fix database encoding
            if (!$_SESSION['setup']['db_converted'] && version_compare($current, '5.0.0', '<')) {
                /* ########################
                ##    Following code based on;
                ##    Migrating MySQL Data to Unicode
                ##   http://daveyshafik.com/archives/166-migrating-mysql-data-to-unicode.html
                ##    Thanks to Davey Shafik
                ## ######################## */
                $tables = $db->getRows();
                foreach ($tables as $table) {
                    ## Get Schema
                    if ($schema = $db->misc('SHOW CREATE TABLE '.$table['Name'])) {
                        ## Fix Schema and Create Temp Table
                        $find   = array("latin1", $table['Name']);
                        $replace  = array("utf8", $table['Name'].'_utf8');

                        if($db->misc(str_replace($find, $replace, $schema[0]['Create Table']))) {
                            if ($db->misc("SHOW TABLES LIKE '".$table['Name']."_utf8'", false)) {
                                ## Copy Data
                                $db->misc('INSERT INTO '.$table['Name'].'_utf8 SELECT * FROM '.$table['Name']);
                                ## Deleting Original Table
                                $db->misc('DROP TABLE '.$table['Name']);
                                ## Renaming Temporary Table
                                $db->misc('ALTER TABLE '.$table['Name'].'_utf8 RENAME TO '.$table['Name']);
                            }
                        }
                    }
                }
                $_SESSION['setup']['db_converted'] = true;
            }

            ## Updates from version 3
            if (!$_SESSION['setup']['config_converted'] && version_compare($current, '4.0.0', '<')) {

                ## Version 3: Upgrade config data
                $config_string = $db->select('CubeCart_config', array('array'), array('name' => 'config'));
                if ($config_string) {
                    $old_config = unserialize($config_string[0]['array']);
                    foreach ($old_config as $key => $value) {
                        $new_config[base64_decode($key)] = stripslashes(base64_decode($value));
                    }
                    $db->update('CubeCart_config', array('array' => base64_encode(json_encode($new_config))), array('name' => 'config'));

                }
                $_SESSION['setup']['short_lang_identifier'] = $new_config['defaultLang'];
                unset($old_config, $new_config, $config_string);

  6. "1. Basket 2. Get Quote 3. Payment 4. Complete" is what it says now at the top when you are in the checkout process. I edited the skin (or something) so that step 3 is 'Complete' and nothing says payment. I know cubecart will still let the order go through, I just don't want to confuse people. I just can't for the life of me remember how I did it.

  7. I changed the checkout progress list to remove the 'payment' step since we are doing quotes and not taking payments. But now I updated versions and it reverted back and I have no idea how I did it. I can't find it anywhere. Help please!

  8. I am using V6 with an old skin apparently lol. Thanks for the code. I put that in instead of what I had before and it works perfect! This has been driving me insane, but now it's fixed. Thank you so much for all of your help!!

  9. With this as my code nothing shows up on the page- it's totally broken, but there aren't any errors in the debug.

     

    $noKeys = count($searchArray);
                            $regexp = '';
            
        $rlike = ' AND ( ';
                            for ($i=0; $i<$noKeys; ++$i) {
                                $ucSearchTerm = strtoupper($searchArray[$i]);
                                if ( ($ucSearchTerm != 'AND') && ($ucSearchTerm != 'OR') && (strlen($ucSearchTerm) > 0) ) {
                                    $searchArray[$i] = str_replace(array('%','_'), array('%','_'), $searchArray[$i]);
                                    $regexp = '%'.$searchArray[$i].'%';
                                } else { $rlike .= " ".$ucSearchTerm." "; continue; }
                                $rlike .= "(I.name LIKE '".$regexp."' OR I.seo_meta_keywords LIKE '".$regexp."' OR I.product_code LIKE '".$regexp."') AND ";
                            }
                            $rlike = substr($rlike, 0, strlen($rlike)-5); $rlike .= " )";

                        }

    $q2 = "SELECT I.* FROM ".$GLOBALS['config']->get('config', 'dbprefix')."CubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price

×
×
  • Create New...