Community Forum

Please read the intro before joining/posting. Thank you.

If you have questions about our software, chances are this forum has the answers.

You'll need to register before you can post on the forum to ask your question or to answer another one. A reply will be posted to each and every question that is asked so there is no need to double post or bump your post. We'll do our best to answer promptly, but in some cases it may take a day or two. If you bump your post, it may be removed. Bear with us and we'll get your question answered quickly.

Here are a few tips to help you to get your questions answered more rapidly.

IMPORTANT: Posts in English only. We don't employ translators and we'll be unable to understand your message properly and will probably delete it.
SOFTWARE: Each software has it's own forum. Software here is NOT supported. Posts about this software will be deleted. Supported software questions ONLY please.
SEARCH: Use the search option to see if your question has been answered on the forum before now or if there is an answer in the documentation of your software.
PERSONAL SUPPORT: If you have purchased a commercial version of any software, using the contact option at the licence centre ensures a faster response.
AUTO DELETION: Accounts older than 5 days, with no posts or topics, are automatically deleted. Only register if you are thinking of posting.
LINKS: Any links posted are not clickable (to deter spammers) and must be copied / pasted into your browser address bar.

            

You are not logged in.

Search Results
DAustin @ 20-12-2013 21:51:40

Is it possible to wrap the cart in lockbox?

Go to topic
Go to post
DAustin @ 17-12-2013 19:45:38

Have you tried assigning it to a new category, then disabling that category?  In theory that would stop the category from being displayed anywhere while the products should still be searchable by that brand.

Go to topic
Go to post
DAustin @ 17-12-2013 14:53:32

Edits for fulltext searching in MaianCart 2.1 (Relevancy Filtering)

Are your searches on your store not producing accurate enough results?  Got a lot of similar products?  Then you probably need FULLTEXT SEARCHING.

The following edits are for advanced users only.  You will be editing several php files and MySQL tables, as such, you are advised to make a full back-up of the following files & tables:

Files:
/control/system/search.php
/control/system/advanced-search.php
/control/classes/products.php
/content/language/english/search.php
/control/defined.inc.php
/control/connect.inc.php

MySQL Tables:
mc_products
mc_search_index (Optional - For Testing and Error Checking)

Any references to line numbers are based on the unedited files and will change slightly as you edit along with this tutorial, please be observant!

Notice:

Neither myself (Dan Austin) or David Ian Bennett can guarantee the following changes will not damage your system.  A misplaced character can have extremely adverse affects so you are hereby informed that neither myself, David Ian Bennett or MaianScriptWorld can be held responsible for loss of data, monies, or personal information, or be held responsible for any events occurring as a result of implementing these changes.  It is highly recommended that you test these edits on a developmental version of your site!

Set-Up:
The very first thing we should do when editing our system is to turn on error reporting.  If you hit an error in your code when testing the error reporting feature of MaianCart will help you isolate the problem (Don't forget to change this back when you are done!):

In /control/connect.inc.php:

Line 111:

define('ENABLE_MYSQL_ERRORS', 0);


change to:
define('ENABLE_MYSQL_ERRORS', 1);

In order for us to be able to use the fulltext search capabilities of MySQL we need to alter our mc_products table to create a fulltext index.  This is the index that MySQL will use to perform searches on.  What you choose to be indexed is down to your personal preferences and, due to its complex nature, it is advised you think carefully about which fields you use.  In our set-up we have decided on only matching Product Names and their full descriptions.  Choosing too many fields for your index can have negative effects on the search, as there are more fields to match against and can in fact produce less relevant results.

Using your MySQL editor of choice run the following query on the `mc_products` table (It is advised to run this after you have loaded in all your products for speed):

ALTER TABLE `mc_products` ADD FULLTEXT (pName, pDescription);

Throughout this tutorial I am using pName and pDescription, but any columns from the `mc_products` table can be used.

Now MySQL knows what to match search terms against, we need to set-up MaianCart to pass the search term to MySQL.

First we need to change the way MaianCart search creates keywords in order to be passed through to MySQL.  Open up the /control/system/search.php file and change the following (lines 52-88):

Line 60:

$splitWords  = explode(' ',$_GET['keys']);


Change to;
$splitWords  = explode(',',$_GET['keys']);

This function normally splits individual words in a search string into separate ones, which are then searched individually.  It does this by finding any white spaces and using those to split the string.  We no longer require this functionality so change the separator to one of your choice.  We are using a comma (,) instead.

Now we need to create our new MySQl query to perform the searching.  In order to get a score for each result's accuracy for ordering our results we need to strip the majority of the query out of /control/system/search.php and move it to /control/classes/products.php.

In /control/system/search.php edit the following (on Line 84):

$searchSQL .= mc_defineNewline().($i ? 'OR ' : 'AND (').' LOWER(`pName`) LIKE \'%'.$sw.'%\' OR LOWER(`pCode`) LIKE \'%'.$sw.'%\' OR LOWER(`pDescription`) LIKE \'%'.$sw.'%\' OR LOWER(`pTags`) LIKE \'%'.$sw.'%\' ';
      }
    }
    $searchSQL = $searchSQL.')';
  }
   
Change to;
$searchSQL .= "'.$sw.'";
      }
}
    $searchSQL = $searchSQL.'';
  }

This removes all the MySQL queries from the function, and is necessary for implementing the scoring system.  '$searchSQL' is now only parsing the search words.  We'll reintroduce our MySQL queries in /control/classes/products.php.  Leave /control/system/search.php open for now, as we'll have some more edits to do later.

Open up your /control/classes/products.php file.  It is very important you do not change anything but the following lines as this file controls your store's products and is used in far more functions than just the search.  Find the function buildSearchProducts on line 1802 and make the following changes:

Line 1803;

global $limit,$public_category11,$public_category10,$public_category12,$public_search3,$public_category9,$page,
         $public_category13,$public_category14,$public_category17,$public_category18,$public_category15,$public_category18,
         $public_product9,$public_category28,$public_product42;
         
Change to;
global $limit,$public_category11,$public_category10,$public_category12,$public_search3,$public_category9,$page,
         $public_category13,$public_category14,$public_category17,$public_category18,$public_category15,$public_category18,
         $public_product9,$public_category28,$public_product42,$advsearch;

         
This is adding a new global variable for the advanced search form, which we'll come back to later.

Next we're going to create our search query, this is by far the most important part to get right as all searches depend on this function working properly.

