Zen Cart Logo
Forums / General Questions / Add Active Zenid to link

Add Active Zenid to link

Locked

Views: 1,370

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
28 Aug 2007, 1:59 PM
#1
jvoce avatar

jvoce

New Zenner

Join Date:
Jul 2006
Location:
Toronto, ON
Posts:
87
Plugin Contributions:
0

Add Active Zenid to link

I'm needing the ability to add a customers current session id to a link. This is a link that I would be placing in the main section of a page, and the dropdown header, so it can't be a complicated sidebox (which I've already come across).

So far I have a code that looks like this, and as you can tell I'm not the most advanced coder.

<a href=http://store1.salvationarmy.ca,$session>Online Store</a>

Help would be greatly appreciated.

28 Aug 2007, 2:35 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Add Active Zenid to link

Why ?

28 Aug 2007, 3:04 PM
#3
jvoce avatar

jvoce

New Zenner

Join Date:
Jul 2006
Location:
Toronto, ON
Posts:
87
Plugin Contributions:
0

Re: Add Active Zenid to link

Well, I've been making great gains integrating the MultiSite Module to create essentially two classes of customers. One group of customers with access to all products, and the other group with only select access to products. This ability will allow us to supply our more official supplies to our locations, without disclosing information on these products to those who may use the information to scam good willed people.

MultiSite module works for creating two separate sites, but instead I want to integrate it to the point where everyone using the same login screen and the directed accordingly. This way a customer only needs to remember one web address, and we don't have to continually remind our locations of a separate site for internal supplies.

I posted this in the MultiSite Module Thread, but no one seems to have been able to pass on any hints yet. I thought if I posted it separately I might get someone else to look, that wouldn't normally that support thread.
Link to posts.

There is a sidebox with the module that provides this functionality, but I need to take it out of the sidebox to incorporate it into a main page and my dropdown header. When the zenid is able to transfer the shopping cart will be shared, and a customer will only need to login once.

I've attached a copy of the sidebox with the module, and a crude graph which shows the desired steps/ability.

I hope I've been able to clearly communicate my idea.

5 Sep 2007, 3:03 PM
#4
jvoce avatar

jvoce

New Zenner

Join Date:
Jul 2006
Location:
Toronto, ON
Posts:
87
Plugin Contributions:
0

Re: Add Active Zenid to link

Any ideas?? I think I've gone a far as I am capable on this, and without any avail yet.

5 Sep 2007, 4:12 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Add Active Zenid to link

Using the code you posted, what does happen ?
All you've said is that it's not working.

5 Sep 2007, 4:13 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Add Active Zenid to link

What happens if you replace your sidebox code with this:```

<?php /** * This sidebox display the other sites where the customers can buy items from. * It allow to do inter-sites orders buy keeping the same session over the other sites. * site_links add the zenid to the end of these links and allow to keep the sessions over other sites. */ function add_site_link($site_name,$url='',$session=true) { global $default_server_name; if(($site_name!=$default_server_name)&&("http://$default_server_name"!=$url)) { if($url=='') { $url = "http://$site_name"; } if($session && zen_not_null(zen_session_id())) { if(strpos($url,'?')===false) { $separator = '?'; } else { $separator = '&'; } $url .= $separator . zen_session_name() . '=' . zen_session_id(); } return '<a href="'.$url.'">'.$site_name.'</a>'; } } unset($more_information); //Title of the box (Should be moved to a language file if multi_language site... define('BOX_HEADING_SITE_LINKS','Partners'); //Syntax: //add_site_link(DISPLAYED NAME OF THE SITE , URL OF THE SITE); $more_information[] = add_site_link('Public Store','http://store1.salvationarmy.ca'); // only show if links are active if (sizeof($more_information) > 0) { require($template->get_template_dir('tpl_more_information.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes') . '/tpl_more_information.php'); $title = BOX_HEADING_SITE_LINKS; $title_link = false; require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); } ?>
6 Sep 2007, 12:14 PM
#7
jvoce avatar

jvoce

New Zenner

Join Date:
Jul 2006
Location:
Toronto, ON
Posts:
87
Plugin Contributions:
0

Re: Add Active Zenid to link

Dr.

Thanks for your response. I won't lie this issue is really frustrating me. I'm so close to the functionality that I need, but I can't quite seem to grasp it. :frusty:

What I'm trying to do is basically take the functionality out of the sidebox, and create the same effect in my dropdown menu, a main section of one page, and other places. For that too happen I need to find a simpler, less complex code for this. For sure it needs to be taken out of the sidebox.

The first code that I posted was my own attempt at this:

<a href=http://store1.salvationarmy.ca,$session>Online Store</a>

This is a single line code and it is working as just a straight link. I'm guessing the obvious that I haven't clearly defined where to find the zenid to attach it at the end of the link.

I posted the previous file attachment to show the original sidebox, that I am trying to modify, I thought it might help. (The original file is working perfectly as intended though).

I won't lie, it's kind of obvious anyways, but I'm not the most advanced coder on zen. :lookaroun

Any help is greatly appreciated.

Thanks.

6 Sep 2007, 4:31 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Add Active Zenid to link

Then take just the function from the code I posted above, dump it into a new file named /includes/functions/extra_functions/my_functions.php

Make sure the file contents begins with <?php before the rest of the function definition.

Then, wherever you want to place your link, just use the call to the function like the sidebox code uses:```
echo add_site_link('Public Store','http://store1.salvationarmy.ca');

11 Sep 2007, 6:18 PM
#9
jvoce avatar

jvoce

New Zenner

Join Date:
Jul 2006
Location:
Toronto, ON
Posts:
87
Plugin Contributions:
0

Re: Add Active Zenid to link

Thanks Doc,

You are genius. The function that you suggested works excellent!

:clap:

I am no longer afraid of the the doctor. (the dentist is a different story)