Post by IP_CAM » Mon Mar 18, 2019 6:38 am

Yep...and nobody give you to buy a beer.
:laugh:

Well, OC is an Shopping Software, not a Donation Script, and whoever comes here,
plans to create Money, but not to spend it. And especially not those, who don't
drink Beer themselfs. :drunk:

That's why I have removed almost all converted extension (50-60) from marketplace
:P

OC Enthusiasm likely disappears, after a while, beeing confronted with daily reality.
And better don't take it personal, it happened to many OC-Contributors before.
But in a Place, mostly 'populated' by Code-Resellers, but only a few real OC Users,
one just cannot expect something like 'common Solidarity', it's as easy as that. ::)

So, take it, as it comes. And as long as one can 'take out' at least as much, as one
'put's back in', it's still a 'balanced' Act, kind of, not only wasted time and spirit.
Compare it with a bottle of beer, either half empty already, or still half full, it only
depends on your feelings and mood ;)

Ernie
---
https://www.quora.com/Sometimes-I-feel- ... l-the-time

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

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

Post by straightlight » Mon Mar 18, 2019 7:41 am

Issue found. The user is using 3 pages of OCMod extensions on his store. Clearly, it is one of them that shows this error message regarding the checkoutsimple TWIG file that is missing.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by xxvirusxx » Fri Mar 22, 2019 4:59 pm

IP_CAM wrote:
Mon Mar 18, 2019 6:38 am
Well, OC is an Shopping Software, not a Donation Script, and whoever comes here,
plans to create Money, but not to spend it. And especially not those, who don't
drink Beer themselfs. :drunk:
Maybe a juice :laugh:
I can upload all my converted extension as paid...and users will force to buy if needed.
straightlight wrote:
Mon Mar 18, 2019 7:41 am
Issue found. The user is using 3 pages of OCMod extensions on his store.
lol

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by fegdeed » Thu Mar 28, 2019 1:47 am

@xxvirusxx I don't understand "catalog files need to be moved in Total", and @straightlight I don't know where that checkoutsimple.twig is coming from either.

Image
Get a secure, fast, and reliable web hosting service from https://turnuphosting.com.


Active Member

Posts

Joined
Fri Sep 21, 2018 12:01 am

Post by IP_CAM » Thu Mar 28, 2019 8:20 am


My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

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

Post by xxvirusxx » Thu Mar 28, 2019 3:04 pm

fegdeed wrote:
Thu Mar 28, 2019 1:47 am
@xxvirusxx I don't understand "catalog files need to be moved in Total",
straightlight wrote:
Fri Mar 15, 2019 6:23 am
In your catalog/controller/extension/checkout/charity.php file, use the following:
Should be catalog/controller/extension/total/charity.php and catalog/model/extension/total/charity.php isn't converted yet..

In catalog/model/extension/total/charity.php, should be

Code: Select all

<?php
class ModelExtensionTotalCharity extends Model {

    public function getTotal($total) {
        $this->load->language('extension/total/charity');

        if (!$this->cart->hasProducts()) {
            unset($this->session->data['charity']);
            unset($this->session->data['order_id']);
        }

        if (isset($this->session->data['charity']) && $this->config->get('total_charity_status')) {
            $gift = $this->config->get('total_charity_gift');
            $donation = $this->session->data['charity'];

            if ($this->session->data['giftaid'] == '1') {
                $ga = $this->language->get('text_yes');
            } elseif ($this->session->data['giftaid'] == '0') {
                $ga = $this->language->get('text_no');
            } elseif ($this->session->data['giftaid'] == 'no') {
                $ga = $this->language->get('text_thanks');
            };

            if ((float)$donation == '0') {
                $total['totals'][] = array(
                    'code' => 'charity',
                    'title' => $this->language->get('text_no_donation'),
                    'text' => '',
                    'value' => $donation,
                    'sort_order' => $this->config->get('total_charity_sort_order')
                );
            } else {
                $total['totals'][] = array(
                    'code' => 'charity',
                    'title' => $ga,
                    'text' => '+' . $this->currency->format($donation),
                    'value' => $donation,
                    'sort_order' => $this->config->get('total_charity_sort_order')
                );

                $total['total'] += $donation;
            }
        }
    }

}
And charity.twig from catalog... it has a wrong line

wrong

Code: Select all

{% if not charity_gift }}
correct

Code: Select all

{% if not total_charity_gift %}
and this

Code: Select all

url: 'index.php?route=checkout/charity/charity',
to this

Code: Select all

url: 'index.php?route=extension/total/charity/charity',
Debugging :lol:
Last edited by xxvirusxx on Fri Mar 29, 2019 1:55 am, edited 1 time in total.

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by straightlight » Thu Mar 28, 2019 5:56 pm

Correct. I have now modified my post to point to the instructions addressed above.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by fegdeed » Fri Mar 29, 2019 12:53 am

Thanks @IP_CAM, @xxvirusxx and @Straightlight. @xxvirusxx check these two files below to see if its the same as yours.
In catalog > controller > extension > total > charity.php file, do you have the code below?