On Line 1811:

    $query = mysql_query("SELECT SQL_CALC_FOUND_ROWS *,DATE_FORMAT(`pDateAdded`,'".$this->settings->mysqlDateFormat."') AS `a_date`,
           `".DB_PREFIX."products`.`id` AS `pid`
           FROM `".DB_PREFIX."products`
           LEFT JOIN `".DB_PREFIX."prod_category`
           ON `".DB_PREFIX."products`.`id` = `".DB_PREFIX."prod_category`.`product`
           WHERE `pEnable`                 = 'yes'
           ".($this->settings->showOutofStock=='no' ? 'AND `pStock` > 0' : '')."
           $search
           GROUP BY `".DB_PREFIX."products`.`id`
           ORDER BY `".DB_PREFIX."products`.`id`
           ") or die(mc_MySQLError(mysql_errno(),mysql_error(),__LINE__,__FILE__));

           
Change to:
$query = mysql_query("SELECT SQL_CALC_FOUND_ROWS *, DATE_FORMAT(`pDateAdded`,'".$this->settings->mysqlDateFormat."') AS `a_date`,
           `".DB_PREFIX."products`.`id` AS `pid`,
           MATCH(`pName`, `pDescription`) AGAINST (".$search.") AS `score`
           FROM `".DB_PREFIX."products`
           LEFT JOIN `".DB_PREFIX."prod_category`
           ON `".DB_PREFIX."products`.`id` = `".DB_PREFIX."prod_category`.`product`
           WHERE `pEnable`                 = 'yes'
           ".($this->settings->showOutofStock=='no' ? 'AND `pStock` > 0' : '')."
           AND MATCH(`pName`, `pDescription`) AGAINST (".$search.")
           $advsearch

           GROUP BY `".DB_PREFIX."products`.`id`
           HAVING `score` > '0'
           ORDER BY `score` DESC

           ") or die(mc_MySQLError(mysql_errno(),mysql_error(),__LINE__,__FILE__));

What did we just do?  We added a variant of the following query to MaianCart's search query (REFERENCE ONLY):

SELECT *,
    MATCH(`pName`, `pDescription`) AGAINST (".$search.") AS `score`
    FROM mc_products
    WHERE
    MATCH(`pName`, `pDescription`) AGAINST (".$search.")

The above query takes our search term ('$search') and matches it against our Product Names and Descriptions.  Each product will generate a score depending on how close a match it is to the search term.  Products where all or part of the search term is matched in BOTH the Product Name AND Description will get higher scores than those that only have matches in the Name OR Description, which in turn get higher scores than those with no matches at all.  As such, more fields to match against is actually less likely to produce accurate scoring, so I advise a maximum of 2.

'$advsearch' is there to place any advanced search parameters at the right place in the query.  Under the current setup, MaianCart will add these additional queries to the search string and break our query.  Go back to /control/system/search.php and make the following changes (lines 90-137):

// Advanced search options..
  $filterArr = array();
  if (!isset($_GET['sKey'])) {
    if (isset($_GET['adv'])) {
      if (isset($_GET['from'],$_GET['to']) && mc_checkValidDate($_GET['from'])!='0000-00-00' && mc_checkValidDate($_GET['to'])!='0000-00-00') {
        $searchSQL .= mc_defineNewline().'AND `pDateAdded` BETWEEN \''.mc_convertCalToSQLFormat($_GET['from']).'\' AND \''.mc_convertCalToSQLFormat($_GET['to']).'\'';
      }
      if (isset($_GET['cat']) && (int)$_GET['cat']>0) {
        $searchSQL           .= mc_defineNewline().'AND `category` = \''.(int)$_GET['cat'].'\'';
        $_SESSION['thisCat']  = (int)$_GET['cat'];
        $filterArr['cat']     = (int)$_GET['cat'];
      }
      if (isset($_GET['brand']) && (int)$_GET['brand']>0) {
        $searchSQL          .= mc_defineNewline().'AND FIND_IN_SET(\''.(int)$_GET['brand'].'\',`pBrands`)';
        $filterArr['brand']  = (int)$_GET['brand'];
      } else {
        if ($SETTINGS->showBrands=='yes' && isset($_GET['brand']) && strpos($_GET['brand'],',')!==false) {
          $searchSQL          .= mc_defineNewline().'AND FIND_IN_SET(\''.$_GET['brand'].'\',`pBrands`)';
          $filterArr['brand']  = $_GET['brand'];
        }
      }
      if ($_GET['price1']>0 || $_GET['price2']>0) {
        // Tidy up prices..
        $_GET['price1']  = number_format(str_replace(array(','),array(''),$_GET['price1']),2,'.','');
        $_GET['price2']  = number_format(str_replace(array(','),array(''),$_GET['price2']),2,'.','');
        // Multiply fields by 100 to remove decimal places..
        $searchSQL      .= mc_defineNewline().'AND IF(`pOffer`>0,`pOffer`,`pPrice`)*100 >= \''.($_GET['price1']*100).'\' AND IF(`pOffer`>0,`pOffer`,`pPrice`)*100 <= \''.($_GET['price2']*100).'\'';
        // If keys are empty, have price points as the search term..
        if (trim($_GET['keys'])=='') {
          $_SESSION['store_SearchResultsPricePoints'] = $_GET['price1'].' - '.$_GET['price2'];
          // We can also skip the download filter..
          define('SKIP_DOWNLOADS_IN_SEARCH', 1);
        }
      }
      if (isset($_GET['download']) && !defined('SKIP_DOWNLOADS_IN_SEARCH')) {
        $searchSQL .= mc_defineNewline().'AND `pDownload` = \''.(in_array($_GET['download'],array('yes','no')) ? $_GET['download'] : 'no').'\'';
      }
      if (isset($_GET['stock'])) {
        $searchSQL .= mc_defineNewline().'AND IF (`pDownload`=\'yes\',`pStock` >= \'0\',`pStock` >= \''.($SETTINGS->searchLowStockLimit>0 ? $SETTINGS->searchLowStockLimit : '1').'\')';
      }
      if (isset($_GET['specials'])) {
        $searchSQL .= mc_defineNewline().'AND `pOffer` > \'0\'';
      }
      if (isset($_GET['sortby']) && in_array($_GET['sortby'],array_keys($orderByItems))) {
        $filterArr['sortby'] = $_GET['sortby'];
      }
    }
  }

Change to;
// Advanced search options..
  $advsearch = '';
  $filterArr = array();
  if (!isset($_GET['sKey'])) {
    if (isset($_GET['adv'])) {
      if (isset($_GET['from'],$_GET['to']) && mc_checkValidDate($_GET['from'])!='0000-00-00' && mc_checkValidDate($_GET['to'])!='0000-00-00') {
        $advsearch .= mc_defineNewline().'AND `pDateAdded` BETWEEN \''.mc_convertCalToSQLFormat($_GET['from']).'\' AND \''.mc_convertCalToSQLFormat($_GET['to']).'\'';
      }
      if (isset($_GET['cat']) && (int)$_GET['cat']>0) {
        $advsearch           .= mc_defineNewline().'AND `category` = \''.(int)$_GET['cat'].'\'';
        $_SESSION['thisCat']  = (int)$_GET['cat'];
        $filterArr['cat']     = (int)$_GET['cat'];
      }
      if (isset($_GET['brand']) && (int)$_GET['brand']>0) {
        $advsearch          .= mc_defineNewline().'AND FIND_IN_SET(\''.(int)$_GET['brand'].'\',`pBrands`)';
        $filterArr['brand']  = (int)$_GET['brand'];
      } else {
        if ($SETTINGS->showBrands=='yes' && isset($_GET['brand']) && strpos($_GET['brand'],',')!==false) {
          $advsearch          .= mc_defineNewline().'AND FIND_IN_SET(\''.$_GET['brand'].'\',`pBrands`)';
          $filterArr['brand']  = $_GET['brand'];
        }
      }
      if ($_GET['price1']>0 || $_GET['price2']>0) {
        // Tidy up prices..
        $_GET['price1']  = number_format(str_replace(array(','),array(''),$_GET['price1']),2,'.','');
        $_GET['price2']  = number_format(str_replace(array(','),array(''),$_GET['price2']),2,'.','');
        // Multiply fields by 100 to remove decimal places..
        $advsearch      .= mc_defineNewline().'AND IF(`pOffer`>0,`pOffer`,`pPrice`)*100 >= \''.($_GET['price1']*100).'\' AND IF(`pOffer`>0,`pOffer`,`pPrice`)*100 <= \''.($_GET['price2']*100).'\'';
        // If keys are empty, have price points as the search term..
        if (trim($_GET['keys'])=='') {
          $_SESSION['store_SearchResultsPricePoints'] = $_GET['price1'].' - '.$_GET['price2'];
          // We can also skip the download filter..
          define('SKIP_DOWNLOADS_IN_SEARCH', 1);
        }
      }
      if (isset($_GET['download']) && !defined('SKIP_DOWNLOADS_IN_SEARCH')) {
        $advsearch .= mc_defineNewline().'AND `pDownload` = \''.(in_array($_GET['download'],array('yes','no')) ? $_GET['download'] : 'no').'\'';
      }
      if (isset($_GET['stock'])) {
        $advsearch .= mc_defineNewline().'AND IF (`pDownload`=\'yes\',`pStock` >= \'0\',`pStock` >= \''.($SETTINGS->searchLowStockLimit>0 ? $SETTINGS->searchLowStockLimit : '1').'\')';
      }
      if (isset($_GET['specials'])) {
        $advsearch .= mc_defineNewline().'AND `pOffer` > \'0\'';
      }
      if (isset($_GET['sortby']) && in_array($_GET['sortby'],array_keys($orderByItems))) {
        $filterArr['sortby'] = $_GET['sortby'];
      }
    }
  }

This places the advanced search parameters in the right place without breaking the query.

Great!  But we're still not there yet.  Because MaianCart logs searches, we've got some more work to do.

What MaianCart does when it logs searches is take the results from our search and save them to a table (mc_search_index).  This allows MaianCart to cache searches and reduce load on the server (Identical searches don't get searched twice, and saves processing power), as well as logging the search term.  What does this mean?  Well MaianCart actually passes this cached search to another function to be displayed on the site.  As such, our scores, which are vital to the whole search functionality, get lost!  I was stuck on this for a very long time before the solution became apparent.

Open up /control/classes/products.php again and navigate find lines 1651-1682:

// Ordering and filtering..
  $cat      = '';
  $orderBy  = 'ORDER BY '.SEARCH_ORDER_BY;
  switch ($_GET['filter']) {
    case 'price-low':
    $orderBy  = 'ORDER BY REPLACE(IF(`'.DB_PREFIX.'products`.`pOffer`>0,`'.DB_PREFIX.'products`.`pOffer`,`'.DB_PREFIX.'products`.`pPrice`),\',\',\'\')*100';
    break;
    case 'price-high':
    $orderBy  = 'ORDER BY REPLACE(IF(`'.DB_PREFIX.'products`.`pOffer`>0,`'.DB_PREFIX.'products`.`pOffer`,`'.DB_PREFIX.'products`.`pPrice`),\',\',\'\')*100 DESC';
    break;
    case 'title-az':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pName`';
    break;
    case 'title-za':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pName` DESC';
    break;
    case 'date-new':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pDateAdded` DESC';
    break;
    case 'date-old':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pDateAdded`';
    break;
    case 'all-items':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pName`';
    $limit    = 0;
    break;
    case 'stock':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pStock`';
    break;
    case 'multi-buy':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pMultiBuy` DESC';
    break;
  }

Change to;
// Ordering and filtering..
  $cat      = '';
  $orderBy  = 'ORDER BY '.SEARCH_ORDER_BY;
  switch ($_GET['filter']) {
    case 'Relevancy':
    $orderBy  = 'ORDER BY FIND_IN_SET(`'.DB_PREFIX.'products`.`id`, "'.unserialize($searchProds->results).'")';
    break;

    case 'price-low':
    $orderBy  = 'ORDER BY REPLACE(IF(`'.DB_PREFIX.'products`.`pOffer`>0,`'.DB_PREFIX.'products`.`pOffer`,`'.DB_PREFIX.'products`.`pPrice`),\',\',\'\')*100';
    break;
    case 'price-high':
    $orderBy  = 'ORDER BY REPLACE(IF(`'.DB_PREFIX.'products`.`pOffer`>0,`'.DB_PREFIX.'products`.`pOffer`,`'.DB_PREFIX.'products`.`pPrice`),\',\',\'\')*100 DESC';
    break;
    case 'title-az':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pName`';
    break;
    case 'title-za':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pName` DESC';
    break;
    case 'date-new':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pDateAdded` DESC';
    break;
    case 'date-old':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pDateAdded`';
    break;
    case 'all-items':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pName`';
    $limit    = 0;
    break;
    case 'stock':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pStock`';
    break;
    case 'multi-buy':
    $orderBy  = 'ORDER BY `'.DB_PREFIX.'products`.`pMultiBuy` DESC';
    break;
  }

Now I'll explain what you just did.  You added this (REFERENCE ONLY):

case 'Relevancy':
$orderBy  = 'ORDER BY FIND_IN_SET(`'.DB_PREFIX.'products`.`id`, "'.unserialize($searchProds->results).'")';
break;

This line of code is unbelievably important.  Our cached results are sitting in our mc_search_index table in the correct order (I.E The most relevant product first) and we need to display them retaining this order.  When a user selects Relevancy as their filter for search results, MaianCart is going to order them as it reads them from the cache.  The default setup of MySQL ignores the order so we have to force it by using the FIND_IN_SET function.  Using the above lines of code we add this 'Order By' query on the end of our Search Query function.  Don't forget the break at the end or it won't work!

Testing:

If you want to make sure the search is ordering the results correctly make the following changes to /control/classes/products.php.  You should remove these edits when you are done as they will decrease performance.

Lines 1822-1849:

      // Log search..only log on page 1 of search page.
  if ($search && $this->settings->enSearchLog=='yes' && trim($_GET['keys'])!='' && $page==1) {
    $c = mysql_fetch_object(mysql_query("SELECT FOUND_ROWS() AS rows"));
  }
  while ($PR = mysql_fetch_object($query)) {
    $products[] = $PR->pid;
  }
  mc_logSearchResults($_GET['keys'],(isset($c->rows) ? $c->rows : '0'));
  if (!empty($products)) {
    $ids = serialize(implode(',',array_unique($products)));
    // Check to see if search already exists..
    // If it does, just return key..
    $oldSearch = mc_getTableData('search_index','`results`',$ids);
    if (isset($oldSearch->id)) {
      $key = $oldSearch->searchCode;
    } else {
      // Log key info..
      mysql_query("INSERT INTO `".DB_PREFIX."search_index` (
      `searchCode`,`results`,`searchDate`,`filters`
      ) VALUES (
      '{$key}','{$ids}','".date("Y-m-d")."','".(!empty($filters) ? serialize($filters) : '')."'
      )") or die(mc_MySQLError(mysql_errno(),mysql_error(),__LINE__,__FILE__));
    }
  }
  $url = ($this->settings->en_modr=='yes' ? SLUG_SEARCH.'/'.$key.'/0/'.(isset($filters['sortby']) ? $filters['sortby'] : SEARCH_FILTER).'/1/'.($this->settings->appendindex=='yes' ? 'index.html' : '') : 'index.php?sKey='.$key.'&cat=0&filter='.(isset($filters['sortby']) ? $filters['sortby'] : SEARCH_FILTER).'&next=1');
  header("Location: ".$url);
  exit;
}


Change to;
// Log search..only log on page 1 of search page.
  if ($search && $this->settings->enSearchLog=='yes' && trim($_GET['keys'])!='' && $page==1) {
    $c = mysql_fetch_object(mysql_query("SELECT FOUND_ROWS() AS rows"));
  }
  while ($PR = mysql_fetch_object($query)) {
    $products[] = $PR->pid;
    $scores[] = $PR->score;
  }
  mc_logSearchResults($_GET['keys'],(isset($c->rows) ? $c->rows : '0'));
  if (!empty($products)) {
    $ids = serialize(implode(',',array_unique($products)));
    $scores= serialize(implode(',',array_unique($scores)));
    // Check to see if search already exists..
    // If it does, just return key..
    $oldSearch = mc_getTableData('search_index','`results`',$ids);
    if (isset($oldSearch->id)) {
      $key = $oldSearch->searchCode;
    } else {
      // Log key info..
      mysql_query("INSERT INTO `".DB_PREFIX."search_index` (
      `searchCode`,`results`,`searchDate`,`filters`, `scores`
      ) VALUES (
      '{$key}','{$ids}','".date("Y-m-d")."','".(!empty($filters) ? serialize($filters) : '')."','{$scores}'
      )") or die(mc_MySQLError(mysql_errno(),mysql_error(),__LINE__,__FILE__));
    }
  }

Now with your MySQL editor of choice add a new TEXT column at the end of the mc_search_index table called scores.

Now when you run a search the scores field will be populated with the scores in the same order as the products listed in the results field.  They should run from highest to lowest.  If they do not then there is an error in your code!  Remember to remove these changes after you have confirmed the order of results is correct.

Final Changes:

While all of our searches are being given relevancy scores, it is useless if we cannot filter them by relevancy.  The following edits will set up the Relevancy filter for the end users.

Open /content/language/english/search.php:

<?php

/*+++++++++++++++++++++++++++++++++++++++++++++

  Script: Maian Cart
  Programmed & Designed by: David Ian Bennett
  E-Mail: support@maianscriptworld.co.uk
  Software Website: http://www.maiancart.com
  Script Portal: http://www.maianscriptworld.co.uk

  +++++++++++++++++++++++++++++++++++++++++++++
 
  This File: search.php
  Description: English Language File

  +++++++++++++++++++++++++++++++++++++++++++++*/


$public_search            = '{count} Search Result(s) - &quot;{keys}&quot;';
$public_search2           = 'Filter by Category';
$public_search3           = 'Your search found 0 results, please try another search..';
$public_search4           = 'Results Found: {count}';
$public_search5           = 'Enter keywords and/or filter options. At least 1 option must be completed';
$public_search6           = 'Keywords';
$public_search7           = 'Products Added Between ({format})';
$public_search8           = 'Search by Category';
$public_search9           = 'Downloads';
$public_search10          = 'Price Range ({currency})';
$public_search11          = 'Low Stock';
$public_search12          = 'Search Products';
$public_search13          = 'Specify Search Parameters';
$public_search14          = 'Order/Filter by';
$public_search15          = 'Save This Search';
$public_search16          = '{website} Site Search';
$public_search17          = 'Title: A - Z';
$public_search18          = 'Price: Low - High';
$public_search19          = 'Title: Z - A';
$public_search20          = 'Price: High - Low';
$public_search21          = 'Date: Newest';
$public_search22          = 'Date: Oldest';
$public_search23          = '{count} Search Result(s)';
$public_search24          = 'View All Results';

?>


Change to;
<?php

/*+++++++++++++++++++++++++++++++++++++++++++++

  Script: Maian Cart v2.0
  Programmed & Designed by: David Ian Bennett
  E-Mail: support@maianscriptworld.co.uk
  Software Website: http://www.maiancart.com
  Script Portal: http://www.maianscriptworld.co.uk

  +++++++++++++++++++++++++++++++++++++++++++++
 
  This File: search.php
  Description: English Language File

  +++++++++++++++++++++++++++++++++++++++++++++*/


$public_search            = '{count} Search Result(s) - &quot;{keys}&quot;';
$public_search2           = 'Filter by Category';
$public_search3           = 'Your search found 0 results, please try another search..';
$public_search4           = 'Results Found: {count}';
$public_search5           = 'Enter keywords and/or filter options. At least 1 option must be completed';
$public_search6           = 'Keywords';
$public_search7           = 'Products Added Between ({format})';
$public_search8           = 'Search by Category';
$public_search9           = 'Downloadable Products ONLY';
$public_search10          = 'Price Range';
$public_search11          = 'Low Stock Products ONLY ({count} or less)';
$public_search12          = 'Search Products';
$public_search13          = 'Specify Search Parameters';
$public_search14          = 'Order/Filter by';
$public_search15          = 'Save This Search';
$public_search16          = '{website} Site Search';
$public_search17          = 'Title: A - Z';
$public_search18          = 'Price: Low - High';
$public_search19          = 'Title: Z - A';
$public_search20          = 'Price: High - Low';
$public_search21          = 'Date: Newest';
$public_search22          = 'Date: Oldest';
$public_search23          = '{count} Search Result(s)';
$public_search24          = 'View All Results';
$public_search25          = 'Multi-Buy';
$public_search26          = 'Relevancy';

?>

Note: $public_search25 was missing in our search.php language file.  I have added it here under the belief it is a bug.

On Line 28 of /control/system/search.php:

$orderByItems = array(
  'price-low'  => $public_search18,
  'price-high' => $public_search20,
  'title-az'   => $public_search17,
  'title-za'   => $public_search19,
  'date-new'   => $public_search21,
  'date-old'   => $public_search22,
  'multi-buy'  => $public_search25
);

Change to;
$orderByItems = array(
  'Relevancy'  => $public_search26,
  'price-low'  => $public_search18,
  'price-high' => $public_search20,
  'title-az'   => $public_search17,
  'title-za'   => $public_search19,
  'date-new'   => $public_search21,
  'date-old'   => $public_search22,
  'multi-buy'  => $public_search25
);

And in /control/system/advanced-search.php on line 36:

$orderByItems = array(
  'price-low'  => $public_search18,
  'price-high' => $public_search20,
  'title-az'   => $public_search17,
  'title-za'   => $public_search19,
  'date-new'   => $public_search21,
  'date-old'   => $public_search22,
  'multi-buy'  => $public_search25
);

Change to:
$orderByItems = array(
  'Relevancy'  => $public_search26,
  'price-low'  => $public_search18,
  'price-high' => $public_search20,
  'title-az'   => $public_search17,
  'title-za'   => $public_search19,
  'date-new'   => $public_search21,
  'date-old'   => $public_search22,
  'multi-buy'  => $public_search25
);

These changes make the Relevancy filter an option in the drop down lists on the front-end of your site.

Finally, although Relevancy is an option for users to select, it currently requires them to actually select it.  If you want your results to be filtered by Relevancy by default, open up your /control/defined.inc.php and change:

Line 143:

define('SEARCH_FILTER', 'title-az');

Change to;
define('SEARCH_FILTER', 'Relevancy');

And that's it!  Go take your new search system for a test drive and see how it handles!  Don't forget to go back and take out the error reporting and mc_search_index changes!

- Dan Austin

Go to topic
Go to post
DAustin @ 17-10-2013 09:37:02

Thanks Dave, I may not understand it entirely, but taking things apart and rebuilding them is a great way to learn wink will give it a try later on this afternoon.  Been a while since I've done some proper PHP big_smile will post back any functions I create for others

Go to topic
Go to post
DAustin @ 15-10-2013 14:53:02

Nice, that saves me some work!  Also, might be an odd question but is there a way to turn off the parent category, but keep sibling (child/infant) categories displaying in the "Related Categories" section atop each category page?  The reason I ask is for some of our categories, the parent and one of the child/infant categories use the same image thumbnail.

Seeing as there's plenty of ways to navigate already (left column and breadcrumbs, the latter of which I have made as a sticky menu for GiftGnu) it would be helpful if I could just turn off the parent category thumbnail, but it seems the array includes all of them and I can't figure out what file I should be modifying (And by modify I of course mean, trial and error various things until it works!).

Not looking for an admin button, but which file I need to edit to remove the parent category function.

Cheers me dears,
Dan

(Edit: If possible of course!)

Go to topic
Go to post
DAustin @ 04-10-2013 13:56:47

Cheers Dave works a charm.  Changed the aforementioned code back to my original modified state and still works a charm big_smile

On a side note, does MC have anything for that cookie notification required by UK Businesses now?  Gonna get started on ours and I'll post the code back if you like.

Go to topic
Go to post
DAustin @ 04-10-2013 08:59:03

No worries, cheers for the fix, thought the images were taking a while to load up lol.  Will update it later on and let you know how I get on.  I'll email it in next time, I was just reluctant this time as there's been a few emails which turned out to be easy fixes and I hate wasting your time!

Go to topic
Go to post
DAustin @ 03-10-2013 15:17:31

Had a spot of trouble with remote images not showing up.  Thankfully the remote thumbnails were showing up and I managed to find a solution based on that information.

I'm not sure if this is an isolated case to myself, caused by my own idiocy, or a general one with MaianCart.  I'm sure I'll be told one way or the other!

After many, many hours fiddling with the database side I finally clocked onto this:

(Excerpt from "/content/_your_theme/product.tpl.php" ~Lines 29-35)

<div class="left">
            <p class="img">
            <ul class="dList">
            <li> 
             <img src="<?php echo $this->IMG; ?>"<?php echo ($this->ZOOM=='yes' ? ' data-zoom-image="'.$this->IMG_URL.'" ' : ' '); ?>id="displayImg" alt="<?php echo $this->NAME; ?>" title="<?php echo $this->NAME; ?>" />
             </li>
             </ul>

You may not have the <ul> and <li> elements as this is a customisation from this tutorial:
http://www.maianscriptworld.co.uk/forums/viewtopic.php?id=3216

Anyway, the error was that MaianCart was prefixing my image URL with the root directory, leaving me with a url like:
"http://www.giftgnu.com/shophttp://www.giftgnu.com/img/........."

So after nearly throwing my computer against a wall and emailing David (I actually have the email 90% typed out before I thought I'd give this one last shot lol) I decided to do something crazy like this:

(Same excerpt from above)

<div class="left">
            <p class="img">
            <ul class="dList">
            <li> 
             <img src="<?php echo $this->IMG_URL; ?>"<?php echo ($this->ZOOM=='yes' ? ' data-zoom-image="'.$this->IMG_URL.'" ' : ' '); ?>id="displayImg" alt="<?php echo $this->NAME; ?>" title="<?php echo $this->NAME; ?>" />
             </li>
             </ul>

And it seems to have solved the issue! big_smile  I must stress again that this could have been completely my own fault, I haven't checked the original code yet to find out.

But, if you're having a similar problem, try that.

Thanks,
Dan

Go to topic
Go to post
DAustin @ 13-09-2013 12:59:22

For those wishing to have centered images regardless of image width please read the following.  I'm actually a bit emabressed to post this, as it seems my Cloud-Zoom hacks were completely over the top for MaianCart 2.05, especially when the quick solution was staring me right in the face all along!  As such this one is much easier to implement and requires only 2 or 3 changes to the ElevateZoom javascript (which are all for bug fixes!).

Right let's start with centering the main image (this is the embarrassing bit I mentioned above):

Open up the following file in your text editor - product.tpl.php  (located in your theme folder)

From line 29-35 you'll see this:

<div class="left">
            <p class="img">     
             <img src="<?php echo $this->IMG; ?>"<?php echo ($this->ZOOM=='yes' ? ' data-zoom-image="'.$this->IMG_URL.'" ' : ' '); ?>id="displayImg" alt="<?php echo $this->NAME; ?>" title="<?php echo $this->NAME; ?>" />
             <?php
             // Only show click zoom if there is an image..
             if ($this->PICTURES_COUNT>0) {
             ?>

Add the following:

<div class="left">
            <p class="img">
            <ul class="dList">
            <li>
 
             <img src="<?php echo $this->IMG; ?>"<?php echo ($this->ZOOM=='yes' ? ' data-zoom-image="'.$this->IMG_URL.'" ' : ' '); ?>id="displayImg" alt="<?php echo $this->NAME; ?>" title="<?php echo $this->NAME; ?>" />
             </li>
             </ul>

             <?php
             // Only show click zoom if there is an image..
             if ($this->PICTURES_COUNT>0) {
             ?>

Then in your CSS add a declaration for your new list element ('dList' in the example above, required declarations are in bold and red):

.viewProduct .productInfo .left .dList {
position:relative;
z-index:30;
margin:0;
padding:0;
list-style-type:none;
text-align:center;

}

Also change the declaration to the img (this is because we have added the list and need to update our css to target it correctly):
from:

.viewProduct .productInfo .left .img img {

to:
.viewProduct .productInfo .left .dList img {

And that's it, no need for a JS hack like cloud-zoom, and I'm embaressed to admit that this may have also worked for cloud-zoom instead of performing all of those offset calculations lol.  What we've done is the gallery image list hack using 'text-align: center;' on an image held within a list that I shared in the Cloud-Zoom tutorial.

Centered Gallery Images:
This is EXACTLY the same as before:

Open up your product-pictures.htm file located in _your_theme/html/products:

Replace the contents with those shown below:

<div id="additionalPics">
      <ul style="list-style-type:none;margin:0;padding:0;text-align:center;">
      <li>
       {pictures}
       </li>
       </ul>
      </div>

That's the gallery taken care of, next the ElevateZoom bugs.

Bug Fixes:
I had an issue that took a while to solve involving z-indices (z-index values).  My zoom window was appearing underneath my product info which was obviously no good.  Even if you don't have this issue I advise you take a quick look at the following as there are a few bugs regardless in the script (Bad Syntax):

To fix the z-index issues if you have any, open up your jquery.elevatezoom.js located in the js/plugins folder of your theme folder.  Change line 219 to this to add a z-index (The red and bold bit):

self.zoomContainer = $('<div class="zoomContainer" style="z-index:9999;-webkit-transform: translateZ(0);position:absolute;left:'+self.nzOffset.left+'px;top:'+self.nzOffset.top+'px;height:'+self.nzHeight+'px;width:'+self.nzWidth+'px;"></div>');

This solved my issue but I did fiddle around with z-indices on a few divs, namely the .left and .right divs on the product page, but I don't think this has any effect.  Add a reply to correct me if simply performing the above fails to bring the zoom window forward.

One other bug is some bad syntax someone pointed out online as I was googling for a solution.

On line 126 delete the bit in red:

//if window zoom       
                if(self.options.zoomType == "window") {
                    self.zoomWindowStyle = "overflow: hidden;"
                        + "background-position: 0px 0px;text-align:center;" 
                        + "background-color: " + String(self.options.zoomWindowBgColour)           
                        + ";width: " + String(self.options.zoomWindowWidth) + "px;"
                        + "height: " + String(self.options.zoomWindowHeight)
                        + "px;float: left;"
                        + "background-size: "+ self.largeWidth/self.options.zoomLevel+ "px " +self.largeHeight/self.options.zoomLevel + "px;"
                        + "display: none;z-index:100"
                        + "px;border: " + String(self.options.borderSize)
                        + "px solid " + self.options.borderColour
                        + ";background-repeat: no-repeat;"
                        + "position: absolute;";

This is because z-index doesn't need a px value.  You can also add your own custom css here to spruce up the styling.  For instance I added a left margin to create some space between the thumbnail image and the zoom windo, as well as adding a box-shadow effect to thezoom window here also.

I think that's it for now.  Please let me know if this doesn't work for you, I'm fairly certain I've got all the info needed above, but I may have forgotten to add something crucial.

-Dan Austin

Go to topic
Go to post
DAustin @ 06-09-2013 13:57:15

No worries David, it helps me in the future because I can come back here to see what I did!  I can see why you've changed the file structure, as it stops duplicating images etc, for different themes.  Pretty nifty, plus looking forward to implementing category specific themes, if and when I get given the chance!

One minor issue with the guide I've just edited in step 7.  Now back to the joys of trying to get 3 tables to join correctly so I can quickly categorize 5,000 products into their 70 categories sad

Go to topic
Go to post
DAustin @ 04-09-2013 14:19:00

EDIT:

I've had several issues occur in recent weeks that are probably due to an error in upgrading in the following way, as such you are highly recommended to do a fresh install instead!   I'll leave this guide in place for people wanting to MOVE THEIR THEME ONLY!  YOU HAVE BEEN WARNED!


I'm posting this because I had some issues upgrading from 2.05 to 2.1.  I share my findings with other users to simplify the process for those not as tech savvy.

Warning:  This guide is not endorsed by MaianScriptWorld or David Ian Bennett, unless otherwise stated by himself.  I provide it as is, and myself (Dan Austin) or David Ian Bennett are not responsible for any errors resulting from following this guide.  BACKUP YOUR DATABASE AND STORE FOLDER AND YOU CAN ALWAYS GO BACK TO 2.05 IN CASE OF A FATAL ERROR.

The following is a step by step guide.  Please take note of step 3 & 4 in particular.

Step 1 - Create a backup of your store's database!  Do this either with the inbuilt function in the tools section of the maiancart admin section or via the export option in PHPMyAdmin.  Do a full backup if you use the latter.

Step 2 - Rename the store folder (i.e. /cart) to an alternate name (i.e. /cart.old).  We can revert back to our old cart by renaming this folder back to its original name if needs be.

Step 3 - Follow the instructions up to and including step 5 in the maiancart documentation, do not perform step 6!  Upload version 2.1 to your site in the correct folder (i.e /cart)

Step 4 - Run the following file: "http://www.yoursite.com/cart/install/upgrade.php".  DO NOT RUN THE STANDARD INSTALL SCRIPT UNLESS YOU WANT TO WIPE YOUR DATABASE CLEAN

Step 5 - From your "/cart.old" folder download the "/templates" folder to your computer.

Step 6 - Using an advanced text editor such as Notepad++ (or TextWrangler if you're on a a Mac), Run a "Multi-File Search & Replace" on the templates folder.  Replace "templates/" with "content/_your_theme/" (without quotes).  "_your_theme" can be named anything but must start with the underscore! ( "_" character)

Step 7 - Upload "_your_theme" folder to "cart/content"  [EDIT] DON'T UPLOAD THE FOLDER NAMED 'js'.  These are the javascript functions that perform the animations etc on the menus.  Mine broke but only just found out today what went wrong, whoops!  If you have custom scripts you want to use again, upload those individually to the new 'js' folder but remember that they might not work with the new 2.1 system.  If you're animations are no longer working (zoom images, menu sliders etc - overwrite your theme's 'js' folder with the one supplied in the 2.1 system to recover them.

Step 8 - Upload "template/products" to "content/products"

Step 9 - Place your "stylesheet.css" file where you have specified it in your "content/_your_theme/header.tpl.php" file.

[EDIT] Step 10 - If you have modified your language files, you can re-upload them to the "content/language/english" folder.  You can replace all the files EXCEPT for the "global.php".  If you have accidentally overwritten it with your old global.php file, you can recover it by uploading the file bundled in v2.1

That's it, the whole system should be updated without the need to re-upload products or product photos. You can continue following the installation guide from step 7 onwards.

All of my issues were down to relative linking in my design of 2.05, caused by the change of file directory structure in 2.1.  If this guide hasn't solved all of your issues, I am 99% sure that this is the cause of the issue for yourself.

I can offer limited assistance if you're stuck, post a reply and I'll try to lend a hand where I can.  I'll also format this post to make it more readable later on today.

Go to topic
Go to post
DAustin @ 28-06-2013 14:12:02

Sorry about being 2 days late!  Been down with a case of the manliest of man-flus.

If you see any mistakes, please add them to a reply.  Let's make this a community effort! wink

REMEMBER TO BACK-UP YOUR ORIGINALS!!!

Ok I'm gonna run through the edits, anyone using these changes should attempt to try to understand what's going on, as some customisation may be needed to get it working in a particular set-up:

We'll start with the variables (I put these on line 181):

/*
Edited by Dan Austin - Get values for Image and Image wrapper widths
*/
var dadw = document.getElementById("displayImg").offsetWidth;
var wrapw = document.getElementById("wrap").offsetWidth;
/*
Edited by Dan Austin - Get values for Offsets
*/
var dadl = ((wrapw - dadw) / 2);
var dadk = (wrapw / 2) + (dadw / 2);

OK all we're doing here is creating some variables to call later.  Note the value in the brackets, this is the objects id and must be set correctly.  Vars dadw and wrapw are using javascript to return pixel values for the widths.  Vars dadl and dadk take these values and perform some basic maths.

dadl = The difference between our custom wrapper width and the image width it contains, divided by 2.  This provides our value for offsetting the image position later.
dadk = Half the width of our image added to half the width of our wrapper.  This gives the value of the right edge of the image, which is needed to position the Zoom Image window to the right of our image (though obviously you can use this value to offset the image to the left instead)

On line 187 add an id so we can target the mousetrap event with javascript more easily (I have used dadzoom here).

            $mouseTrap = jWin.parent().append(format("<div id='dadzoom' class='mousetrap' style='background-image:url(\".\");z-index:999;position:absolute;width:%0px;height:%1px;top:%3px;\'></div>", sImg.outerWidth(), sImg.outerHeight(), 0, 0)).find(':last');

Then we can set the mousetrap event to the correct position using this:

/*
Edited by Dan Austin - Set mousetrap position using left offset
*/
document.getElementById("dadzoom").style.left = (dadl + 'px');

This sets the <style='left:Ypx'> where Ypx equals the value given for 'dadl' on our mousetrap event.

Ok, we now set our own custom wrapper (basically a carbon copy of the 'cloud-zoom-lens' div, which allows us to set a variable width for the 'cloud-zoom-lens' div without breaking the layout)

 /*
Edited by Dan Austin - Added wrapper 'zWrap' to cloud-zoom-lens div for js targetting
 */
                lens = jWin.append(format("<div id='zWrap' style='margin:0px;padding:0px;position:absolute;top:0;'><div id = 'cloud-zoom-lens' class = 'cloud-zoom-lens' style='display:none;z-index:98;position:absolute;width:%0px;height:%1px;'></div></div>", cw, ch)).find(':last');

And finally we set our 'zoom1' div width and left positioning based on our variables (this isn't stored in any file but seems to be made on the fly, however its id is set to zoom1 so we can target it):

 /*
Edited by Dan Austin
Set Zoom Div (child to 'zWrap') width and positioning                
*/
document.getElementById("zoom1").style.left = (dadl + 'px');
document.getElementById("zoom1").style.width = (dadw + 'px');

And that's it, centered images and cloud zoom, no matter what size your product photo's are!
If any of my explanation seems wrong, it could be, I did a lot of trial and error on this so I may not be explaining it correctly.

Deprecated Code:

In my provided cloud-zoom.js you'll notice other functions I've made and then commented out.  These were my first attempt and are for use when no 'zWrap' wrapper is used.  I've left them in in case you need to keep a set width for the 'cloud-zoom-lens' div for some reason.  It works nearly as well with the exception of one bug, caused by the mousetrap event not clearing quickly enough when the mouse leaves and reenters the mousetrap area.  It's down to the fade out effect and I only found 2 solutions.  First is to use my newer code, as this avoids the problem and was the only reason I actually scripted a variable 'cloud-zoom-lens' div.  The second is to remove the fade out effect (or set it to 0ms), but it doesn't look very nice.

Additional stuff - Centered Gallery Images:

Want centered gallery images?  (those little images beneath your product image)  Simple!  Open up your product-pictures.htm file and change it to this:

      <div id="picScroller">
      <ul style="list-style-type: none; margin: 0px; padding: 0px;">
       <li style="text-align:center; margin: 0px; padding: 0px;">{pictures}</li>
       </ul>
      </div>

This is an old trick here.  By using the html list element, you can force images to be centrally aligned by using 'text-align:center'.  This just sets up the list (and makes sure no extra styling is added like bullet points).

Finally here's the styling bits in my .css (I'm not sure if these bits are required for full functionality, however I include them here just to be sure):

.mousetrap{
position:relative;
display: block;
height: 135px;
width:204px;
overflow:hidden;
}
.mousetrap img{
height: 135px;
}

.viewProduct .productInfo .left .img img {
border: 2px solid #663F23;
margin-right:auto;
margin-left:auto;
  max-width:200px;
  max-height:135px;
  text-align:center;
  box-shadow: 2px 2px 4px #444;
}

I can't find any other declarations in my css, but I'm guessing anyone who's read this far knows enough about css for it not to be too much trouble!

Also my apologies if any of this code is wrong, or badly written!  I'm not a programmer! tongue

Files are attached below (cloud-zoom.js and product-pictures.htm).

REMEMBER TO BACK-UP YOUR ORIGINALS!!!

http://www.giftgnu.com/examples/cloud-zoom.js
http://www.giftgnu.com/examples/product-pictures.htm

Also David, people would kill for my Dance moves tongue

Go to topic
Go to post
DAustin @ 25-06-2013 20:21:43

I don't know whether to laugh or cry!  Cheers on your critique mate, it's much appreciated smile Though your base template made it nice and easy to understand.  you actually went ott with the style parameters to cover for a lot of different styles out of the box I noticed. Well I'll post up the code tomorrow for what little time it has left to be of any use!  And to think I even did a victory dance in the office...

In the meantime I wondered if you ever saw this? Could be a feature of 2.1 tongue

http://www.3news.co.nz/Shopping-site-charges-Internet-Explorer-7-tax/tabid/412/articleID/258139/Default.aspx

Go to topic
Go to post
DAustin @ 25-06-2013 15:11:16

Hi Dave,

I've modified the cloud zoom script and some of the template files to ensure that product images are always centered regardless of width.  The edits allow the cloud zoom visuals to change dynamically along with the images.  It also centres the gallery thumbnails beneath the product image regardless of number.

With your permission, I'd like to attach the template files and updated cloud-zoom.js for others that may wish to have their images centered and still be able to use the cloud zoom plug-in.

I have tested it on www.giftgnu.com/shop if you would like to view a working demo. (Be kind about the design, I'm still working on it!)

Thanks,
Dan

Go to topic
Go to post
DAustin @ 17-06-2013 15:40:22

Oh my, I actually went red with embarrassment then, I did briefly check the FAQ but must have scanned past that entry sad  Have merely changed the name attribute to include the "custom_" and it stores it in the table nicely.  Still getting the weird pop-up error, but the database confirms the information has been captured as well as the notes field in the member page.

Will look into this document error myself as punishment for not being able to read the FAQ properly!  It's not a server path issue but maybe javascript/jQuery as opening the link in a new tab loads the page fine, just not the pop-up window.

Thanks again,  I'll get my dunce's hat made tomorrow!

Go to topic
Go to post
DAustin @ 14-06-2013 14:05:53

Hi everyone (and by everyone I of course mean David!),

Just need a hand doing something with the signup page.

I'd like to add some fields for telephone and address.  I've added the fields into the start.tpl.php as so (I'll change the address into a multiline input once testing is out of the way):

<p>
    <label><?php echo $this->TEXT[27]; ?></label>
    <input type="text" name="telephone" value="" class="box" id="telephone" />
   </p>
   
   <p>
    <label><?php echo $this->TEXT[28]; ?></label>
    <input type="text" name="address" value="" class="box" id="address" />
   </p>

...and added the corresponding values to the public language file.  However I'm trying to suss out how the information is being parsed through the system.  It might be getting through fine, however I'm getting errors with certain pop-ups not being able to load documents.  In-particular the contact pop-up for a user (just to check if the information has been stored there).

I'm guessing I'll need to modify the customer SQL table to include the new fields?  Also if you could tell me which files link to one another through the process (basically where this information is getting sent to before the table is written) so i can add the relative MySQL write functions for the new fields.

I'm sure I could figure this out manually, but it'll take just as long as waiting for your response and I have other work to be getting on with at the moment!

Also if you have any clues as to why the pop-ups are failing to load their documents that would help too.  A small part of me thinks it might be the server path thing again, but I'm not normally that lucky.

Sorry to keep annoying you like this, but I am liking the idea of maianscript only site! (and I'll be writing an extremely positive review for you on the tech website n3rdabl3.co.uk once the project is done and dusted!  For some reason they consider me a writer there despite only ever offering minor technical assistance, furthering the point that I hate wordpress passionately)

Cheers,

Dan

Go to topic
Go to post
DAustin @ 13-06-2013 15:50:34

SOLVED!

The error for my particular install was caused by the iself-generated index.php that you download along with the .htaccess file from the admin area lockbox set-up page.

On Line 7 I had this:

include_once('/var/www/vhosts/<website tld>/httpdocs/trade/control/lockbox.php');

which doesn't work in http!

replace with the following:

include_once('http://www.yourwebsite.com/trade/control/lockbox.php');

Basically all you need to do is change the path from a server path into an http one.  Works a dream after I changed the link!

Hope this helps anyone else with the same trouble!

Go to topic
Go to post
DAustin @ 13-06-2013 15:25:34

Hi Dave, also having exact same issue.  Get password prompt, even entering super user details brings up a forbidden message.  What was the fix?

Go to topic
Go to post
DAustin @ 13-06-2013 13:54:10

FIXED - Just required enabling a payment gateway, if the package costs nothing then it bypasses the gateway automatically.  Coming to think of it I remember reading that somewhere a while back.  I'll remember to try these simple solutions in future before writing a long post out lol

Go to topic
Go to post
DAustin @ 13-06-2013 12:54:45

Hi David,  I'd have emailed you directly but as I don't have a license for lockbox I thought I'd stick to the rules.


I'm having all sorts of trouble setting this system up, down to a combination of 2 things:

1.  We don't need to charge users so we would like to bypass the whole payment gateway and allow free accounts
2.  Im using this in conjuction with an install of Maian Cart on a subdomain (Basically a direct copy of the public store, password protected to disallow non-approved individuals access to the trade site).

Followed instructions and installation went ok, but I have the following issues:

Sign-up page doesn't do anything or gives a forbidden message if i add a manual link for the payment gateway, i'm guessing this is because I have disabled all payment methods.  Would I still need to get users to parse their details through a payment gateway for a free account?  Basically how do I make the membership system free for users?

The sever path to member folder requires a trailing slash on my install, seeing another post this isn't supposed to be the case, however the htaccess file reads ok with no double slashes.

Also what would be the set-up for getting this to secure maian cart?  The cart install is in the following directory:

var/www/vhosts/<website tld>/subdomains/trade

lockbox is located here:

var/www/vhosts/<website tld>/subdomains/trade/lockbox

and member folder:

var/wwww/vhosts/<website tld>/members

package folder:

var/wwww/vhosts/<website tld>/members/trade

I can change any of these easily if needs be,  however as I am unable to test lockbox at this current time I've had to leave the set-up as is for now and get in touch with you.  Hopefully I've not missed something extremely straightforward!

Cheers Dave!

Go to topic
Go to post
DAustin @ 11-06-2013 15:38:07

Yeah I've always been impressed by David's speedy responses!

With regards to server path, I know my install today on a subdomain set the incorrect server path, obviously because it didn't know where the subdomain was stored as this varies from server to server depending on the admin.  As for standard installs to TLD's I have no idea besides a non-default set-up by the host?  There's only so much that can be done automatically after all!

Anyway, I really am tempted to write a CSV batch image uploader to help improve my PHP skills more than anything (And to protect me from having to add them all manually at a later date again!).  Should be a good challenge and will help me wrap my head around the tables, and I should at least be able to create a base from which David could use for a future version (if it works of course!).

Right, back to figuring out why the subdomain is ignoring certain language files -.-'

Go to topic
Go to post
DAustin @ 10-06-2013 15:33:18

How did you identify that based on his info?! hahah

Yeh it does but not like I had hoped lol.  Basically I wanted to be able to use my Zen Cart's database to pull the url's into Maian Cart's system, but they are designed in different ways as Zen Cart only has 1 table for products which has a column for the image url's.

So it does handle batch uploading of images, but only from your local HDD? Or am I missing something?  I was unable to find a way of batch uploading my image url's from Zen-Cart via a modified CSV.

Cheers,
Dan

Go to topic
Go to post
DAustin @ 10-06-2013 14:50:29

Just seen your other post regarding the Free features of maiancart.  From what you posted there it seems more and more likely that there is an issue with your server configuration.  My advice would be to get in touch with your technical admin for the server (which may require you to call your hosting company's support line) and ask them what could be causing the issue, as these functions should work straight out of the box!

Go to topic
Go to post
DAustin @ 10-06-2013 14:45:09

My first thought would be to check your php.ini settings, possibly an upload parameter set wrong (i.e. not enough filesize permitted or something).

If you want to add images manually use phpMyAdmin (or whatever mySQL vieiwng/editing software you have) to access the maiancart database.

Look for the mc_pictures table.  Here you will need to match your image url (don't worry about naming it the same product number) to the correct product id's.  To get those look in the mc_products table in the id column.

You're probably thinking if you've got this far that the table system is a little convoluted, but this is the table you would manually add your picture locations to.

My suggestion would be to create a test subdomain for your cart system, re-install maiancart to that system, copy the database and attempt any fixes on this "developer" version.

I was actually thinking of writing a script to bypass the image uploader, as it doesn't handle batch images like I had hoped.  It'll be a few months away if I do so don't get your hopes up for a speedy update tongue

Go to topic
Go to post

 

100% Free SoftwareSoftware Versions, Development, Docs & UpgradesHostingNewsletter
Made with in the U.K & Hong Kong

Free PHP Scripts / Responsive PHP Scripts / Lightweight PHP Scripts / White Label PHP Scripts