Jump to content

Dirty Butter

Member
  • Content Count

    6,520
  • Joined

  • Last visited

  • Days Won

    137

Everything posted by Dirty Butter

  1. Did I do what you wanted? It's finding totally irrelevant titles now. And I made sure to clear all caches. This is on my test site, not live store. ORIGINAL Code above ends here - REST OF BSMITHER SEARCH BELOW */ $noKeys = count($searchArray); $regexp = $regexp_desc = array(); $columnsToSearch = array('I.name','I.product_code','I.search_keywords',); // columns where contents are plain words $columnsToSearch_desc = array('I.description',); // columns where contents can be rich text $search_mode = in_array($search_mode, array('rlike','like')) ? $search_mode : 'rlike'; // ORIGINAL B4 BSMITHER EDIT BELOW TO REMOVE PIECES OF WORDS if($search_mode == 'rlike') { if($search_mode == 'rlike' || $search_mode == 'like') { $like_keyword = "RLIKE"; $like_prefix = '[[:<:]]'; $like_postfix = '[[:>:]]'; } else { $like_keyword = "LIKE"; $like_prefix = '%'; $like_postfix = '%'; } foreach($columnsToSearch as $col) { for ($i=0; $i<$noKeys; ++$i) { $ucSearchTerm = strtoupper($searchArray[$i]); if (($ucSearchTerm != 'AND') && ($ucSearchTerm != 'OR')) { $regexp[$col][] = $col." ".$like_keyword." '".$like_prefix.$searchArray[$i].$like_postfix."'"; } } $regexp[$col] = '('.implode(' AND ', $regexp[$col]).')'; } foreach($columnsToSearch_desc as $col) { for ($i=0; $i<$noKeys; ++$i) { $ucSearchTerm = strtoupper($searchArray[$i]); if (($ucSearchTerm != 'AND') && ($ucSearchTerm != 'OR')) { $regexp_desc[$col][] = $col." ".$like_keyword." '".$like_prefix.htmlentities(html_entity_decode($searchArray[$i],ENT_COMPAT,'UTF-8'),ENT_QUOTES,'UTF-8',false).$like_postfix."'"; } } $regexp_desc[$col] = '('.implode(' AND ', $regexp_desc[$col]).')'; } $like = ' AND ('.implode(' OR ', $regexp).' OR '.implode(' OR ', $regexp_desc).')'; } //END OF NEW BSMITHER SEARCH CODE $q2 = "SELECT I.* FROM ".$GLOBALS['config']->get('config', 'dbprefix')."CubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price, MAX(sale_price) as sale_price FROM ".$GLOBALS['config']->get('config', 'dbprefix')."CubeCart_pricing_group $group_id GROUP BY product_id) as G ON G.product_id = I.product_id $joinString WHERE I.product_id IN (SELECT product_id FROM `".$GLOBALS['config']->get('config', 'dbprefix')."CubeCart_category_index` as CI INNER JOIN ".$GLOBALS['config']->get('config', 'dbprefix')."CubeCart_category as C where CI.cat_id = C.cat_id AND C.status = 1) AND I.status = 1 ".$whereString.$like; $query = $q2.' '.$order_string.' '.$limit; $search = $GLOBALS['db']->query($query); if (count($search)>0) { $count = $GLOBALS['db']->query($q2); $this->_category_count = (int)count($count); $this->_category_products = $search; if (count($this->_category_products)==1 && ctype_digit($this->_category_products[0]['product_id']) && $_SERVER['HTTP_X_REQUESTED_WITH']!=='XMLHttpRequest') { $GLOBALS['gui']->setNotify(sprintf($GLOBALS['language']->catalogue['notify_product_search_one'], $_REQUEST['search']['keywords'])); httpredir('?_a=product&product_id='.$this->_category_products[0]['product_id']); } return true; // STOCK LINE B4 BSMITHER CHANGE BELOW TO ELIMINATE PIECES OF WORDS FROM BEING FOUND } elseif ($search_mode=="rlike") { } elseif (false && $search_mode=="rlike") { return $this->searchCatalogue($original_search_data, 1, $per_page, 'like'); } } } } else {
  2. Coming back for more help with my VERY custom Search. Most recent changes involved using my own search_keywords, but something has changed in the last upgrade or so. Now I'm getting results for PIECES of words - something I do not want. Finding plurals is kind of nice, but I have already added plurals in my own search_keywords database - so I don't need that. Problem: Searching for UGA finds titles with Sugar Loaf, Sugarplum, and Sugarbunnies in them. I would have preferred it come back as not found. Here's my catalog.class.php search portion: /** * Search product catalog * * @param string $search_data * @param int $page * @param int $per_page * @param string $search_mode * @return bool */ // ORIGINAL B4 BSMITHER SEARCH CHANGE TO LIKE INSTEAD OF FULLTEXT public function searchCatalogue($search_data = null, $page = 1, $per_page = 10, $search_mode = 'fulltext') { public function searchCatalogue($search_data = null, $page = 1, $per_page = 10, $search_mode = 'rlike') { $per_page = (!is_numeric($per_page) || $per_page < 1) ? 10 : $per_page; $original_search_data = $search_data; /* Allow plugins to add to conditions and joins or change the search_data Where conditions may be added to the $where variable and must be self contained (e.g. no AND prefix or suffix) since they will be ANDed together below $where[] = "I.price > 100"; Joins may be added to the $joins variable - keep in mind the need for unique table aliases as appropriate $joins[] = "`plugin_myPlugin` as P ON P.`product_id`=I.`product_id` AND P.`my_field`='some_value'"; The only guaranteed table alias is I for CubeCart_inventory G for CubeCart_pricing_group CI for CubeCart_category_index C for CubeCart_category */ $where = array(); $joins = array(); foreach ($GLOBALS['hooks']->load('class.catalogue.pre_search') as $hook) { include $hook; } $sale_mode = $GLOBALS['config']->get('config', 'catalogue_sale_mode'); if ($sale_mode == 2) { $sale_percentage = $GLOBALS['config']->get('config', 'catalogue_sale_percentage'); } $user = (array)$GLOBALS['user']->get(); $group_id = 'WHERE group_id = 0'; if (($memberships = $GLOBALS['user']->getMemberships()) !== false) { $group_id = 'WHERE '; foreach ($memberships as $membership) { $group_id .= 'group_id = '.$membership['group_id'].' OR '; } $group_id = substr($group_id, 0, -4); } if (strtolower($page) != 'all') { $page = (is_numeric($page)) ? $page : 1; $limit = sprintf('LIMIT %d OFFSET %d', (int)$per_page, $per_page*($page-1)); } else { $limit = 'LIMIT 100'; } // Presence of a join is similar to presence of a search keyword if (!empty($joins) || is_array($search_data)) { if (!empty($search_data['priceVary'])) { // Allow for a 5% variance in prices if (!empty($search_data['priceMin']) && is_numeric($search_data['priceMin'])) { $price = round($GLOBALS['tax']->priceConvertFX($search_data['priceMin'])/1.05, 3); if ($sale_mode == 1) { $where[] = 'IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price) >= '.$price.', IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price) >= '.$price.')'; } elseif ($sale_mode == 2) { $where[] = 'IF (G.price IS NULL, (I.price - ((I.price / 100) * '.$sale_percentage.')) >= '.$price.', (G.price - ((G.price / 100) * '.$sale_percentage.')) >= '.$price.')'; } else { $where[] = 'IF (G.price IS NULL, I.price >= '.$price.', G.price >= '.$price.')'; } } if (!empty($search_data['priceMax']) && is_numeric($search_data['priceMax'])) { $price = round($GLOBALS['tax']->priceConvertFX($search_data['priceMax'])*1.05, 3); if ($sale_mode == 1) { $where[] = 'IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price) <= '.$price.', IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price) <= '.$price.')'; } elseif ($sale_mode == 2) { $where[] = 'IF (G.price IS NULL, (I.price - ((I.price / 100) * '.$sale_percentage.')) <= '.$price.', (G.price - ((G.price / 100) * '.$sale_percentage.')) <= '.$price.')'; } else { $where[] = 'IF (G.price IS NULL, I.price <= '.$price.', G.price <= '.$price.')'; } } } else { ## Basic price searching if (!empty($search_data['priceMin']) && is_numeric($search_data['priceMin']) && !empty($search_data['priceMax']) && is_numeric($search_data['priceMax']) && $search_data['priceMax'] == $search_data['priceMin']) { $price = round($GLOBALS['tax']->priceConvertFX($search_data['priceMin']), 3); if ($sale_mode == 1) { $where[] = 'IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price) = '.$price.', IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price) = '.$price.')'; } elseif ($sale_mode == 2) { $where[] = 'IF (G.price IS NULL, (I.price - ((I.price / 100) * '.$sale_percentage.')) = '.$price.', (G.price - ((G.price / 100) * '.$sale_percentage.')) = '.$price.')'; } else { $where[] = 'IF (G.price IS NULL, I.price = '.$price.', G.price = '.$price.')'; } } else { if (!empty($search_data['priceMin']) && is_numeric($search_data['priceMin'])) { $price = round($GLOBALS['tax']->priceConvertFX($search_data['priceMin']), 3); if ($sale_mode == 1) { $where[] = 'IF (G.product_id IS NULL, IF (I.sale_price = 0, I.price, I.sale_price) >= '.$price.', IF (G.sale_price = 0, G.price, G.sale_price) >= '.$price.')'; } elseif ($sale_mode == 2) { $where[] = 'IF (G.price IS NULL, (I.price - ((I.price / 100) * '.$sale_percentage.')) >= '.$price.', (G.price - ((G.price / 100) * '.$sale_percentage.')) >= '.$price.')'; } else { $where[] = 'IF (G.price IS NULL, I.price >= '.$price.', G.price >= '.$price.')'; } } if (!empty($search_data['priceMax']) && is_numeric($search_data['priceMax'])) { $price = round($GLOBALS['tax']->priceConvertFX($search_data['priceMax']), 3); if ($sale_mode == 1) { $where[] = 'IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price) <= '.$price.', IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price) <= '.$price.')'; } elseif ($sale_mode == 2) { $where[] = 'IF (G.price IS NULL, (I.price - ((I.price / 100) * '.$sale_percentage.')) <= '.$price.', (G.price - ((G.price / 100) * '.$sale_percentage.')) <= '.$price.')'; } else { $where[] = 'IF (G.price IS NULL, I.price <= '.$price.', G.price <= '.$price.')'; } } } } // Manufacturer if (isset($search_data['manufacturer']) && is_array($search_data['manufacturer']) && count($search_data['manufacturer'])>0) { $where[] = 'I.manufacturer IN ('.implode(',', $this->get_int_array($search_data['manufacturer'])).')'; // $where[] = 'I.manufacturer IN ('.implode(',', '\''.$search_data['manufacturer']).'\')'; } $order = array(); if (isset($_GET['sort']) && is_array($_GET['sort'])) { foreach ($_GET['sort'] as $field => $direction) { if (strtolower($field) == 'relevance' && $search_mode !== 'fulltext') { break; } $order['field'] = $field; if ($field == 'price') { if ($sale_mode == 1) { $order['field'] = 'IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price), IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price))'; } else { $order['field'] = 'IFNULL (G.price, I.price)'; } } $order['sort'] = (strtolower($direction) == 'asc') ? 'ASC' : 'DESC'; break; } } elseif ($search_mode == 'fulltext') { $order['field'] = 'Relevance'; $order['sort'] = 'DESC'; } // Use store settings for sort order if none designated if (empty($order)) { $order['field'] = $GLOBALS['config']->get('config', 'product_sort_column'); $order['sort'] = $GLOBALS['config']->get('config', 'product_sort_direction'); if (empty($order['field']) || empty($order['sort'])) { unset($order); // store settings were somehow invalid } } if (empty($search_data['keywords']) && $order['field'] == 'Relevance') { if ($sale_mode == 1) { $order['field'] = 'IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price), IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price))'; } else { $order['field'] = 'IFNULL (G.price, I.price)'; } } if (is_array($order)) { $field_format = preg_match('/\s/', $order['field']) ? $order['field'] : '`'.$order['field'].'`'; $order_string = 'ORDER BY '.$field_format.' '.$order['sort']; } if (isset($search_data['featured'])) { $where[] = "AND I.featured = '1'"; } // Only look for items that are in stock if (isset($search_data['inStock'])) { $where[] = $this->outOfStockWhere(); } $whereString = (isset($where) && is_array($where)) ? implode(' ', $where) : ''; $whereString .= $this->_where_live_from; $joinString = (isset($joins) && is_array($joins)) ? implode(' JOIN ', $joins) : ''; if (!empty($joinString)) { $joinString = ' JOIN '.$joinString; } $indexes = $GLOBALS['db']->getFulltextIndex('CubeCart_inventory', 'I'); if (!empty($joins) || isset($search_data['keywords']) && is_array($indexes) && !empty($search_data['keywords'])) { if ($search_mode == 'fulltext') { $max_word_len = $GLOBALS['db']->getSearchWordLen(); $words = explode(' ', $search_data['keywords']); if (is_array($words)) { $search_str_len = 0; foreach ($words as $word) { $search_str_len = ($search_str_len < strlen($word)) ? strlen($word) : $search_str_len; } } else { $search_str_len = strlen($search_data['keywords']); } } if ($search_mode == 'fulltext') { if ($search_str_len < $max_word_len) { return $this->searchCatalogue($original_search_data, $page, $per_page, 'rlike'); } switch (true) { case (preg_match('#[\+\-\>\<][\w]+#iu', $search_data['keywords'])): ## Switch to bolean mode $mode = 'IN BOOLEAN MODE'; break; default: $search_data['keywords'] = str_replace(' ', '*) +(*', $search_data['keywords']); $search_data['keywords'] .= '*)'; $search_data['keywords'] = '+(*'.$search_data['keywords']; $mode = 'IN BOOLEAN MODE'; break; } $words = preg_replace('/[^\p{Greek}a-zA-Z0-9\s]+/u', '', $search_data['keywords']); $words = $GLOBALS['db']->sqlSafe($words); // Score matching string $match = sprintf("MATCH (%s) AGAINST('%s' %s)", implode(',', $indexes), $words, $mode); $match_val = '0.5'; $query = sprintf("SELECT I.*, %2\$s AS Relevance FROM %1\$sCubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price, MAX(sale_price) as sale_price FROM %1\$sCubeCart_pricing_group $group_id GROUP BY product_id) as G ON G.product_id = I.product_id $joinString WHERE I.product_id IN (SELECT product_id FROM `%1\$sCubeCart_category_index` as CI INNER JOIN %1\$sCubeCart_category as C where CI.cat_id = C.cat_id AND C.status = 1) AND I.status = 1 AND (%2\$s) >= %4\$s %3\$s %5\$s %6\$s", $GLOBALS['config']->get('config', 'dbprefix'), $match, $whereString, $match_val, $order_string, $limit); if ($search = $GLOBALS['db']->query($query)) { $q2 = sprintf("SELECT COUNT(I.product_id) as count, %2\$s AS Relevance FROM %1\$sCubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price, MAX(sale_price) as sale_price FROM %1\$sCubeCart_pricing_group $group_id GROUP BY product_id) as G ON G.product_id = I.product_id $joinString WHERE I.product_id IN (SELECT product_id FROM `%1\$sCubeCart_category_index` as CI INNER JOIN %1\$sCubeCart_category as C where CI.cat_id = C.cat_id AND C.status = 1) AND I.status = 1 AND (%2\$s) >= %4\$s %3\$s GROUP BY I.product_id %5\$s", $GLOBALS['config']->get('config', 'dbprefix'), $match, $whereString, $match_val, $order_string); $count = $GLOBALS['db']->query($q2); $this->_category_count = (int)count($count); $this->_category_products = $search; $this->_sort_by_relevance = true; if (count($this->_category_products)==1 && ctype_digit($this->_category_products[0]['product_id']) && $_SERVER['HTTP_X_REQUESTED_WITH']!=='XMLHttpRequest') { $GLOBALS['gui']->setNotify(sprintf($GLOBALS['language']->catalogue['notify_product_search_one'], $_REQUEST['search']['keywords'])); httpredir('?_a=product&product_id='.$this->_category_products[0]['product_id']); } return true; } elseif ($search_mode == 'fulltext') { return $this->searchCatalogue($original_search_data, 1, $per_page, 'rlike'); } } else { $search_mode = in_array($search_mode, array('rlike','like')) ? $search_mode : 'rlike'; $this->_sort_by_relevance = false; $like = ''; if (!empty($search_data['keywords'])) { $searchwords = preg_split('/[\s,]+/', $GLOBALS['db']->sqlSafe($search_data['keywords'])); $searchArray = array(); foreach ($searchwords as $word) { if (empty($word) && !is_numeric($word)) { continue; } $searchArray[] = $word; } /* ORIGINAL Code follows BSMITHER EDITS TO COME $noKeys = count($searchArray); $regexp = $regexp_desc = ''; $search_mode = in_array($search_mode, array('rlike','like')) ? $search_mode : 'rlike'; if ($search_mode == 'rlike') { $like_keyword = "RLIKE"; $like_prefix = '[[:<:]]'; $like_postfix = '[[:>:]].*'; } else { $like_keyword = "LIKE"; $like_prefix = '%'; $like_postfix = '%'; } for ($i=0; $i<$noKeys; ++$i) { $ucSearchTerm = strtoupper($searchArray[$i]); if (($ucSearchTerm != 'AND') && ($ucSearchTerm != 'OR')) { $regexp .= $like_prefix.$searchArray[$i].$like_postfix; $regexp_desc .= $like_prefix.htmlentities(html_entity_decode($searchArray[$i], ENT_COMPAT, 'UTF-8'), ENT_QUOTES, 'UTF-8', false).$like_postfix; } } if ($search_mode == 'rlike') { $regexp = substr($regexp, 0, strlen($regexp)-2); $regexp_desc = substr($regexp_desc, 0, strlen($regexp_desc)-2); } $like = " AND (I.name ".$like_keyword." '".$regexp."' OR I.description ".$like_keyword." '".$regexp_desc."' OR I.product_code ".$like_keyword." '".$regexp."')"; } ORIGINAL Code above ends here - REST OF BSMITHER SEARCH BELOW */ $noKeys = count($searchArray); $regexp = $regexp_desc = array(); $columnsToSearch = array('I.name','I.product_code','I.search_keywords',); // columns where contents are plain words $columnsToSearch_desc = array('I.description',); // columns where contents can be rich text $search_mode = in_array($search_mode, array('rlike','like')) ? $search_mode : 'rlike'; if($search_mode == 'rlike') { $like_keyword = "RLIKE"; $like_prefix = '[[:<:]]'; $like_postfix = '[[:>:]]'; } else { $like_keyword = "LIKE"; $like_prefix = '%'; $like_postfix = '%'; } foreach($columnsToSearch as $col) { for ($i=0; $i<$noKeys; ++$i) { $ucSearchTerm = strtoupper($searchArray[$i]); if (($ucSearchTerm != 'AND') && ($ucSearchTerm != 'OR')) { $regexp[$col][] = $col." ".$like_keyword." '".$like_prefix.$searchArray[$i].$like_postfix."'"; } } $regexp[$col] = '('.implode(' AND ', $regexp[$col]).')'; } foreach($columnsToSearch_desc as $col) { for ($i=0; $i<$noKeys; ++$i) { $ucSearchTerm = strtoupper($searchArray[$i]); if (($ucSearchTerm != 'AND') && ($ucSearchTerm != 'OR')) { $regexp_desc[$col][] = $col." ".$like_keyword." '".$like_prefix.htmlentities(html_entity_decode($searchArray[$i],ENT_COMPAT,'UTF-8'),ENT_QUOTES,'UTF-8',false).$like_postfix."'"; } } $regexp_desc[$col] = '('.implode(' AND ', $regexp_desc[$col]).')'; } $like = ' AND ('.implode(' OR ', $regexp).' OR '.implode(' OR ', $regexp_desc).')'; } //END OF NEW BSMITHER SEARCH CODE $q2 = "SELECT I.* FROM ".$GLOBALS['config']->get('config', 'dbprefix')."CubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price, MAX(sale_price) as sale_price FROM ".$GLOBALS['config']->get('config', 'dbprefix')."CubeCart_pricing_group $group_id GROUP BY product_id) as G ON G.product_id = I.product_id $joinString WHERE I.product_id IN (SELECT product_id FROM `".$GLOBALS['config']->get('config', 'dbprefix')."CubeCart_category_index` as CI INNER JOIN ".$GLOBALS['config']->get('config', 'dbprefix')."CubeCart_category as C where CI.cat_id = C.cat_id AND C.status = 1) AND I.status = 1 ".$whereString.$like; $query = $q2.' '.$order_string.' '.$limit; $search = $GLOBALS['db']->query($query); if (count($search)>0) { $count = $GLOBALS['db']->query($q2); $this->_category_count = (int)count($count); $this->_category_products = $search; if (count($this->_category_products)==1 && ctype_digit($this->_category_products[0]['product_id']) && $_SERVER['HTTP_X_REQUESTED_WITH']!=='XMLHttpRequest') { $GLOBALS['gui']->setNotify(sprintf($GLOBALS['language']->catalogue['notify_product_search_one'], $_REQUEST['search']['keywords'])); httpredir('?_a=product&product_id='.$this->_category_products[0]['product_id']); } return true; } elseif ($search_mode=="rlike") { return $this->searchCatalogue($original_search_data, 1, $per_page, 'like'); } } } } else { if (is_numeric($search_data)) { if (($category = $this->getCategoryData((int)$search_data)) !== false) { if (($products = $this->getCategoryProducts((int)$search_data, $page, $per_page)) !== false) { $this->_category_products = $products; return true; } } } elseif (strtolower($search_data) == 'sale') { if (isset($_GET['sort']) && is_array($_GET['sort'])) { foreach ($_GET['sort'] as $field => $direction) { $order[$field] = (strtolower($direction) == 'asc') ? 'ASC' : 'DESC'; break; } } else { $order['price'] = 'DESC'; } if (is_array($order)) { if (key($order) == "price") { if ($GLOBALS['config']->get('config', 'catalogue_sale_mode') == '1') { $order_string = 'ORDER BY (I.price-I.sale_price) '.current($order); } elseif ($GLOBALS['config']->get('config', 'catalogue_sale_mode') == '2' && $GLOBALS['config']->get('config', 'catalogue_sale_percentage'>0)) { $order_string = 'ORDER BY (I.price - (I.price / 100) * '.$GLOBALS['config']->get('config', 'catalogue_sale_percentage').') '.current($order); } $_GET['sort']['price'] = current($order); } else { $_GET['sort'][key($order)] = current($order); $order_string = 'ORDER BY `'.key($order).'` '.current($order); } } $where2 = $this->outOfStockWhere(false, 'I', true); $whereString = 'IF (G.sale_price IS NULL, I.sale_price, G.sale_price) > 0'.$where2; if ($GLOBALS['config']->get('config', 'catalogue_sale_mode') == '1') { $query = sprintf("SELECT I.* FROM %1\$sCubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price, MAX(sale_price) as sale_price FROM %1\$sCubeCart_pricing_group $group_id GROUP BY product_id) as G ON G.product_id = I.product_id WHERE I.product_id IN (SELECT product_id FROM `%1\$sCubeCart_category_index` as CI INNER JOIN %1\$sCubeCart_category as C where CI.cat_id = C.cat_id AND C.status = 1) AND I.status = 1 AND %2\$s %3\$s %4\$s", $GLOBALS['config']->get('config', 'dbprefix'), $whereString, $order_string, $limit); } elseif ($GLOBALS['config']->get('config', 'catalogue_sale_mode') == '2') { $decimal_percent = $GLOBALS['config']->get('config', 'catalogue_sale_percentage')/100; $query = sprintf("SELECT I.* FROM %1\$sCubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price, price*%4\$s as sale_price FROM %1\$sCubeCart_pricing_group $group_id GROUP BY product_id) as G ON G.product_id = I.product_id WHERE I.product_id IN (SELECT product_id FROM `%1\$sCubeCart_category_index` as CI INNER JOIN %1\$sCubeCart_category as C where CI.cat_id = C.cat_id AND C.status = 1) AND I.status = 1 %2\$s %3\$s", $GLOBALS['config']->get('config', 'dbprefix'), $order_string, $limit, $decimal_percent); } else { return false; } foreach ($GLOBALS['hooks']->load('class.cubecart.search_catalogue') as $hook) { include $hook; } if (($sale = $GLOBALS['db']->query($query)) !== false) { $q2 = sprintf("SELECT SQL_CALC_FOUND_ROWS I.* FROM %1\$sCubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price, MAX(sale_price) as sale_price FROM %1\$sCubeCart_pricing_group $group_id GROUP BY product_id) as G ON G.product_id = I.product_id WHERE I.product_id IN (SELECT product_id FROM `%1\$sCubeCart_category_index` as CI INNER JOIN %1\$sCubeCart_category as C where CI.cat_id = C.cat_id AND C.status = 1) AND I.status = 1 AND %2\$s %3\$s", $GLOBALS['config']->get('config', 'dbprefix'), $whereString, $order_string); $count = $GLOBALS['db']->query($q2); $this->_category_count = (int)count($count); $this->_category_products = $sale; foreach ($GLOBALS['hooks']->load('class.catalogue.search_catalogue.sale_items.post') as $hook) { include $hook; } return true; } } } return false; } /** * Set category id/name * * @param string $id * @param string $name */ public function setCategory($id, $name) { $this->_categoryData[$id] = $name; }
  3. No - not even when logged in as admin. It's not a crucial thing. It just makes it look like I've added listings in the middle of the night (elf is busy) AH - will work OK - today's listings show time, BUT all but last of yesterday's listings only show the date. THANK YOU!
  4. I've just realized that my -6 UTC and Chicago/America only give the desired time on the storefront IF I am logged in as Admin. If I log out and refresh with FireFox or Chrome, the offset is ignored on the storefront. I'm using your code on the Latest Products on the Homepage: Added {formatTime(strtotime($product.updated))} Is there a way to keep the date and not show the time?
  5. There's a lot of private data displayed in your config info above, like recaptcha keys and email address. Since the offline switch is not the issue at all - you really should delete all the stuff shown in the two comments full of your config data. Sorry that didn't help.
  6. I ran into that behavior once some time ago. I ended up going into the config of the database, decoding the base64, flipping the offline switch from 0 to 1, and then encoding back into base64 and replacing the config. Drastic, but it worked. (I did have enough sense to make a copy of the table before such a fool hardy approach.)
  7. I read through that whole discussion and understood very little of it. So I take it this is not a bug, but just my lack of understanding. I have it showing what I want now. -6 UTC and America/Chicago gives me accurate time/date in Admin for when a product is updated. And it gives me accurate time/date on the Timestamp edit you made for my storefront homepage to show when a product was listed and another piece of code that shows our total product listings per today's date. Thanks as always. I appreciate your efforts to teach.
  8. I normally use the Timezone setting to Ameria/Chicago in the Store Settings Advanced tab. But I noticed the time was wrong on our website (our server is in Europe). So I set the UTC Offset to -6 and now the store time is right. Is this a bug in CC 6.2.6 that the America/Chicago setting was not sufficient to show the correct store time? Or just a misunderstanding on my part that the UTC Offset also needed to be set....
  9. Thanks! I'm not sure how long it will be before Google will fix it. Will wait and see.
  10. I was testing a post on Goggle my Business and discovered our store description on Google defaults not to my description, but to the wording of the cookie disclaimer! How can I fix this?
  11. I have this in my element.meta.php file. (I use the large image in my skin code.) <meta property="og:image:width" content="800" /> <link rel="image_src" href="{$PRODUCT.large}"/> <meta property="og:image:url" content="{$PRODUCT.large}"/> <meta property="og:url" content="{$VAL_SELF}"/> <meta property="og:type" content="product"/> <meta property="og:title" content="{$PRODUCT.name}"/> <meta property="fb:admins" content="xxxxxx"/> <meta property="og:site_name" content="{$CONFIG.store_name}"/> <meta property="og:description" content="{if isset($META_DESCRIPTION)}{$META_DESCRIPTION}{/if}">
  12. You will need to take mobility issues into account if you get your links too close to each other.
  13. It's in the Common group. When I can't find which group to look in, I open the definitions.xml file and search for the term. If you scroll up from where it is, you can see which group it is in. Then you can fix it via Language.
  14. Good - this person is very upset with me LOL - I refunded payment, and they, in broken English and Korean signature, complained.
  15. Based on the whole layout of the information, I assumed a recent unpaid order was not legitimate and cancelled it. I then disabled the customer, but did not delete it. Today, the same person ordered and paid with PayPal for what appears to be a legitimate order. I was surprised - I thought un-checking the Status entry on the Customers list would keep the customer from being able to login. They did change the delivery address for the order to a USA address. But the default delivery address is still to a country we do not do business with. We have refused orders from re-shippers before trying to send toys to Korea. South Korean businesses have a reputation for buying a toy, copying it, and selling in online stores as the genuine article. Our post master advised against sending toys to them. Should the unchecked customer have been able to login again or is this a bug?
  16. I added it to element.js_head.php and it works.
  17. Google made extensive changes around then.
  18. Take a look at my use of Ask about a Product here: https://dirtybutter.com/plushcatalog/dandee-collectors-choice-white-lamb-pink-jesus-loves-me.html
  19. I stand corrected - changes in Github look more like 6.2.3. Wonder why I just now have an issue??? I remembered a discussion of adding some kind of clarifying text to make it clear which sales tax was being used - thought it was in this one. My stock install does not have 2 Alabamas. One test site does have 2 Alabama entries with different id's in the tables, and the other has only one Alabama, as expected. I can't imagine how this could have happened.
  20. I know there were changes to code involving Sales Tax in this upgrade. We very rarely have sales that require Sales Tax, but we had one since upgrading. Sales Tax was not charged. Can someone verify that your 6.2.6 is correctly figuring and using appropriate Sales Tax? I've just noticed I have TWO Alabama zones in the Countries & Zones table in my Admin. I have no idea how that happened.
  21. Each refresh of the Admin Error Log creates this entry again - on stock test store as well as my own edited stores. [<strong>Notice</strong>] XXX/sources/settings.errorlog.inc.php:69 - Undefined variable: smarty_data This may have been happening for some time, but I'm more conscious of error logs when testing an upgrade.
  22. I renamed seo_meta_keywords in the inventory table to search_keywords, because the latest commit does not have meta keywords any more. Then I had to make appropriate changes in various code so search_keywords would be the source for search results. It is working as it should. But all the testing it took to get it working revealed these errors in my keyword consistency that I would like to rectify. Some ARE coded with &#39; and most are not. Some have upper case Carters, etc., and others have lower case carters, etc. These were added gradually over the course of about 10 years, so it's no wonder there's a lack of total consistency. So all apostrophe search_keyword entries should be &#39; ??? Does case matter?
  23. Yes you can. Be sure you change both the html and the plain text version. If you have translations in use they may need to be edited as well.
  24. I am trying to find instances where certain keywords are missing in my custom table of Search terms for each product. For instance, I normally add Carter's,Carters,Carter to the keywords of any item of that brand. And I include puppy,puppies,dog,dogs in any search "index" of that animal. While doing some testing I realize I have accidentally failed to include the apostrophe version of Carter's on some items. And not all my dogs can be found with a search for puppy. I need a query of the database that would help me find the items that have XXX in the search terms, but do NOT currently have YYY. It would be great if that query would also provide an automatic way to add the missing YYY to the current list of keywords, with the appropriate comma.
×
×
  • Create New...