Jump to content
Sign in to follow this  
stevel

Embed Links with SID in Description

Recommended Posts

Sorry, haven't had a chance to investigate further.  The substitution code isn't being called at all.  I hope to get a chance to look at it more tonight.

 

Hi Steve. I can tell that in my case the substitution code was being called, just not returning the right result. I think maybe in the case of trying to change category information, you might have better luck if it were called from either application top or index.php as opposed to product.info. I did this to make it work throughout the store wherever I need it. Does this make any sense?

 

Thanks again.

 

Art

Share this post


Link to post
Share on other sites

No, not really... The function is being called, but the "preg_replace" call is not being done. What you're getting is the unmodified text from the description.

 

You need to call the function from the place where the description text is being written to the HTML stream.

Share this post


Link to post
Share on other sites
No, not really...  The function is being called, but the "preg_replace" call is not being done.  What you're getting is the unmodified text from the description.

 

You need to call the function from the place where the description text is being written to the HTML stream.

 

Thanks. I think I get it now.

 

Art

Share this post


Link to post
Share on other sites

DOH! :-"

 

I knew that if I just let it percolate for a bit it would come to me. index.php has TWO places where the categories_description text is displayed. You and I changed only one of them. The first is used for "nested categories" (which I don't have on my site.) Change them both to call embedded_href_replace and you should be in business.

Share this post


Link to post
Share on other sites
DOH! :-"

 

I knew that if I just let it percolate for a bit it would come to me.  index.php has TWO places where the categories_description text is displayed.  You and I changed only one of them.  The first is used for "nested categories" (which I don't have on my site.)  Change them both to call embedded_href_replace and you should be in business.

 

Hi Steve.

 

You're an absolute genius. I missed the first one somehow, and now that I changed that, it works perfectly.

 

Thanks very much, it is just what the doctor ordered. :)

 

Art

Share this post


Link to post
Share on other sites

Any ideas to use this contribution within define_mainpage (using HTMLarea) ?

 

Best

 

Torsten Srebot

Share this post


Link to post
Share on other sites

I'll need some more clues as to what you want to do. I took a quick look at the define_mainpage contrib and it seems to write a .php file that gets included, so anything you want to code in PHP can be written there. My contribution is for the case where text comes from the database and thus cannot contain PHP code.

Share this post


Link to post
Share on other sites

Hello!

 

Finally somebody who has dealed about Sessions in OSC :-)

 

I have the following problem:

I add something to the OSC-cart (on Mambo, having OSC integrated).

 

I switch to another Module (jinzora, a "big" component with its own session handling).

 

Instantly the OSC-Shopping-Cart is shown empty.

