Add Back Button on Checkout Pages

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
12 years 2 months ago #63243

How do I add a "Back" button on the checkout pages please? My pages currently have "Continue Shopping" and "Next" buttons but I would also like to add a "Gack Button.

<a href="#" onclick="history.back();return false;">Go back</a>

Thank you!!

The following user(s) said Thank You: Lutya

Please Log in or Create an account to join the conversation.

  • Posts: 82726
  • Thank you received: 13342
  • MODERATOR
12 years 2 months ago #63464

You can edit the file "step" of the view "checkout" via the menu Display->Views and add your code there.

Best regards,
Nicolas

The following user(s) said Thank You: Lutya

Please Log in or Create an account to join the conversation.

  • Posts: 72
  • Thank you received: 4
12 years 1 month ago #65542

Hi Nikolas,

I'm also trying to figure out how could I get the "back" button on my checkout page, but I'm not so clever to get how to place that code. Could you please explain that in little more detailed way? Is this just to simply put it at whatever place within file?..
Thank you!

Please Log in or Create an account to join the conversation.

  • Posts: 82726
  • Thank you received: 13342
  • MODERATOR
12 years 1 month ago #65732

Hi,

You can't put it randomly in the file. But you can always try and if it doesn't work like you want, move it somewhere else and try again.
The simplest is to put it at the top or the bottom of the file and it will display the link at the top or at the bottom of the checkout.

Please Log in or Create an account to join the conversation.

  • Posts: 18
  • Thank you received: 0
12 years 1 week ago #72011

Hi,

I am also trying to place a Back button on the confirmation page before the customer hits the buy now button. I've found the code to use from previous posts, but still not sure where in the step view to place it. I've tried a few different places, but it either displays both the Continue Shopping button and the Back button next to each other, or the back button replaces the Continue shopping button on all checkout pages. Is there a specific place to put this?

Many thanks,

Please Log in or Create an account to join the conversation.

  • Posts: 82726
  • Thank you received: 13342
  • MODERATOR
12 years 1 week ago #72370

Hi,

You should simply add it at the top of the file.

Please Log in or Create an account to join the conversation.

  • Posts: 18
  • Thank you received: 0
12 years 1 week ago #72518

Thanks, but I would like to replace the "Continue Shopping" button with a "Back" button on the Confirmation page only so that if a customer needs to update something they can go back to their cart to make that change. However I would like only the "Continue Shopping" button to remain on the previous checkout pages.

Is this possible?

Please Log in or Create an account to join the conversation.

  • Posts: 82726
  • Thank you received: 13342
  • MODERATOR
12 years 6 days ago #72781

Everything is possible. There is however a bit more complex as you need to know if you're on the last step or not.
Then, you can just display the normal continue button:
echo $this->cart->displayButton(JText::_('CONTINUE_SHOPPING'),'continue_shopping',$this->params,JRoute::_($this->continueShopping),'window.location=\''.JRoute::_($this->continueShopping).'\';return false;','id="hikashop_checkout_shopping_button"');
or your back button.

Here is more information on all that:
www.hikashop.com/en/forum/4-how-to/13429...der-in-checkout.html

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 1
10 years 1 month ago #174183

Hi there, I too was looking to add the 'Back' button to the checkout pages (even though you can still click on the checkout workflow links to go back). However, after looking at a couple of posts, I have merged other solutions to come up with this addition within the checkout/step.php code just before the </form> tag (hikashop version 2.3.3):

        $checkout_back_button = JText::_('HIKA_BACK');
        if($this->step!=0){
            echo $this->cart->displayButton($checkout_back_button,'back',$this->params,hikashop::currentUrl(),'history.back();return false;','id="hikashop_checkout_back_button"');
        }

Also, in order to float it left, I added this to my hikashop stylesheet - frontend_bluegrass.css file (this is just a modified version of media/com_hikashop/css/frontend_default.css):
#hikashop_checkout_back_button {
	float:left;
}

And it looks like the other button styles and sits to the left of the Continue Shopping button. Hope this helps others also.

The following user(s) said Thank You: Xavier

Please Log in or Create an account to join the conversation.

  • Posts: 55
  • Thank you received: 4
10 years 2 weeks ago #175694

I followed the instructions from last year and it worked great. I've just upgraded to the latest version and would now like to have the "Next" and "Back" buttons formatted by the template, like the "New" button for addresses (see image, which shows template formatted "New" button and plain "Next" button).

I can change the formatting of "Next" using Firebug by changing type="submit" to type="button", but I can't figure out how do do that permanently within the HikaShop php or css codes.

Thanks.

Dave

Attachments:
Last edit: 10 years 2 weeks ago by av.opticom.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 2 weeks ago #175699

Hi,

You have to add new css properties in the hikashop frontend css file or directly in your template file on the following ids:

#hikashop_checkout_back_button, #hikashop_checkout_next_button{
  /* Your properties */
}

You can get the template properties thanks to firebug and use it for the given ids.

hikashop.com/support/support/documentati...ize-the-display.html

Please Log in or Create an account to join the conversation.

  • Posts: 55
  • Thank you received: 4
10 years 2 weeks ago #175856

Hi Xavier,

Thanks for your quick reply. I couldn't get your suggestion to work, but you gave me the idea to copy the template CSS for buttons into the front-end CSS custom file of Hikashop like this:

#hikashop_checkout_next_button{
  background:#265c91 url(../images/submitbutton_02.png) repeat-x;
  border: 1px solid transparent;
  padding: 4px 6px;
  border-radius: 6px;
  color: #fff;
  float:right;
}

From what I see in the CSS of the template the buttons should have been formatted like the others, but I have no explanation why they're not. Thanks again!

Dave

Last edit: 10 years 2 weeks ago by av.opticom.

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
9 years 11 months ago #181900

I know this is an old thread but I added the code:

$checkout_back_button = JText::_('HIKA_BACK');
        if($this->step!=0){
            echo $this->cart->displayButton($checkout_back_button,'back',$this->params,hikashop::currentUrl(),'history.back();return false;','id="hikashop_checkout_back_button"');
        }

and on some (not all) of the checkout steps I get the browser error/warning: "Confirm Form Resubmission" ... is there a better solution to this?

Thanks!
Dave

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 11 months ago #181953

Hi,

Another solution could be to get the current url and replace the step number to the prevous number instead of doing a "history.back()".
If the url is mydomain.com/checkout/step-2 so replace it by mydomain.com/checkout/step-1 and redirect to this address with some javascript.

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
9 years 11 months ago #182028

ended up adding the following code which seems to work

if ( $this->step!=0 ){
          echo '<a class="btn button hikashop_cart_input_button" id="hikashop_checkout_back_button" href="' . hikashop_completeLink('checkout&task=step&step='.($this->step-1)) . '">' . JText::_('HIKA_BACK') . '</a>';
 }

Please Log in or Create an account to join the conversation.

Time to create page: 0.146 seconds
Powered by Kunena Forum