Re: MultiSite Module Support Forum
@Design75 , your mod is great. But I have a list of fixes that needs to be addressed from your upgrade.
If you need me to resend the list, let me know.
If you are unable to get to the list, let me know.
If you have a suggestion of who can can complete your project, let me know.
It’s been a pleasure to work with you, but due to the php version not being addressed, I lost access to front side of the website due to a continuous out of resources error.
Re: MultiSite Module Support Forum
Wanted to post an update! Design75 has been working out my sites bugs with the multistore mod... and is saving my business! Thank you!
So much easier to maintain all stores in one place!
Re: MultiSite Module Support Forum
Hey this mod is working great for me, I am just having trouble applying to the instant search box. I searched here to no avail, but the thread is quite large and terms quite vague. Here is my templates instant search box. Inserting (cat_filter ) in various places just seems to disable the instant search box from working. Which I will end up doing if I cannot figure this out, but it is a nice feature that I would prefer not to give up. Many thanks in advance.
Code:
<?php
/**
* @package Instant Search Results
* @copyright Copyright Ayoob G 2009-2011
* @copyright Portions Copyright 2003-2006 The Zen Cart Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
*/
//This PHP file is used to get the search results from our database.
// I don't know if this is nessceary
header( 'Content-type: text/html; charset=utf-8' );
//need to add this
require('includes/application_top.php');
global $db;
//this gets the word we are searching for. Usually from instantSearch.js.
$wordSearch = (isset($_GET['query']) ? $_GET['query'] : '');
// we place or results into these arrays
//$results will hold data that has the search term in the begining of the word. This will yield a better search result but the number of results will be a few.
//$resultsAddAfter will hold data that has the search term anywhere in the word. This will yield a normal search result but the number of results will be a high.
//$results has first priority over $resultsAddAfter
$results=array();
$resultsAddAfter=array();
$prodResult;
//the search word can not be empty
if (strlen($wordSearch) > 0) {
//if the user enters less than 2 characters we would like match search results that beging with these characters
//if the characters are greater than 2 then we would like to broaden our search results
if (strlen($wordSearch) <= 2) {
$wordSearchPlus = $wordSearch . "%";
}else{
$wordSearchPlus = "%" . $wordSearch . "%";
}
//first we would like to search for products that match our search word
//we then order the search results with respect to the keyword found at the begining of each of the results
$sqlProduct = "SELECT pd.products_name, p.products_model, pd.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_status FROM " . TABLE_PRODUCTS_DESCRIPTION . " as pd , " . TABLE_PRODUCTS . " as p
WHERE p.products_id = pd.products_id
AND p.products_status <> 0
AND ((pd.products_name LIKE :wordSearchPlus:) OR (p.products_model LIKE :wordSearchPlus:) OR (LEFT(pd.products_name,LENGTH(:wordSearch:)) SOUNDS LIKE :wordSearch:))
AND language_id = '" . (int)$_SESSION['languages_id'] . "'
ORDER BY
field(LEFT(pd.products_name,LENGTH(:wordSearch:)), :wordSearch:) DESC,
pd.products_viewed DESC";
//this protects use from sql injection - i think????
$sqlProduct = $db->bindVars($sqlProduct, ':wordSearch:', $wordSearch, 'string');
$sqlProduct = $db->bindVars($sqlProduct, ':wordSearchPlus:', $wordSearchPlus, 'string');
$dbProducts = $db->Execute($sqlProduct);
//this takes each item that was found in the results and places it into 2 separate arrays
if ($dbProducts->RecordCount() > 0) {
while (!$dbProducts->EOF) {
$prodResult = strip_tags($dbProducts->fields['products_name']);
$products_model = $dbProducts->fields['products_model'];
if (strtolower(substr($prodResult,0,strlen($wordSearch))) == strtolower($wordSearch)){
$results[] = array(
//we have 4 seperate variables that will be passed on to instantSearch.js
//'q' is the result thats been found
//'c' is the number of item within a category search (we leave this empty for product search, look at the example bellow for category search)
//'l' is used for creating a link to the product or category
//'pc' lets us know if the word found is a product or a category
//'pr' for the price of product
//'img' gets the image of product/category
'q'=>$prodResult,
'c'=>zen_get_products_display_price($dbProducts->fields['products_id']),
'l'=>$dbProducts->fields['products_id'],
'pc'=>"p",
'pr'=>"",
'pm'=> (($products_model !='') ? '<span class="product-model">'.TEXT_PRODUCT_MODEL . '<strong>'.$products_model.'</strong></span>' : ''),
'img'=>zen_image(DIR_WS_IMAGES . strip_tags($dbProducts->fields['products_image']), strip_tags($dbProducts->fields['products_name']), 85, 106)
);
}else{
$resultsAddAfter[] = array(
'q'=>$prodResult,
'c'=>zen_get_products_display_price($dbProducts->fields['products_id']),
'l'=>$dbProducts->fields['products_id'],
'pc'=>"p",
'pr'=>"",
'pm'=> (($products_model !='') ? '<span class="product-model">'.TEXT_PRODUCT_MODEL . '<strong>'.$products_model.'</strong></span>' : ''),
'img'=>zen_image(DIR_WS_IMAGES . strip_tags($dbProducts->fields['products_image']), strip_tags($dbProducts->fields['products_name']), 85, 106)
);
}
$dbProducts->MoveNext();
}
}
//similar to product search but now we search witin categories
/*$sqlCategories = "SELECT categories_name, categories_id
FROM " . TABLE_CATEGORIES_DESCRIPTION . "
WHERE (categories_name LIKE :wordSearchPlus:)
OR (LEFT(categories_name,LENGTH(:wordSearch:)) SOUNDS LIKE :wordSearch:)
ORDER BY
field(LEFT(categories_name,LENGTH(:wordSearch:)), :wordSearch:) DESC
LIMIT 4"; */
/*$sqlCategories = "SELECT " . TABLE_CATEGORIES_DESCRIPTION . ".categories_name, " . TABLE_CATEGORIES_DESCRIPTION . ".categories_id, " . TABLE_CATEGORIES . ".categories_image, " . TABLE_CATEGORIES . ".categories_status
FROM " . TABLE_CATEGORIES_DESCRIPTION . ", " . TABLE_CATEGORIES . "
WHERE " . TABLE_CATEGORIES . ".categories_id = " . TABLE_CATEGORIES_DESCRIPTION . ".categories_id
AND " . TABLE_CATEGORIES . ".categories_status <> 0
AND ((categories_name LIKE :wordSearchPlus:) OR (LEFT(" . TABLE_CATEGORIES_DESCRIPTION . ".categories_name,LENGTH(:wordSearch:)) SOUNDS LIKE :wordSearch:))
AND language_id = '" . (int)$_SESSION['languages_id'] . "'
ORDER BY
field(LEFT(" . TABLE_CATEGORIES_DESCRIPTION . ".categories_name,LENGTH(:wordSearch:)), :wordSearch:) DESC";
$sqlCategories = $db->bindVars($sqlCategories, ':wordSearch:', $wordSearch, 'string');
$sqlCategories = $db->bindVars($sqlCategories, ':wordSearchPlus:', $wordSearchPlus, 'string');
$dbCategories = $db->Execute($sqlCategories);*/
/*if ($dbCategories->RecordCount() > 0) {
while (!$dbCategories->EOF) {
//this searches for the number of products within a category
$products_count = zen_count_products_in_category($dbCategories->fields['categories_id']).' product(s)';
$prodResult = strip_tags($dbCategories->fields['categories_name']);
if (strtolower(substr($prodResult,0,strlen($wordSearch))) == strtolower($wordSearch)){
$results[] = array(
'q'=>$prodResult,
'c'=>$products_count,
'l'=>$dbCategories->fields['categories_id'],
'pc'=>"c",
'pr'=>"",
'img'=>zen_image (DIR_WS_IMAGES . zen_get_categories_image($dbCategories->fields['categories_id']), strip_tags($dbCategories->fields['categories_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)
);
}else{
$resultsAddAfter[] = array(
'q'=>$prodResult,
'c'=>$products_count,
'l'=>$dbCategories->fields['categories_id'],
'pc'=>"c",
'pr'=>"",
'img'=>zen_image (DIR_WS_IMAGES . zen_get_categories_image($dbCategories->fields['categories_id']), strip_tags($dbCategories->fields['categories_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)
);
}
$dbCategories->MoveNext();
}
}*/
}
//we now re-sort the results so that $results has first priority over $resultsAddAfter
foreach ($resultsAddAfter as &$value) {
$results[] = array(
'q'=>$value["q"],
'c'=>$value["c"],
'l'=>$value["l"],
'pc'=>$value["pc"],
'pm'=>$value["pm"],
'img'=>$value['img']
);
}
unset($value);
//the results are now passed onto instantSearch.js
echo json_encode($results);
?>
Re: MultiSite Module Support Forum
Without being able to test, I think you only need to change 1 line of code.
Find:
Code:
$dbProducts = $db->Execute($sqlProduct);
and replace with:
Code:
$dbProducts = $db->Execute(cat_filter($sqlProduct));
Quote:
Originally Posted by
Koda
Hey this mod is working great for me, I am just having trouble applying
to the instant search box. I searched here to no avail, but the thread is quite large and terms quite vague. Here is my templates instant search box. Inserting (cat_filter ) in various places just seems to disable the instant search box from working. Which I will end up doing if I cannot figure this out, but it is a nice feature that I would prefer not to give up. Many thanks in advance.
Code:
<?php
/**
* @package Instant Search Results
* @copyright Copyright Ayoob G 2009-2011
* @copyright Portions Copyright 2003-2006 The Zen Cart Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
*/
//This PHP file is used to get the search results from our database.
// I don't know if this is nessceary
header( 'Content-type: text/html; charset=utf-8' );
//need to add this
require('includes/application_top.php');
global $db;
//this gets the word we are searching for. Usually from instantSearch.js.
$wordSearch = (isset($_GET['query']) ? $_GET['query'] : '');
// we place or results into these arrays
//$results will hold data that has the search term in the begining of the word. This will yield a better search result but the number of results will be a few.
//$resultsAddAfter will hold data that has the search term anywhere in the word. This will yield a normal search result but the number of results will be a high.
//$results has first priority over $resultsAddAfter
$results=array();
$resultsAddAfter=array();
$prodResult;
//the search word can not be empty
if (strlen($wordSearch) > 0) {
//if the user enters less than 2 characters we would like match search results that beging with these characters
//if the characters are greater than 2 then we would like to broaden our search results
if (strlen($wordSearch) <= 2) {
$wordSearchPlus = $wordSearch . "%";
}else{
$wordSearchPlus = "%" . $wordSearch . "%";
}
//first we would like to search for products that match our search word
//we then order the search results with respect to the keyword found at the begining of each of the results
$sqlProduct = "SELECT pd.products_name, p.products_model, pd.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_status FROM " . TABLE_PRODUCTS_DESCRIPTION . " as pd , " . TABLE_PRODUCTS . " as p
WHERE p.products_id = pd.products_id
AND p.products_status <> 0
AND ((pd.products_name LIKE :wordSearchPlus:) OR (p.products_model LIKE :wordSearchPlus:) OR (LEFT(pd.products_name,LENGTH(:wordSearch:)) SOUNDS LIKE :wordSearch:))
AND language_id = '" . (int)$_SESSION['languages_id'] . "'
ORDER BY
field(LEFT(pd.products_name,LENGTH(:wordSearch:)), :wordSearch:) DESC,
pd.products_viewed DESC";
//this protects use from sql injection - i think????
$sqlProduct = $db->bindVars($sqlProduct, ':wordSearch:', $wordSearch, 'string');
$sqlProduct = $db->bindVars($sqlProduct, ':wordSearchPlus:', $wordSearchPlus, 'string');
$dbProducts = $db->Execute($sqlProduct);
//this takes each item that was found in the results and places it into 2 separate arrays
if ($dbProducts->RecordCount() > 0) {
while (!$dbProducts->EOF) {
$prodResult = strip_tags($dbProducts->fields['products_name']);
$products_model = $dbProducts->fields['products_model'];
if (strtolower(substr($prodResult,0,strlen($wordSearch))) == strtolower($wordSearch)){
$results[] = array(
//we have 4 seperate variables that will be passed on to instantSearch.js
//'q' is the result thats been found
//'c' is the number of item within a category search (we leave this empty for product search, look at the example bellow for category search)
//'l' is used for creating a link to the product or category
//'pc' lets us know if the word found is a product or a category
//'pr' for the price of product
//'img' gets the image of product/category
'q'=>$prodResult,
'c'=>zen_get_products_display_price($dbProducts->fields['products_id']),
'l'=>$dbProducts->fields['products_id'],
'pc'=>"p",
'pr'=>"",
'pm'=> (($products_model !='') ? '<span class="product-model">'.TEXT_PRODUCT_MODEL . '<strong>'.$products_model.'</strong></span>' : ''),
'img'=>zen_image(DIR_WS_IMAGES . strip_tags($dbProducts->fields['products_image']), strip_tags($dbProducts->fields['products_name']), 85, 106)
);
}else{
$resultsAddAfter[] = array(
'q'=>$prodResult,
'c'=>zen_get_products_display_price($dbProducts->fields['products_id']),
'l'=>$dbProducts->fields['products_id'],
'pc'=>"p",
'pr'=>"",
'pm'=> (($products_model !='') ? '<span class="product-model">'.TEXT_PRODUCT_MODEL . '<strong>'.$products_model.'</strong></span>' : ''),
'img'=>zen_image(DIR_WS_IMAGES . strip_tags($dbProducts->fields['products_image']), strip_tags($dbProducts->fields['products_name']), 85, 106)
);
}
$dbProducts->MoveNext();
}
}
//similar to product search but now we search witin categories
/*$sqlCategories = "SELECT categories_name, categories_id
FROM " . TABLE_CATEGORIES_DESCRIPTION . "
WHERE (categories_name LIKE :wordSearchPlus:)
OR (LEFT(categories_name,LENGTH(:wordSearch:)) SOUNDS LIKE :wordSearch:)
ORDER BY
field(LEFT(categories_name,LENGTH(:wordSearch:)), :wordSearch:) DESC
LIMIT 4"; */
/*$sqlCategories = "SELECT " . TABLE_CATEGORIES_DESCRIPTION . ".categories_name, " . TABLE_CATEGORIES_DESCRIPTION . ".categories_id, " . TABLE_CATEGORIES . ".categories_image, " . TABLE_CATEGORIES . ".categories_status
FROM " . TABLE_CATEGORIES_DESCRIPTION . ", " . TABLE_CATEGORIES . "
WHERE " . TABLE_CATEGORIES . ".categories_id = " . TABLE_CATEGORIES_DESCRIPTION . ".categories_id
AND " . TABLE_CATEGORIES . ".categories_status <> 0
AND ((categories_name LIKE :wordSearchPlus:) OR (LEFT(" . TABLE_CATEGORIES_DESCRIPTION . ".categories_name,LENGTH(:wordSearch:)) SOUNDS LIKE :wordSearch:))
AND language_id = '" . (int)$_SESSION['languages_id'] . "'
ORDER BY
field(LEFT(" . TABLE_CATEGORIES_DESCRIPTION . ".categories_name,LENGTH(:wordSearch:)), :wordSearch:) DESC";
$sqlCategories = $db->bindVars($sqlCategories, ':wordSearch:', $wordSearch, 'string');
$sqlCategories = $db->bindVars($sqlCategories, ':wordSearchPlus:', $wordSearchPlus, 'string');
$dbCategories = $db->Execute($sqlCategories);*/
/*if ($dbCategories->RecordCount() > 0) {
while (!$dbCategories->EOF) {
//this searches for the number of products within a category
$products_count = zen_count_products_in_category($dbCategories->fields['categories_id']).' product(s)';
$prodResult = strip_tags($dbCategories->fields['categories_name']);
if (strtolower(substr($prodResult,0,strlen($wordSearch))) == strtolower($wordSearch)){
$results[] = array(
'q'=>$prodResult,
'c'=>$products_count,
'l'=>$dbCategories->fields['categories_id'],
'pc'=>"c",
'pr'=>"",
'img'=>zen_image (DIR_WS_IMAGES . zen_get_categories_image($dbCategories->fields['categories_id']), strip_tags($dbCategories->fields['categories_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)
);
}else{
$resultsAddAfter[] = array(
'q'=>$prodResult,
'c'=>$products_count,
'l'=>$dbCategories->fields['categories_id'],
'pc'=>"c",
'pr'=>"",
'img'=>zen_image (DIR_WS_IMAGES . zen_get_categories_image($dbCategories->fields['categories_id']), strip_tags($dbCategories->fields['categories_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)
);
}
$dbCategories->MoveNext();
}
}*/
}
//we now re-sort the results so that $results has first priority over $resultsAddAfter
foreach ($resultsAddAfter as &$value) {
$results[] = array(
'q'=>$value["q"],
'c'=>$value["c"],
'l'=>$value["l"],
'pc'=>$value["pc"],
'pm'=>$value["pm"],
'img'=>$value['img']
);
}
unset($value);
//the results are now passed onto instantSearch.js
echo json_encode($results);
?>
Re: MultiSite Module Support Forum
Thank you for the speedy reply! I did just try that, however the nefarious test product is still showing up in the instant search :(
Re: MultiSite Module Support Forum
It is no biggie really, I am overall extremely satisfied with this module and found it very easy to implement. The only issues I found were with custom themes where certain files were changed, but even those were fairly easy enough to edit out the offending fields. I think it has satisfied pretty much every use case I needed out of it. My instant search wasn't providing me SEO friendly URLs anyways, so it is probably for the best to disable this as to not interfere with google rankings due to duplicate content. I should be finished up with my work by the end of the day and hopefully there are no other holdups, but I might be back if I run into issues with the final stages implementing payment processors for a multi-site running off of the main one. Will see :thumbsup:
Re: MultiSite Module Support Forum
Quote:
Originally Posted by
Koda
It is no biggie really, I am overall extremely satisfied with this module and found it very easy to implement. The only issues I found were with custom themes where certain files were changed, but even those were fairly easy enough to edit out the offending fields. I think it has satisfied pretty much every use case I needed out of it. My instant search wasn't providing me SEO friendly URLs anyways, so it is probably for the best to disable this as to not interfere with google rankings due to duplicate content. I should be finished up with my work by the end of the day and hopefully there are no other holdups, but I might be back if I run into issues with the final stages implementing payment processors for a multi-site running off of the main one. Will see :thumbsup:
You can try replacing your instant search with this version https://github.com/Zen4All-nl/InstantSearch/releases . You can safely use the latest beta of it, it only lacks documentation
Re: MultiSite Module Support Forum
Thank you, I looked into it and it may be a suitable alternative. I am back with another question, this one is a bit vague as well, although there was certainly discussion about this, just nothing that I found that I could fully understand or find as a conclusive solution. I am hoping to allow our users to be able to travel from one site to the next, but load the template of the site they came from, rather than show the pre-designed template of the site that they are going to. This will be done through a link. My setup is with site1 and site2 being websites catering similar products to opposite niches, with site3 being where users of both check out with their individual items. For the sake of a seamless user experience, it would be best to keep the same stylesheet files and overall template theme design when the user moves from site1/site2 to site3.
Another user mentioned adding &template_dir=YOUR_TEMPLATE or &template_dir=template_default however when I try this out it just abandons the template altogether and goes to the ugly default one. It does this no matter what I change YOUR_TEMPLATE to, but only when &template_dir= is appended to the URL, so I know it is doing something, but it is seemingly having a problem with applying or perhaps finding the template files to apply. I am not sure if this fix would work for more than one click through however, but that could be worked around.
Re: MultiSite Module Support Forum
Did you try replacing YOUR_TEMPLATE with the actual folder name of the template you want to show?
Re: MultiSite Module Support Forum
Yes of course, I tried with just about every combination I could think of, the folder name, the template name, website name, what the templates are named in the config files, etc., just to be sure. Is there something additional that needs to be done to have the mod designate a url formatted such as this: http://site1.com/&template_dir=site_...te_folder_name to display the site_2 theme while on site1? Or should this be able to do this out of the box? I noticed template_dir did not affect my websites that do not have this installed, so I just must be inputting something incorrectly is my thought, but no idea on the formatting. I have even tried going from public_html/includes/templates/site_2_template_folder_name but that didn't work either.