(it is a mambo module, but in fact it does nothing else then displaying the OSC-Cart-Box in the mambo-framework - I already looked into the code without sucess :-(

 

BUT...

If I switch back to OSC (e.g. when adding another item to the cart),

there are now two items in the cart. (which means the first has not disappeared,

it was just not displayed...)

 

How can I deal this problem???

 

Any hint would be very nice, this is producing "headaches" :-(

 

Bye

Sven

 

 

 

I'll need some more clues as to what you want to do.  I took a quick look at the define_mainpage contrib and it seems to write a .php file that gets included, so anything you want to code in PHP can be written there.  My contribution is for the case where text comes from the database and thus cannot contain PHP code.

Share this post


Link to post
Share on other sites

Steve,

 

I also want to use this contrib for linking from category descritions and have read through your conversation with AJ. Can you please tell me what modifications I would need to make to enable the oscid to be carried over when linking from category descriptions.

 

To do this you advise: Change both the places where categories_description text is displayed in index.php to call embedded_href_replace and you should be in business.

 

I would appreciate it if you could clarify this for me.

Share this post


Link to post
Share on other sites

If you have category descriptions implemented, there are two occurrences of:

echo $category['categories_description'];

in index.php. Replace each of these with:

echo embedded_href_replace($category['categories_description']);

Share this post


Link to post
Share on other sites
If you have category descriptions implemented, there are two occurrences of:

echo $category['categories_description'];

in index.php.  Replace each of these with:

echo embedded_href_replace($category['categories_description']);

 

 

 

Thanks Steve, my non statndard version of oscommerce needed a bit a of messing about with but worked it out from your instructions. Thank you for your help and prompt reply. I had been trying to sort this out for days and your contribution and support thread provided me with the info I needed. is your paypal email add still steve at stevelionel dot com? I would like to make a small contribution to your charity. :thumbsup:

Share this post


Link to post
Share on other sites

Hi Steve with your contribution just wondering how to do in the root directory index.php

 

There is no coding for <p><?php echo stripslashes($product_info['products_description']); ?></p>

 

or anything about stipslashes? What do i need to change to make this work..

 

And another question is there a way to use this function in a static php page? one that i have created and linking to catalogue items so it creates the Id still.?

Share this post


Link to post
Share on other sites
Hi Steve with your contribution just wondering how to do in the root directory index.php

 

There is no coding for <p><?php echo stripslashes($product_info['products_description']); ?></p>

 

or anything about stipslashes? What do i need to change to make this work..

 

And another question is there a way to use this function in a static php page? one that i have created and linking to catalogue items so it creates the Id still.?

 

 

<a href="' . tep_href_link(FILENAME_TESTPAGE) . '"> testpage </a>

 

I have used links with this format on newly created static pages and it carries the sid ok. Have you trid this?

Share this post


Link to post
Share on other sites

I seem to be missing something that I'm afraid is frightfully obvious in how to code the links. I have tried coding the link several different ways, and each time, admin somehow adds &osCAdminID=bd5fb7a249847cad95a96e83bbb8971a to the link... I code the link like the instructions say (at least I thought I was doing it right), then I click "Preview" then "Update"... and then when I go back again to look at the code for the description in admin, it's somehow added that osCAdminID onto it.

<p>

Is this okay? Or am I doing something wrong?

Share this post


Link to post
Share on other sites

Are you looking at the address bar in the browser, or in the Description textbox? Are you using some sort of WYSIWYG editor, perhaps? I can't imagine how the oscAdmin ID would get in there.

Share this post


Link to post
Share on other sites

I'm not using any editor... I hand-code all my sites. I hand-coded this link in the description box of my product, in OSC admin... that's where the session ID is appearing.

 

I tried it two different ways. I tried copying and using the code that you gave in the instructions... the short little bit... just substituting the product number for the right product number. Like I said, the link worked in the customer view... at least I think it did, although it wasn't showing any session id in the URL space at all, even after I added products to the shopping cart. But then when I went back to edit the description some more, I noticed that it added the osCAdmin session id.

 

The other way I tried was to just copy the link to a particular product from my browser window, when I was pretending to be a customer, and then switch over to admin and use that for the link. Again... there wasn't any session id in the URL spot to begin with, but it added it after I went back.

 

This is all with browser-safe URL's ON... maybe that's messing it up? At this point, I honestly don't know it's better to have browser-safe URL's on or off...

Edited by katiediddesign

Share this post


Link to post
Share on other sites

First of all - you won't see the SID if the user's session accepted the cookie. This contribution helps in the cases where there is no session cookie and the SID has to be passed in the URL.

 

Are you seeing the osCAdmin ID in the text of the description box or when you mouse over the link in the preview? The latter won't do anything useful (though I'm puzzled as to how the osCAdmin ID would end up there.)

 

To test this, restart your browser, disable accepting cookies and visit your store as a customer. Note that the osCID will be passed along in the URLs. Go to one of your product descriptions that contains a link. The osCID should be present there too.

Share this post


Link to post
Share on other sites

Thanks for your time on this...

 

I started my other computer and disabled all cookies, and I saw the session ID's up in the URL, just like you said, so thanks for explaining that... and now that I can see and compare the session ID's, I can see that the link appears to be working fine... apparantly the browser over-rides the osCAdmin that's hard-coded into the link, with the visitor's current one. I don't understand this, but if it works, then that's okay, I guess... there's plenty about this thing that I don't understand yet anyway.

 

So, for information and clarity, I'm NOT seeing the osCAdminID when I mouseover the link when I go there as a visitor... I see the same osCid that's up in the URL. But I DO see the osCAdminID when I mouse over it in admin on the "preview" screen that you get as you're submitting your description in OSC admin, AND when I go back to view the description field... on both computers.

 

That's when it's being added... in admin when you click "Preview." I click on my product in the catalog section of admin, and click "edit." I go to the description field and insert my link as per your example, just changing the product id to the correct one, Then I scroll down and click "Preview" and it's added at that moment, because if I click "Back" from that screen to go back to my description, the osCAdminID has been added already to the HTML in the product description. So it's there, but apparantly the browser isn't having any problem writing over it.

 

I'll assume that it doesn't matter then, unless you know of some reason that this might mess up a customer's cart.

Share this post


Link to post
Share on other sites

The browser would not "override" the osCAdmin, but I can't think of how it seems to be getting into the link at all.

 

Would you mind sending me a PM with the URL of your store and a sample page that uses the link? I'd like to take a look at it from that side.

 

What exactly are you inserting in the description field? And how are you doing this?

Share this post


Link to post
Share on other sites
The browser would not "override" the osCAdmin, but I can't think of how it seems to be getting into the link at all.

 

Would you mind sending me a PM with the URL of your store and a sample page that uses the link?  I'd like to take a look at it from that side.

 

What exactly are you inserting in the description field?  And how are you doing this?

 

I'm having the exact same issues when editing the Product Description. If I enter my own HTML the first time around the link is ok. If I need to go back and edit the Product description the darn osCAdmin has been automatically added. This was not happening before, but I don't recall making any changes whatsoever to the osCommerce setups. :(


Chris

Share this post


Link to post
Share on other sites

I never did find out exactly what was happening with KatieDid, but I did discover that something on the web server was automatically inserting the osCadminID in links when I downloaded one of the PHP files through File Manager (which I normally don't use and recommend against leaving on the site, but it was what I had.) It was bizarre - and each time I downloaded a file, my current osCadminID, no matter what it was, was sprinkled throughout the file in URLs, always before a ">.

 

It was not my contribution doing it (which wasn't even being called in this context) - something on the server used in the "editing" process was doing it. Needless to say it doesn't happen on my sites. I could not find anything in the site files that might be involved. I was stumped.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×