Page 1 of 1

Creating a third checkout "Pickup from store" after Register account and Guest checkout options

Posted: Tue Sep 25, 2018 8:27 pm
by broopenc3
I am trying to create a third checkout option after Register account and guest checkout.
I will name it Pickup from store.
What I have done so far:

Step 1)
Here: /catalog/view/theme/default/template/checkout/checkout.twig
I found on line 145 (url: 'index.php?route=checkout/' + $('input[name=\'account\']:checked').val(),)
So my thoughts are to insert another option to account variable to redirect to another page.

Code: Select all

// Checkout
$(document).delegate('#button-account', 'click', function() {
    $.ajax({ //line 146
        url: 'index.php?route=checkout/' + $('input[name=\'account\']:checked').val(), //line 147
        dataType: 'html',
Step 2)
Here /catalog/view/theme/default/template/checkout/login.twig
in line 13 onwards the file is edited as follows in order to create another radiobutton with the variable of account and the value of "guest_store".

Code: Select all

    {% if checkout_guest %}
    <div class="radio">
      <label> {% if account == 'guest' %}
        <input type="radio" name="account" value="guest" checked="checked" />
        {% else %}
        <input type="radio" name="account" value="guest" />
        {% endif %}
        {{ text_guest }}</label>
    </div>
    <div class="radio">
      <label> {% if account == 'guest' %}
        <input type="radio" name="account" value="guest_store" checked="checked" />
        {% else %}
        <input type="radio" name="account" value="guest_store" />
        {% endif %}
        {{ text_guest_store }}Chekout from store</label> //created and set the variable in the language file. I write this here just for clarity.
    </div>
    {% endif %}
Step 3)
If I am correct (apparently I am not) if the third radiobutton is selected and the button is pressed then it should redirect to:
"/index.php?route=checkout/guest_store". So I did the following:
In: /catalog/controller/checkout
I duplicated the file "guest.php" and renamed it to "guest_store.php"

So finally the second step of the checkout should be redirected to show whatever the "guest_store.php" file has there but unfortunately I get an error 500

GET mystore.com/index.php?route=checkout/guest_store 500 (Internal Server Error)
send @ jquery-2.1.1.min.js:4
ajax @ jquery-2.1.1.min.js:4
(anonymous) @ index.php?route=checkout/checkout:1048
dispatch @ jquery-2.1.1.min.js:3
r.handle @ jquery-2.1.1.min.js:3

The: (anonymous) @ index.php?route=checkout/checkout:1048 as I see from chrome console, refers to the ajax code line in: /catalog/view/theme/default/template/checkout/checkout.twig in line 146

Code: Select all

$(document).delegate('#button-account', 'click', function() {
    $.ajax({ //line 146
        url: 'index.php?route=checkout/' + $('input[name=\'account\']:checked').val(),
        dataType: 'html',
If I delete the file I duplicated "guest_store.php" I get a 404 error, so I guess I placed the file corectly (later I will edit the guest_store.php file to fit my needs). Any ideas about this issue? Do I need to post more details? Thanx in advance dear opencartians ;)

Re: Creating a third checkout "Receive from store" after Create account and guest checkout.

Posted: Wed Sep 26, 2018 1:57 am
by IP_CAM
well, there would be easier ways, to achieve such, I assume... ;)
Ernie
---
https://www.opencart.com/index.php?rout ... in%20store
---

Re: Creating a third checkout "Receive from store" after Create account and guest checkout.

Posted: Wed Sep 26, 2018 3:04 pm
by broopenc3
IP_CAM wrote:
Wed Sep 26, 2018 1:57 am
well, there would be easier ways, to achieve such, I assume... ;)
Ernie
---
https://www.opencart.com/index.php?rout ... in%20store
---
Certainly there are other ways and probably easier ways. Unfortunately, I have not found anything easier and none of these extensions do what I want. The final goal is to have a custom Step 2 in the checkout where I can hard code some of the details. The custom Step 2 ideally comes from choosing a separate radio button in Step 1. Thank you for the suggestion!