Re: MultiSite Module Support Thread
First thank you cablesimple for leading me in the right direction.
I currently have
/httpdocs/includes/modules/pages/customers_authorization/header_php.php
Set up to send my regular customers back to the public site by using:
HTML Code:
if ($_SESSION['customers_authorization'] != '0') {
zen_redirect('http://store1.salvationarmy.ca' ."?zenid=". zen_session_id());
}
I've also used similar variations to update various files. The two sites are really begenning to look like one.
However, I want to follow this idea through more. In the file mentioned above I would like it to send a customer with products in their shopping cart to:
HTML Code:
http://store1.salvationarmy.ca/index.php?main_page=shopping_cart
I'm not sure what sql inquiry I would have to add for this. I've been trying to take fields from the login header, but as of yet to no avail.
Any ideas?
Re: MultiSite Module Support Thread
Hey jvoce,
If I'm following you, you just want to check and see if they have products in their cart, and if they do then send them to the shopping cart page instead of the homepage.
this will get you that info:
Code:
if (count($_SESSION['cart']->contents) > 0)
{
// Products in cart
}
else
{
// No products in cart
}
Re: MultiSite Module Support Thread
As it stands right now my file:
/httpdocs/includes/modules/pages/customers_authorization/header_php.php
Reads this:
HTML Code:
<?php
/**
* Customer Authorization
*
* @package page
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: header_php.php 2974 2006-02-05 04:53:19Z birdbrain $
*/
$sql = "SELECT customers_authorization
FROM " . TABLE_CUSTOMERS . "
WHERE customers_id = :customersID";
$sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
$check_customer = $db->Execute($sql);
$_SESSION['customers_authorization'] = $check_customer->fields['customers_authorization'];
if ($_SESSION['customers_authorization'] != '1') {
zen_redirect('http://store1.salvationarmy.ca' ."?zenid=". zen_session_id());
}
if ($_SESSION['customers_authorization'] != '0') {
zen_redirect('http://store1.salvationarmy.ca' ."?zenid=". zen_session_id());
}
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$breadcrumb->add(NAVBAR_TITLE);
if (CUSTOMERS_AUTHORIZATION_COLUMN_RIGHT_OFF == 'true') $flag_disable_right = true;
if (CUSTOMERS_AUTHORIZATION_COLUMN_LEFT_OFF == 'true') $flag_disable_left = true;
if (CUSTOMERS_AUTHORIZATION_FOOTER_OFF == 'true') $flag_disable_footer = true;
if (CUSTOMERS_AUTHORIZATION_HEADER_OFF == 'true') $flag_disable_header = true;
?>
I've changed it to the following:
HTML Code:
<?php
/**
* Customer Authorization
*
* @package page
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: header_php.php 2974 2006-02-05 04:53:19Z birdbrain $
*/
$sql = "SELECT customers_authorization
FROM " . TABLE_CUSTOMERS . "
WHERE customers_id = :customersID";
$sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
$check_customer = $db->Execute($sql);
$_SESSION['customers_authorization'] = $check_customer->fields['customers_authorization'];
if (count($_SESSION['cart']->contents) > 0) {
//Products in cart
zen_redirect('http://store1.salvationarmy.ca/index.php?main_page=shopping_cart' ."?zenid=". zen_session_id());
} else {
//No Products in cart
zen_redirect('http://store1.salvationarmy.ca' ."?zenid=". zen_session_id());
}
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$breadcrumb->add(NAVBAR_TITLE);
if (CUSTOMERS_AUTHORIZATION_COLUMN_RIGHT_OFF == 'true') $flag_disable_right = true;
if (CUSTOMERS_AUTHORIZATION_COLUMN_LEFT_OFF == 'true') $flag_disable_left = true;
if (CUSTOMERS_AUTHORIZATION_FOOTER_OFF == 'true') $flag_disable_footer = true;
if (CUSTOMERS_AUTHORIZATION_HEADER_OFF == 'true') $flag_disable_header = true;
?>
I'm sorry , this is probably really simple, and I'm just not getting it.
Re: MultiSite Module Support Thread
jvoce,
To be honest, I'm not quite sure what your doing with the customers_authorization code, however your redirection problem should be resolved by replacing your second "?" with a "&"
from this:
Code:
zen_redirect('http://store1.salvationarmy.ca/index.php?main_page=shopping_cart' ."?zenid=". zen_session_id());
to this:
Code:
zen_redirect('http://store1.salvationarmy.ca/index.php?main_page=shopping_cart' ."&zenid=". zen_session_id());
Re: MultiSite Module Support Thread
Thanks alot cablesimple!
It was a long day, and I was really losing my focus. Thank fully I'm at home, and now with it working I can go off and BBQ without any worries.
Again, much thanks, it is really appreciated.
Re: MultiSite Module Support Thread
Hi
I'm have installed this mod but am having a problem with the categories. I am using it on a test server and so my url currently is www.example.com with the main index page being www.example.com/store/index.php.
I have installed the mod and can see the index page with my template but when I go into the multisite tools and try and assign categories to www.example.com, it tells me it has done it but this is not reflected on the site.
Any ideas of any basic mistakes I may have made which causes this problem?
Re: MultiSite Module Support Thread
Ignore me I was just being stupid :frusty:
Multisite and authorizenet
Anyone have Multisite and Authorizenet working together? I thought that I had it set up right but There does not seem to be any communication to Authorize net. no Errors, my transactions are not showing up in my authorizenet account. Tests dont show any errors. No errors when i deliberately set the API code and key wrong.
I always just get the zen cart confirmation page and nothing else.
Any help would be appreciated.
makenoiz
Re: MultiSite Module Support Thread
Hello there,
I am thankful to Jesus Christ for this mod. We at www.amazingdiscoveries.org have just started to use it for many sites and it works quite well now.
We did come over one problem, and that is with linked products. The cat_filter() function searches for products matching the SITE_NAME in the description where the id of that category is the products master_category_id. If I confused you, don't worry. It will be easy when you'll see the code. The thing is that if I had a category that only had linked products then those products would not be showed in the extra site.
I had to make a few changes to the function so I'll just submit it and I hope that the author will make the changes for the next release. The changes occurred is where you see the RIGHT JOIN in the SQL.
Starting on line 34 of the cat_filter.php file:
PHP Code:
} elseif($sql == "select products_id from " . TABLE_FEATURED . " where status= 1 limit 1") {
// Special Query for the categories sideboxe/Featured Products
$sql = "SELECT f.products_id FROM " . TABLE_FEATURED . " f
INNER JOIN ".TABLE_PRODUCTS." p ON (f.products_id=p.products_id)
INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
ON (cd.language_id=".$_SESSION['languages_id']."
AND cd.categories_description LIKE '%-".SITE_NAME."-%')
RIGHT JOIN zc_products_to_categories p2c ON (p2c.categories_id = cd.categories_id AND f.products_id = p2c.products_id)
WHERE status=1 limit 1";
} elseif($sql == "select s.products_id from " . TABLE_SPECIALS . " s where s.status= 1 limit 1") {
// Special Query for the categories sideboxe/Special Products
$sql = "SELECT s.products_id FROM " . TABLE_SPECIALS . " s
INNER JOIN ".TABLE_PRODUCTS." p ON (s.products_id=p.products_id)
INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
ON (cd.language_id=".$_SESSION['languages_id']."
AND cd.categories_description LIKE '%-".SITE_NAME."-%')
RIGHT JOIN zc_products_to_categories p2c ON (p2c.categories_id = cd.categories_id AND s.products_id = p2c.products_id)
WHERE status=1 limit 1";
} else { // Query with categories but not descriptions
$str_pos_cats = strpos($sql_lower,TABLE_CATEGORIES . ' c');
if($str_pos_cats!==false&&$str_pos_cats<$str_pos_where) {
$add_pos = $str_pos_products + strlen(TABLE_CATEGORIES . ' c');
$str_pos_coma = strpos($sql_lower,',',$add_pos);
if($str_pos_coma!==false) {
$add_pos = $str_pos_coma;
}
if(($str_pos_where!==false)&&(($str_pos_coma===false)||($str_pos_where<$str_pos_coma))) {
$add_pos = $str_pos_where;
}
$sql = substr($sql,0,$add_pos).
" INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
ON (c.categories_id = cd.categories_id
AND cd.language_id=".$_SESSION['languages_id']."
AND cd.categories_description LIKE '%-".SITE_NAME."-%') ".
substr($sql,$add_pos);
}
}
if($fix==1) {
if(preg_match("/^select p2c.categories_id from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c ".
"where p.products_id = '[0-9]+' and p.products_status = '1' ".
"and p.products_id = p2c.products_id limit 1$/",$sql)) {
$sql = str_replace(TABLE_PRODUCTS_TO_CATEGORIES." p2c ",TABLE_PRODUCTS_TO_CATEGORIES." p2c
INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
ON (p2c.categories_id=cd.categories_id
AND cd.language_id=".$_SESSION['languages_id']."
AND cd.categories_description LIKE '%-".SITE_NAME."-%')
INNER JOIN ".TABLE_CATEGORIES." as c ON (cd.categories_id=c.categories_id AND c.categories_status=1)",$sql);
} else {
$add_pos = $str_pos_products + strlen(TABLE_PRODUCTS . ' p');
$str_pos_coma = strpos($sql_lower,',',$add_pos);
if($str_pos_coma!==false) {
$add_pos = $str_pos_coma;
}
if(($str_pos_where!==false)&&(($str_pos_coma===false)||($str_pos_where<$str_pos_coma))) {
$add_pos = $str_pos_where;
}
$sql = substr($sql,0,$add_pos).
" INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
ON (cd.language_id=".$_SESSION['languages_id']."
AND cd.categories_description LIKE '%-".SITE_NAME."-%')
RIGHT JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." p2c
ON (p2c.categories_id = cd.categories_id
AND p.products_id = p2c.products_id) ".
substr($sql,$add_pos);
}
God bless you all,
Iasmin from AmazingDiscoveries.org
Re: MultiSite Module Support Thread
Hello again,
I actually found a problem with the last query in the PHP quoted above. It comes when there is an already set p2c category. Here is the changed code:
PHP Code:
$sql = substr($sql,0,$add_pos).
" INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
ON (cd.language_id=".$_SESSION['languages_id']."
AND cd.categories_description LIKE '%-".SITE_NAME."-%')
RIGHT JOIN ".TABLE_PRODUCTS_TO_CATEGORIES." prod2cat
ON (prod2cat.categories_id = cd.categories_id
AND p.products_id = prod2cat.products_id) ".
substr($sql,$add_pos);
I hope this helps. God bless you,
Iasmin for Amazing Discoveries