Add php Links with Session ID | Last Update: 22nd November, 2005 Article ID: 252 |
- Introduction
- Graphic Links
- Link Graphic to Individual Product ID
- Link Graphic to Page
- Text Links
Introduction
A regular graphic for a product in the right or left columns may be used for design purposes which would be linked to the product of that graphic. When this graphic is linked up it should carry with it the "session id" so the customer can shop and purchase from this link. If you don't want to have the session ID in the url, you will need to enable the force cookie usage option in the store admin. The preference is to link up correctly.
Graphic Links
- Link Graphic to Individual Product ID
- Link Graphic to Page
Adding php links to a regular graphic uses the tep_href_link() function which is what carries the session id.
Link Graphic to Individual Product ID
<?php echo '<p><a href="' . tep_href_link('product_info.php', 'cPath=1&products_id=1') . '"><img src="images/graphic.jpg" alt="Graphic" name="graphic_name" width="66" height="100" border="0" id="graphic_name"></a></p>'; ?>
Note: This only works on a php page.
Link Graphic to Page
<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'graphic.jpg', 'graphic text') . '</a>'; ?>
Text Links
Text links can be added a couple of ways which is a matter of preference.
<?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT) . '">' . 'CHECKOUT' . '</a>'; ?>
Or like this:
<a href="<?php echo tep_href_link(FILENAME_CHECKOUT, '', 'SSL'); ?>" class="links"><?php echo HEADER_TITLE_CHECKOUT; ?></a>