Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Internal site links from index.php


kahml

Recommended Posts

I hope that what I want to do is possible - I just don't see how yet.

 

Is it possible to include an anchor tag ( <href> ) statement in the include/languages/english/index.php DEFINE of TEXT_MAIN?

 

I would like to have links to the various key categories on my site within the textual description.

 

I have tried a number of times, and I always end with a "parse error" message.

 

Any help will be greatly appreciated.

 

Thanks!

 

Larry

Link to comment
Share on other sites

Yes.

 

Post your code, and we'll sort it out.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

OK, here's a portion of it...

 

define('TEXT_MAIN', '<h2>Welcome to StreetLifeComics.com!</h2>
           <p>StreetLifeComics.com: The web site where you can get the comic books you <em>really</em> want!</p>
           <p>blah, blah, blah</p>
<p>My store\'s  <a href=" . tep_href_link(FILENAME_DEFAULT, . \'cPath=4\' ) . ">
	 collection</a>  runs the gamut...

 

Ok, so I want to refer to category 4, off the index.php page, along with the osCSID - and this is the only sample of code that I've seen that will do that.

 

Now while this code doesn't choke, it doesn't produce a valid URL. What I end up with is http://localhost/osC_SLC/. tep_href_link(FILENAME_DEFAULT, . 'cPath=4' ) .

 

Granted, in all other instances that I've seen code like this, it was on the displayed page - not in a DEFINE.

 

Thanks for any - and all - insights in to the behavior of PHP.

 

Larry

Link to comment
Share on other sites

<a href="index.php?cPath=4&sort=2a&action=buy_now&products_id=**"><img src="images/addtobasket.gif" align=**** width=** height=** border=0 alt="Add To Basket"></a>

 

Just fill in the blanks where the stars are (and create your own 'add to basket' image).

 

Vger

 

p.s. Sorry, just realised you want to link to categories, whereas this is just for products.

Link to comment
Share on other sites

Not a problem. OK, so I get rid of the tep_ stuff and hard code the values.

 

BUT.. (there's always a but) how do I get to include the current session ID on the URL?

 

Thanks - it looks better now, but is still incomplete.

 

Larry

Link to comment
Share on other sites

Here's an instance where I can actually answer my own question (and isn't that what this exercise is all about?) and hope it helps someone else.

 

I was modifying the text for the Welcome Guest greeting in includes/languages/english.php and noticed the <a href="%s"> code.

 

define('TEXT_GREETING_GUEST', 'Welcome <span class="greetUser">Guest!</span> Would you like to <a href="%s"><u>log yourself in</u></a>? Or would you prefer to <a href="%s"><u>create an account</u></a>?');

 

I really wasn't sure what it was, but back tracked through the source code to find that index.php invoked a tep function!

 

            <td class="main"><?php echo tep_customer_greeting(); ?></td>

 

I found this routine in includes/functions/general.php.

 

// Return a customer greeting
 function tep_customer_greeting() {
   global $customer_id, $customer_first_name;

   if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) {
     $greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_first_name), tep_href_link(FILENAME_PRODUCTS_NEW));
   } else {
     $greeting_string = sprintf(TEXT_GREETING_GUEST, tep_href_link(FILENAME_LOGIN, '', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
   }

   return $greeting_string;
 }

 

If the customer is not logged on, it parses through the greeting text using the sprintf PHP function - which I had to look up - and adds the appropriate heading references into the string - WITH the session ID! - which is exactly what I wanted.

 

I simply built a new function in general.php to process the TEXT_MAIN code from index.php and added all of my internal heading references.

 

I'm actually starting to like the way osC is put together. Slowly (alright, very slowly), this is starting to make some sense.

 

Larry

Link to comment
Share on other sites

  • 4 weeks later...

Hi Larry

 

Did you get it to work in the end? I'm trying to do exactly the same thing on our site homepage (except link to a manufacturer) - whilst trying to keep the session id intact. Not ever having written any php functions I'd love to see what you created for general.php, and how it works in the includes/english.php page.

 

Thanks

 

Andrew

Link to comment
Share on other sites

  • 2 weeks later...
Hi Larry

 

Did you get it to work in the end? I'm trying to do exactly the same thing on our site homepage (except link to a manufacturer) - whilst trying to keep the session id intact. Not ever having written any php functions I'd love to see what you created for general.php, and how it works in the includes/english.php page.

 

Thanks

 

Andrew

 

Hi Guys,

 

I have just sussed a fix for my site using ancor tags and also using the session ID in the header.

 

use the echo tep_href_link like this to link to a page in the static information pages (there is a function to ref to product pages but I'm unsure if it will accept the following code:-

 

<?php echo tep_href_link( "reference_rigs5.php"); ?>#spinning

 

NOTE - add the #anchor tag outside the php echo tep_href_link code and this will maintain the session ID whilst providing an HTML style anchor to wherever on the page you want the link to point to ! (in this case "#spinning")

 

In OSC sessions it merely adds it after the OSCid and maintains the session.

 

I tried many things to get this to work, but if like me you have avoided using cookies etc then this definitely works !

 

I'll be watching this thread so any comments or problems please feed back !

 

Regards

 

 

 

Jeremy

 

:D

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...