Code: Select all

<?php

class ControllerTotalCharity extends Controller {

    public function index() {
        if ($this->config->get('charity_status')) {
            $this->load->language('checkout/charity');

            $data['text_ccode'] = $this->config->get('config_currency');

            $data['text_csymbol'] = $this->currency->getSymbolLeft($data['text_ccode']);

            if (empty($data['text_csymbol'])) {
                $data['text_csymbol'] = $this->currency->getSymbolRight($data['text_ccode']);
            }

            $data['heading_title'] = $this->language->get('heading_title');

            $data['text_loading'] = $this->language->get('text_loading');

            $data['entry_charity'] = $this->language->get('entry_charity');

            $data['button_charity'] = $this->language->get('button_charity');

            $data['text_giftaid'] = $this->language->get('text_giftaid');

            $data['head_title'] = $this->language->get('head_title');

            $data['text_currency'] = $this->language->get('text_currency');

            if (isset($this->session->data['charity'])) {
                $data['charity'] = $this->session->data['charity'];
            } else {
                $data['charity'] = '';
            }

            if ($this->config->get('charity_gift')) {
                $data['charity_gift'] = $this->config->get('charity_gift');
            } else {
                $data['charity_gift'] = '';
            }

            if ($this->config->get('charity_name')) {
                $data['charity_name'] = $this->config->get('charity_name');
            } else {
                $data['charity_name'] = '';
            }

            if (isset($this->request->get['redirect']) && !empty($this->request->get['redirect'])) {
                $data['redirect'] = $this->request->get['redirect'];
            } else {
                $data['redirect'] = $this->url->link('checkout/cart');
            }

            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/total/charity.twig')) {
                return $this->load->view($this->config->get('config_template') . '/template/total/charity.twig', $data);
            } else {
                return $this->load->view('theme/default/template/extension/total/charity.twig', $data);
            }
        }
    }

    public function charity() {
        $this->load->language('checkout/charity');

        $json = array();

        if (isset($this->request->post['charity'])) {
            $charity = $this->request->post['charity'];
        } else {
            $charity = '';
        }

        if (isset($this->request->post['gifta'])) {
            $giftaid = $this->request->post['gifta'];
        } else {
            $giftaid = '';
        }

        if (empty($charity) && ($charity !== '0')) {
            $json['error'] = $this->language->get('error_empty');
        } elseif ($charity <= '-0.01') {
            $json['error'] = $this->language->get('error_minus');
        } elseif (!is_numeric($charity)) {
            $json['error'] = $this->language->get('error_number');
        } elseif ($charity || $charity == '0') {
            $this->session->data['charity'] = $this->request->post['charity'];
            $this->session->data['giftaid'] = $giftaid;
            $this->session->data['success'] = $this->language->get('text_success');

            $json['redirect'] = $this->url->link('checkout/cart');
        } else {
            $json['error'] = $this->language->get('error_empty');
        }

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode($json));
    }

}


And in catalog > view > theme > default > template > extension > charity.twig , do you have this code?

Code: Select all

<div class="panel panel-default">
    <div class="panel-heading">
        <h4 class="panel-title"><a href="#collapse-charity" data-toggle="collapse" data-parent="#accordion" class="accordion-toggle"><?php printf($head_title,$charity_name); ?> <i class="fa fa-caret-down"></i></a></h4>
    </div>
    <div id="collapse-charity" class="panel-collapse collapse">
        <div class="panel-body">
            <p><?php printf($text_currency,$text_ccode) ?></p>
            <form class="form-horizontal">
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-charity"><?php echo $text_csymbol; ?></label> 
                    <div class="input-group">
                        <input type="text" name="charity" value="<?php echo $charity; ?>" placeholder="<?php echo $entry_charity; ?>" id="input-charity" class="form-control" />
                    </div>
                </div>
                <div class="form-group">
                    <?php if (empty($charity_gift)) { ?>
                    <div style="display: none;">   
                    <input id="ga" type="radio" name="gifta" value="no" checked />
                    </div>
                    <?php } else { ?>
                    <label class="col-sm-2 control-label" for="ga"><?php echo $text_giftaid; ?></label> 
                    <div class="input-group">
                        <input id="ga" type="radio" name="gifta" value="0" checked />no<br />
                        <input id="ga" type="radio" name="gifta" value="1" />yes<br />
                    </div>
                    <?php } ?>
                </div>
            </form>    
            <span class="input-group-btn">
                <input type="submit" value="<?php echo $button_charity; ?>" id="button-charity" data-loading-text="<?php echo $text_loading; ?>"  class="btn btn-primary" />
            </span> </div>
        <script type="text/javascript"><!--
  $('#button-charity').on('click', function () {
                $.ajax({
                    url: 'index.php?route=extension/total/charity/charity',
                    type: 'post',
                    data: 'charity=' + encodeURIComponent($('input[name=\'charity\']').val()) + '&gifta=' + $('input[name=\'gifta\']:checked').val(),
                    dataType: 'json',
                    beforeSend: function () {
                        $('#button-charity').button('loading');
                    },
                    complete: function () {
                        $('#button-charity').button('reset');
                    },
                    success: function (json) {
                        $('.alert').remove();

                        if (json['error']) {
                            $('.breadcrumb').after('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');

                            $('html, body').animate({scrollTop: 0}, 'slow');
                        }

                        if (json['redirect']) {
                            location = json['redirect'];
                        }
                    }
                });
            });
            //--></script>
    </div>
