Jump to content

Dirty Butter

Member
  • Posts

    6,627
  • Joined

  • Last visited

  • Days Won

    139

Everything posted by Dirty Butter

  1. 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>
  2. 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
  3. Oh my, sure was hoping it was something I did wrong. Any other suggestions?
  4. 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 {
  5. 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; }
  6. 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!
  7. 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?
  8. 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.
  9. 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.)
  10. 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.
  11. 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....
  12. Thanks! I'm not sure how long it will be before Google will fix it. Will wait and see.
  13. 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?
  14. 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}">
  15. You will need to take mobility issues into account if you get your links too close to each other.
  16. 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.
  17. Good - this person is very upset with me LOL - I refunded payment, and they, in broken English and Korean signature, complained.
  18. 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?
  19. It's SemperFi's AskAbout a Product plugin that makes it possible to let people Make an Offer if you choose that to be available. BUT that's all it does. It just provides a good way to identify exactly what they are asking about. Nothing automatic about the offer acceptance, counter offer, or rejection at all. And there seems to be a support issue on SemperFi's plugins which may not have been resolved - hope I'm wrong about that.
  20. Since I may be the only one using the keywords this way, I will make an effort to follow your directions: "It isn't a big job to create a new database column equivalent to the keywords field, add that to the admin product source and change the custom search code to use the new field instead of the meta keywords. " We'll see how it works out.
  21. I use the keywords for custom search terms. It might be easy for Havenswift to "easily reworked", but certainly not for me. If this is done, I would have to pay @havenswift-hosting to copy my meta data to a new database record and create the CC code to utilize it. Surely I'm not the only one who uses the keywords as a place to store alternative search terms. Will the customer search for bunny or rabbit? Will they type DanDee or Dan Dee? What if they use Carter's or Carter or Carters. All brand name variations and typical misspellings should lead to the correct search results. I never used the merged global SEO choice, but I really depend on the keywords for search.
  22. There's a first name= last name fix on here from a long time ago. I think SemperFi provided it. But I couldn't find it. It simply prevents those logins from being recorded with no indication to the "bot" that it did not work. Found it!
  23. This worked BEAUTIFULLY!!! I've tested your code on 6.2.1+ dirtybutterestates and my 6.2.1+ plush test sites, AND even my live 6.1.15 plushcatalog store. It works perfectly on all of them using php 7.2.7, Havenswift's latest php version available. THANK YOU SO MUCH BSMITHER!!!
  24. Enjoy! You deserve an enjoyable evening.
  25. What makes your code so different from stock is the part about narrowing choices down no matter what order the terms are searched for. Your code on dirtybutter/plushcatalog makes a search for dog puppet blue give the exact same results as puppet blue dog or for blue dog puppet.
×
×
  • Create New...