Jump to content

Dirty Butter

Member
  • Content Count

    6,500
  • Joined

  • Last visited

  • Days Won

    137

Dirty Butter last won the day on June 13 2018

Dirty Butter had the most liked content!

Community Reputation

722 Excellent

Profile Information

  • Gender
    Female
  • Location
    USA

Recent Profile Visitors

50,584 profile views
  1. Use this testing tool to see what CC has already coded and what else Google complains about. It's not going to help you much in the way of figuring out HOW to add the info they want, but it is helpful to use. https://search.google.com/structured-data/testing-tool
  2. Bsmither is by far the best person for any CC advice, so for me to offer something different than he suggests is just something to be aware of. I have ALL my microdata structure in the skin files element.product.call_to_action.php and content.product.php. Here's my reasoning: It's very hard to get Google happy with all the structured data. (I still get warned about optional microdata I don't use.) So if you decide to create it from within the raw html from within admin for each product, you may well find yourself having to fix any complaints Google has with your code one product at a time. By putting the code in the actual skin files - once Google is happy with one product, all the others should be ok as well. My files are too far from stock to be of much help to you, but just as an example of what I have in content.product.php: <div itemscope itemtype="http://schema.org/Product"> <form action="{$VAL_SELF}" method="post" class="add_to_basket"> <div class="row"> <div class="small-12 columns"> <span class="redbold">All Our Lovies are USED</span> <h1 itemprop="name">{$PRODUCT.name}</h1> <link itemprop="url" content="{$VAL_SELF}"> </div> </div>
  3. Add the microdata into your product content and call to action files. A good place to start is Google's Structured Data Markup tool - not perfect, but it will get you started. https://www.google.com/webmasters/markup-helper
  4. Oh my, sure was hoping it was something I did wrong. Any other suggestions?
  5. 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 {
  6. 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; }
  7. 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!
  8. 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?
  9. 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.
  10. 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.)
  11. 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.
  12. 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....
  13. Thanks! I'm not sure how long it will be before Google will fix it. Will wait and see.
  14. 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?
×
×
  • Create New...