Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Newbie Question (Hyplerlinks with dynamic content)


drakonan

Recommended Posts

Hello, I'm wanting to put a hyperlink in the description for another product. Do I have to worry about any issues that'd cause this to "mess up"?

 

Or do i just do what seems natural and just copy the link from what my browser tells me...

 

As I type this it sounds like a really dumb question, but what "scares" me is that by clicking the link the customer will lose his shoppnig cart contents or something to that effect.

 

Ahead of time, thanks for the answer.

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

Here is some code that was very useful for me, I made a cheat sheet, cause I too am a newbie...

 

Link an image into a page...

<?php echo tep_image(DIR_WS_IMAGES . 'some_picture.jpg'); ?>

 

Image with dimensions:

<?php echo tep_image(DIR_WS_IMAGES . 'some_image.jpg', 'altname_name', 'width_here', 'height_here'); ?>

 

Image that you can click as a link:

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'some_picture.gif', 'alt_description', 'width_here', 'height_here') . '</a>'; ?>

 

A link to a dynamic page in the cart files:

<?php echo '<a href=" ' . tep_href_link(FILENAME_whateverdefined inapplicationtop, 'optional?params', 'NONSSL') . ' "> link description </a>'; ?>

 

Chew on those for a little bit and experiment... that is what I did when I first started out. You can see throughout OS commerce these type of references being used.

 

FYI... above in some of the examples that I provided, you will notice that there are references to "FILENAME_DEFAULT", "DIR_WS_IMAGES", etc. these are defined paths and files that are located in various places... mostly in the application_top.php file in the /catalog/includes/ directory...

 

If anyone else wants to post to clarify my explanation, feel free... like I said I am a newbie myself... just figured out some of this on my own and through searching this fine message board for answers (Always search the boards first! You will almost alway find your answer faster than people will respond to your posts - I am just feeling good today and thought I would do my good deed for the day :) ).

Link to comment
Share on other sites

I'm having a good day myself. It seems that I've got a lot done, with little human error and I'm going to go live soon. Thanks again for the help. After all of this is done, I should have a good 200 posts on this board. :D

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

Ok, I'm not sure I understand how to link the categories...

 

So far, I just the hyperlink

 

mysite.com/catalog/default.php/cPath/40_67

 

Is that ok?

 

Or how would you translate that to PHP?

- - - -

Sometimes, ignorance is bliss.

Link to comment
Share on other sites

I personally do the extra work and create definitions in the application_top.php file in catalog/includes/

 

I first make myself a definition like:

define('FILENAME_TABLETOP_GAMES', 'default.php?cPath=34_45');

 

Then I use the link format I gave you above:

 

<?php echo '<a href="' . tep_href_link(FILENAME_TABLETOP_GAMES) . '">'; ?>Table-Top RPG</a>

 

This creates a link to the "Table-Top Games" category that I have in my shopping cart. Of course this just adds to the sork, but the "dynamic links" are kept in the code and not hard coded.

 

Hope this helps... sorry I took so long to get back to you

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...