Post by luke » Thu Sep 17, 2009 8:03 am

I want to move the location of the checkout button to the bottom of the right column. Does anyone know an easy way to do this? I tried moving the code manually, but it threw an error. Thanks!

Newbie

Posts

Joined
Thu Aug 27, 2009 1:30 pm

Post by nosleephotel » Thu Sep 24, 2009 8:01 am

I'm trying to do the same thing. I would like to have a "Check Out" button in the check out module. When I copy the check out code from header.tpl to cart.tpl I get the error below. I'm not well versed in PHP so maybe someone can point out the quick fix?

Code from header.tpl

Code: Select all

<a href="<?php echo $checkout; ?>"><img src="catalog/view/theme/default/image/icon_checkout.png" alt="" /><?php echo $text_checkout; ?></a>
Error message when viewed in browser
checkouterror.jpg

Error from trying to put Check Out link in check out module. - checkouterror.jpg (26.27 KiB) Viewed 4303 times


User avatar
New member

Posts

Joined
Sat Sep 19, 2009 5:25 am
Location - Los Angeles, CA

Post by fido-x » Thu Sep 24, 2009 10:56 am

Besides adding the above code from your header.tpl, you will also need to add the following lines to "catalog/controller/module/cart.php":-

Code: Select all

$this->data['text_checkout'] = $this->language->get('text_checkout');
$this->data['checkout'] = $this->url->https('checkout/shipping');
and then add the following to "catalog/language/english/modue/cart.php":-

Code: Select all

$_['text_checkout'] = 'Checkout';
Hope this helps.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by nosleephotel » Thu Sep 24, 2009 1:18 pm

fido-x, that did the trick thanks! Now, one question--don't hate me! haha ::) I would like to use the same green button css id and class and have it say "Checkout". I found this code in product.tpl

Code: Select all

<a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
When I tried adding id="add_to_cart" class="button" and the span html tags like it is above, it displays it fine but when I click it, it gives me this error:

Code: Select all

Notice: Undefined index: product_id in /vservers/survivalstrat/htdocs/store/catalog/controller/module/cart.php on line 59Notice: Undefined index: quantity in /vservers/survivalstrat/htdocs/store/catalog/controller/module/cart.php on line 59
I'm not well versed in PHP so I'm not sure why the CSS and HTML span tags would create an error. Your advice, fido-x?

User avatar
New member

Posts

Joined
Sat Sep 19, 2009 5:25 am
Location - Los Angeles, CA

Post by fido-x » Thu Sep 24, 2009 4:36 pm

The error you're getting is not coming from the CSS or HTML, it was caused by using an AJAX submit when there was nothing to submit.

The correct code to use for your button would be-

Code: Select all

<a onclick="location='<?php echo $checkout; ?>'" class="button"><span><?php echo $text_checkout; ?></span></a>
That should give you the green button with the word "Checkout" appearing on it.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by nosleephotel » Fri Sep 25, 2009 12:32 am

Eureka! Thanks a bunch, fido!

User avatar
New member

Posts

Joined
Sat Sep 19, 2009 5:25 am
Location - Los Angeles, CA

Post by sdqworm » Thu Oct 01, 2009 2:20 pm

Thank you fido! now i need to add an update button and check boxes next to each items so remove it quickly

Newbie

Posts

Joined
Mon Jul 27, 2009 2:31 am

Post by nosleephotel » Tue Oct 06, 2009 5:35 am

Uh oh, one final tweak needed. Maybe you can answer, fido. When I click Add to Cart for an item, the jQuery effect takes place and the Checkout module updates with the item name and price but the new "Checkout" button disappears. If refresh it's there but that's not practical. Is there an additional file I need to put the button code so it is still there after the jQuery effect? Thanks.

User avatar
New member

Posts

Joined
Sat Sep 19, 2009 5:25 am
Location - Los Angeles, CA

