Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Continue Shopping Send to Specific Page


polpower

Recommended Posts

Good Day:

 

on the page shopping_cart.php page there is a Continue Shopping button. If a customer clicks on that they only get sent back 2 pages from where they are. That can get confusining to them especially if they have been navigating around either creating an account or PWA pages.

 

How do I rewrite the code below from shopping_cart.php so I can send them back to the first page of the shopping cart (index.php) if they click on the Contiue Shopping button.

 

Code:

 

<?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>

<?php

}

?>

 

Thanks in advance for your help

 

Dave

Link to comment
Share on other sites

MAKE A BACKUP.

 

<?php
// $back = sizeof($navigation->path)-2;
// if (isset($navigation->path[$back])) {
?>
<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '', $request_type) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>
<?php
// }
?>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

  • 3 months later...
<?php
// $back = sizeof($navigation->path)-2;
// if (isset($navigation->path[$back])) {
?>
<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT,'cPath=' . $current_category_id, $request_type) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>
<?php
// }
?>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Thank you for the reply and suggestion. I tried modifying the code in shopping_cart.php as you suggested but $current_category_id is set to 0 no matter what product has been selected from any category (there are 4 in my store).

 

Did I misunderstand your suggestion?

 

I would appreciate any additional advice you can provide.

 

Thanks again . . . Mike

Link to comment
Share on other sites

Try this:

 

<?php
 $back = sizeof($navigation->path)-2;
 if (isset($navigation->path[$back])) {
$cs = tep_get_product_path( $products[ sizeof($products) - 1 ]['id'] );
?>
 <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT,'cPath=' . $cs, $request_type) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>
<?php
 }
?>

I tried this and it seemed to work for me.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Thank you so much for taking the time to send another suggestion.

 

I tried it but it did not work for me - probably a difference in our environments.

 

I implemented your original suggestion and just return the visitor to the home page. That works perfectly.

 

Thanks again . . . Mike

Link to comment
Share on other sites

If you have a fairly standard osC install then simply changing the following line should take you back to the category of the product rather than the product page itself:

 

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

Edit to become:

 

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

The original code doesn't actually take the user 2 pages back, it only takes the user 1 page back. This is because how the $navigation->path array is defined. The starting number is 0 much like most arrays, so in order to actually get x pages back you must increment x by 1.

Link to comment
Share on other sites

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

I tried that.

 

BUT....

 

In my shop, sizeof($navigation->path) was never larger than 2 so it wouldn't work.

 

Like I said, the code I posted worked for me.

 

Go figure...

:huh:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...