Loading...

CS-Cart Quick Search

The quick search feature in CS-Cart shopping cart is set to exact phrase, by default, however it is possible to set up quick search by "All of These Words" if needed.

In order to do this follow the instructions below:

Step 1
  • Go to the core directory of your CS-Cart installation;
  • Open the fn.catalog.php file;
  • Add the following part of code into this file:
  • if (empty($params['match'])) {
        $params['match'] = 'all';
    }
    
    above this one:
    // Search string condition for SQL query
  • Save the file.

*Notice that in order to set the quick search to search by 'any of these words' you should replace all with any in the added code.

Step 2

  • Go to the Administration tab;
  • Open the Setting link;
  • In case the Pages and Site news check boxes are selected:
  • Go to the core directory of your CS-Cart installation;
  • Open the fn.search.php file;
  • Replace the following part of code:
  • if (empty($params['match'])) {
        $params['match'] = 'any';
    }
    with this one:
    if (empty($params['match'])) {
        $params['match'] = 'all';
    }

*Notice that:

  • in case you want to set the quick search to search by all of these words this part of code is required to be replaced;
  • in case you want to set the quick search to search by any of these words, leave it as is.

 

Comments

*****

"Thank you for the blog!Probably following code will help soenome to show products randomly from a particular category:We need to write code for home cms like:{{block type= catalog/product_list category_id= 50 template= catalog/product/list_home.phtml }}Code: ?php$_productCollection=$this- getLoadedProductCollection();$categoryID = $this- category_id;//$categoryID = $this- getCategoryId();if($categoryID){ $category = new Mage_Catalog_Model_Category(); $category- load($categoryID); // this is category id $collection = $category- getProductCollection();} else{ $collection = Mage::getResourceModel('catalog/product_collection');}Mage::getModel('catalog/layer')- prepareProductCollection($collection);$collection- getSelect()- order('rand()');$collection- addStoreFilter();$numProducts = $this- getNumProducts() ? $this- getNumProducts() : 1;$collection- setPage(1, $numProducts)- load();$_productCollection = $this- _productCollection = $collection;? ?php if(!$_productCollection- count()): ? div class= note-msg ?php echo $this- __('There are no products matching the selection. Please provide a category ID.') ? /div ?php else: ? ul ?php $_collectionSize = $_productCollection- count() ? ?php foreach ($_productCollection as $_product): ? li a href= ?php echo $_product- getProductUrl() ? title= ?php echo $this- htmlEscape($_product- getName()) ? img src= ?php echo $this- helper('catalog/image')- init($_product, 'small_image')- resize(105, 105); ? width= 105 height= 105 alt= ?php echo $this- htmlEscape($_product- getName()) ? / /a /li ?php endforeach ? /ul ?php endif; ? This code displays a single product."

New post

Type the characters you see in the picture below.

Up