Post by fido-x » Tue Oct 06, 2009 4:21 pm

You could try adding the following to the callback() function in "catalog/controller/module/cart.php":-

Code: Select all

$output .= '<a onclick="location=' . $this->url->https('checkout/shipping') . '" class="button"><span>' . $this->language->get('text_checkout') . '</span></a>';
before

Code: Select all

$this->response->setOutput($output);
near the end of the file.

Don't know if it will work though.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by nosleephotel » Wed Oct 07, 2009 9:58 am

Viola! Seems to do the trick. Thanks fido!

Edit: Is there an easy way to compile all this to make it a contribution? Maybe other people would like to easily add this functionality.

User avatar
New member

Posts

Joined
Sat Sep 19, 2009 5:25 am
Location - Los Angeles, CA

Post by fido-x » Wed Oct 07, 2009 11:59 am

nosleephotel wrote:Viola! Seems to do the trick. Thanks fido!
Glad to hear it worked.
Edit: Is there an easy way to compile all this to make it a contribution? Maybe other people would like to easily add this functionality.
Done! Now available as a module from contributions http://www.opencart.com/index.php?route ... ion_id=259

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by nosleephotel » Wed Oct 07, 2009 12:03 pm

Wow, fast work, fido! Kudos. One suggestion, reading "This module (or modification) provides a "Checkout" button in your shopping cart." it's not totally clear how this is different from the "Checkout" in the top nav thus beneficial. I would modify it to say "This module (or modification) provides a "Checkout" button in your Cart module."

User avatar
New member

Posts

Joined
Sat Sep 19, 2009 5:25 am
Location - Los Angeles, CA

Post by fido-x » Wed Oct 07, 2009 12:11 pm

nosleephotel wrote:Wow, fast work, fido! Kudos.
Easy enough, it was only 3 files anyway!
One suggestion, reading "This module (or modification) provides a "Checkout" button in your shopping cart." it's not totally clear how this is different from the "Checkout" in the top nav thus beneficial. I would modify it to say "This module (or modification) provides a "Checkout" button in your Cart module."
Good point. Should have thought of that when I uploaded - bit late to do it now!

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by nosleephotel » Wed Oct 07, 2009 12:23 pm

I guess so. No edit function on the contribution section I see. Maybe another version of the contrib. >:D

User avatar
New member

Posts

Joined
Sat Sep 19, 2009 5:25 am
Location - Los Angeles, CA

Post by fido-x » Wed Oct 07, 2009 12:28 pm

nosleephotel wrote:I guess so. No edit function on the contribution section I see. Maybe another version of the contrib. >:D
As it turned out, I forgot to center the button and add a margin above it anyway.

Fixes applied and updated on contributions.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by nosleephotel » Wed Oct 07, 2009 12:40 pm

Well done, fido!

User avatar
New member

Posts

Joined
Sat Sep 19, 2009 5:25 am
Location - Los Angeles, CA

Post by Donce » Wed Oct 07, 2009 1:15 pm

nosleephotel, does it fixes "problems" you mentioned? cause i had them too..

Fido-x, thank you very much..

New member

Posts

Joined
Fri Aug 28, 2009 8:22 pm

Post by nosleephotel » Wed Oct 07, 2009 1:18 pm

Yes, you should be good, Donce.

fido, did you write simple instructions on what files to replace?

User avatar
New member

Posts

Joined
Sat Sep 19, 2009 5:25 am
Location - Los Angeles, CA

Post by fido-x » Wed Oct 07, 2009 1:24 pm

nosleephotel wrote:fido, did you write simple instructions on what files to replace?
Yes, I certainly did!

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by nosleephotel » Wed Oct 07, 2009 2:30 pm

Thought so. So, you should be good to go Donce.

User avatar
New member

Posts

Joined
Sat Sep 19, 2009 5:25 am
Location - Los Angeles, CA
Who is online

Users browsing this forum: No registered users and 20 guests