Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can somebody please decipher this line of code?


Urbluffingme

Recommended Posts

I want to link the continue shopping button to the main products page. The code for this is confusing me. Can somebody help me out?

 

<?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?>

Link to comment
Share on other sites

As it is, its just putting the customer back to the page they came from when they pressed "buy now". Obviously thats different for every page in shop, hence the code looking complicated.

 

Just going back to the front page is a static URL, so something like this should work:

 

<?php echo '<a href="default.php">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?>

 

If youre using MS2 I think you should replace the default.php with index.php ?

Does this smell like chloroform to you?

Link to comment
Share on other sites

if i'm reading that code right, it's just a back button. you need to make it point to the main product page, not the previous page.

 

<?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?>

 

if you wanted to have it point at the index page (main product page??)

change to something like this (i assume, but you know what that makes me) :D

 

<?php echo "<a href=' . tep_href_link(DIR_FS_CATALOG . 'index.php') ' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?>

Link to comment
Share on other sites

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?>

 

this is what i pulled out of shopping_cart.php for the continue shopping button. it has nothing in it about sessions or oscid or anything like that. it's just a link.

 

however, it seems as though this is exactlty what you are looking to do. it's the default, what needs to be changed?? i guess i must be missing something <_<

Link to comment
Share on other sites

ok, try this!

 

change:

<?php

$back = sizeof($navigation->path)-2;

if (isset($navigation->path[$back])) {

?>

<td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>

 

to:

<?php

$back = sizeof($navigation->path)-3;

if (isset($navigation->path[$back])) {

?>

<td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>

 

that should do the trick!

Link to comment
Share on other sites

<?php echo "<a href=' . tep_href_link(DIR_FS_CATALOG . 'index.php') ' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?>

You would never use a DIR_FS in a tep_href_link. DIR_FS is for file system paths. In tep_href_link, you want to use DIR_WS variables, if anything. The other code should work:

<?php echo "<a href=' . tep_href_link(FILENAME_DEFAULT) ' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?>

Hth,

Matt

Link to comment
Share on other sites

you are absolutly right matt. it should have been WS not FS.

 

the second code i posted will return him to index.php, but he says he loses his cart.

 

the last code i posted should step him back through the file path. the higher the number, the farther back you go in the path.

 

example:

index -> foo -> bar -> shopping_cart (continue shopping)

 

with it set at -2 it would return you to bar

with it set at -3 it would return you to foo

 

atleast, that's how it should work.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...