Post by broopenc3 » Tue Sep 25, 2018 8:27 pm

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 ;)
Last edited by broopenc3 on Wed Sep 26, 2018 4:05 pm, edited 1 time in total.

New member

Posts

Joined
Fri Mar 16, 2018 7:09 pm

Post by IP_CAM » 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
---

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by broopenc3 » Wed Sep 26, 2018 3:04 pm

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!

New member

Posts

Joined
Fri Mar 16, 2018 7:09 pm
Who is online

Users browsing this forum: No registered users and 13 guests