</div>
</div>

Image
Get a secure, fast, and reliable web hosting service from https://turnuphosting.com.


Active Member

Posts

Joined
Fri Sep 21, 2018 12:01 am

Post by xxvirusxx » Fri Mar 29, 2019 1:41 am

To lazy to post more code :laugh:
Test
Last edited by xxvirusxx on Wed May 22, 2019 8:13 pm, edited 1 time in total.

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by fegdeed » Fri Mar 29, 2019 3:37 am

Thanks @xxvirusxx and @Straightlight, I really appreciate all your help. Its working great now.

Image
Get a secure, fast, and reliable web hosting service from https://turnuphosting.com.


Active Member

Posts

Joined
Fri Sep 21, 2018 12:01 am

Post by fegdeed » Sat Mar 30, 2019 9:17 am

The extension is working great, but I just noticed that on the return page - below Product is opened, the options changed from yes or no to Yes, I would like this donation to be treated as a Gift Aid donation or No, as I am not a UK taxpayer, I am unable to take part in the Gift Aid scheme. The same options is displayed under Newsletter subscription. Also the Newsletter description A newsletter is a regularly distributed publication that is generally about one main topic of interest to its subscribers is displayed under the title Product Returns.

Image
Get a secure, fast, and reliable web hosting service from https://turnuphosting.com.


Active Member

Posts

Joined
Fri Sep 21, 2018 12:01 am

Post by xxvirusxx » Sat Mar 30, 2019 4:12 pm

Much better if you post screenshots...

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by fegdeed » Mon Apr 01, 2019 4:40 am

Thanks @xxvirusxx, I have attached screenshots to this post.

Attachments

Screenshot_2019-03-31 Newsletter Subscription.png

Screenshot_2019-03-31 Newsletter Subscription.png (28.19 KiB) Viewed 1937 times

Screenshot_2019-03-31 Product Returns.png

Screenshot_2019-03-31 Product Returns.png (167.06 KiB) Viewed 1937 times


Image
Get a secure, fast, and reliable web hosting service from https://turnuphosting.com.


Active Member

Posts

Joined
Fri Sep 21, 2018 12:01 am

Post by xxvirusxx » Tue Apr 02, 2019 3:45 pm

Not Default theme...

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by straightlight » Tue Apr 02, 2019 6:31 pm

xxvirusxx wrote:
Tue Apr 02, 2019 3:45 pm
Not Default theme...
That's why I didn't posted the entire codes prior. :D

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by xxvirusxx » Tue Apr 02, 2019 10:44 pm

Yep, on Default theme it show nice, after small twig tweaks :)

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by fegdeed » Wed Apr 10, 2019 2:53 am

Lol @xxvirusxx and @Straightlight, thanks for your help though, but the section of the website @xxvirusxx showed is displaying correctly on mine too. I have attached a pic. I was trying to find out where I can edit the sentences below Product Returns in the earlier pic. Also, is it possible to display Donate to Charity at checkout page?

Attachments

Screenshot_2019-04-09 Shopping Cart.png

Screenshot_2019-04-09 Shopping Cart.png (62.31 KiB) Viewed 1848 times


Image
Get a secure, fast, and reliable web hosting service from https://turnuphosting.com.


Active Member

Posts

Joined
Fri Sep 21, 2018 12:01 am

Post by xxvirusxx » Wed Apr 10, 2019 4:11 am

fegdeed wrote:
Wed Apr 10, 2019 2:53 am
Also, is it possible to display Donate to Charity at checkout page?
On Default theme checkout? Or custom Checkout?

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by fegdeed » Thu Apr 11, 2019 9:58 pm

Thanks @xxvirusxx, on default theme checkout.

Image
Get a secure, fast, and reliable web hosting service from https://turnuphosting.com.


Active Member

Posts

Joined
Fri Sep 21, 2018 12:01 am

Post by drest341 » Sun Dec 20, 2020 10:51 pm

Hi there, little help for above charity mod.
A modification has been made for OC2.3 , but cannot create new & save a charity in admin, so to display it in cart.
Form looks to work, but nothing happens. ???

Stucked!

Attachments

charity2.jpg

charity2.jpg (55.79 KiB) Viewed 1053 times

charity1.jpg

charity1.jpg (58.16 KiB) Viewed 1053 times


Any fool can write code that a computer can understand. Good programmers write code that humans can understand ~ Martin Fowler.


User avatar
New member

Posts

Joined
Fri Feb 21, 2014 10:47 pm
Location - Athens
Who is online

Users browsing this forum: thomas_1989, Yahoo [Bot] and 532 guests