Post by melC_82 » Wed Jun 16, 2021 3:44 pm

Hi there ! I try to develop a free OCMOD for OC3 on my OC 3.0.3.7.
Simply, i start from this old VQMOD (see attachment) to add "Tracking code" field before "Comment".
I added the table into DB order_history after comment to set my tracking number, then i've modified order.php in model and controller admin's folder. To test it, i manually enter a number into the DB to make sure the value is found and it works work well.

Where it became weird, i added to <script> at the end of the order_info.twig the line

Code: Select all

+ '&trackcode=' + encodeURIComponent($('input[name=\'trackcode\']').val())


But nothing is send to the DB, input's name is correct everything match but nothing. So Can someone help me to do this "simple" trick, i would like to put my OCMOD free for OC3 on extensions pages

Thanks in advance !

Attachments


Newbie

Posts

Joined
Wed Jun 16, 2021 3:27 pm

Post by xxvirusxx » Wed Jun 16, 2021 5:59 pm

So you have changed this line:

Code: Select all

data: 'order_status_id=' + encodeURIComponent($('select[name=\'order_status_id\']').val()) + '&notify=' + ($('input[name=\'notify\']').prop('checked') ? 1 : 0) + '&override=' + ($('input[name=\'override\']').prop('checked') ? 1 : 0) + '&append=' + ($('input[name=\'append\']').prop('checked') ? 1 : 0) + '&comment=' + encodeURIComponent($('textarea[name=\'comment\']').val()),
In this and doesn't work?

Code: Select all

data: 'order_status_id=' + encodeURIComponent($('select[name=\'order_status_id\']').val()) + '&notify=' + ($('input[name=\'notify\']').prop('checked') ? 1 : 0) + '&override=' + ($('input[name=\'override\']').prop('checked') ? 1 : 0) + '&append=' + ($('input[name=\'append\']').prop('checked') ? 1 : 0) + '&trackcode=' + encodeURIComponent($('input[name=\'trackcode\']').val()) + '&comment=' + encodeURIComponent($('textarea[name=\'comment\']').val()),

My converted modules | Buy me a beer | Opencart upgrade service


User avatar
Expert Member

Posts

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

Post by straightlight » Wed Jun 16, 2021 6:54 pm

The subject line on this topic shows that you're changing TWIG files but that XML file still contains TPL extension lines in it. In addition, controller files still contains language definitions in it where OC 3.x releases no longer needs them. It is clearly that you're trying to complete a migration from a previous OC version. Therefore, contact the extension developer to resolve this issue.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by melC_82 » Fri Jun 18, 2021 12:37 am

The XML file is a "guide line" i'm changing raw files in my OC installation on local host. Yes i've changed the script part in order_info to add the tracking after comment. Just saw for POST you need to modify other files in "catalog" folder ?1 like API / order.php ...

Newbie

Posts

Joined
Wed Jun 16, 2021 3:27 pm

Post by straightlight » Fri Jun 18, 2021 1:44 am

melC_82 wrote:
Fri Jun 18, 2021 12:37 am
The XML file is a "guide line" i'm changing raw files in my OC installation on local host. Yes i've changed the script part in order_info to add the tracking after comment. Just saw for POST you need to modify other files in "catalog" folder ?1 like API / order.php ...
Simply by using Events, this can be accomplished.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by melC_82 » Fri Jun 18, 2021 11:06 pm

Ok, do you have any example please ?

Newbie

Posts

Joined
Wed Jun 16, 2021 3:27 pm

Post by straightlight » Fri Jun 18, 2021 11:14 pm

melC_82 wrote:
Fri Jun 18, 2021 11:06 pm
Ok, do you have any example please ?
Sure do: https://github.com/opencart/opencart/wiki/Events-System

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by melC_82 » Sat Jun 19, 2021 4:18 pm

oh thanks if i may found that before .. !

Newbie

Posts

Joined
Wed Jun 16, 2021 3:27 pm

Post by khnaz35 » Sat Jun 19, 2021 4:23 pm

Mel,
Just a question to you. Is this tracking number you are adding manually OR you want to add it via shipping company api,
Let say when you submit orders to them and then they create order number for you customers?

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by melC_82 » Tue Jun 22, 2021 5:09 pm

The goal is very simple:

following the shipping method, add a text field for tracking number then display tracking link on order history comment and email. No API, just a exactly the same process like the vqmod from my 1st post but for OC3.

The best way should be to update the vqmod for ocmod but it's over my skills, so i tried to learn more and going step by step ;D

Newbie

Posts

Joined
Wed Jun 16, 2021 3:27 pm

Post by khnaz35 » Tue Jun 22, 2021 5:15 pm

Just downloaded your file and can see that this is coming from 2.X versions.

If you really interested to get help around here then will suggest share the new xml where people can see what have been achieved and what can be help as well.

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by melC_82 » Tue Jun 22, 2021 9:43 pm

I still not have xml, trying by changing the raw code on localhost. Once done, i will edit xml but still stuck with just the POST request from the script

Newbie

Posts

Joined
Wed Jun 16, 2021 3:27 pm

Post by straightlight » Tue Jun 22, 2021 9:50 pm

melC_82 wrote:
Tue Jun 22, 2021 9:43 pm
I still not have xml, trying by changing the raw code on localhost. Once done, i will edit xml but still stuck with just the POST request from the script
You could always create a new service request in the Commercial Support section of the forum to get this done as a custom job.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by melC_82 » Tue Jun 22, 2021 11:23 pm

i'm almost done, just to find why the input value doesn't get POST then it's ok.

Newbie

Posts

Joined
Wed Jun 16, 2021 3:27 pm

Post by melC_82 » Tue Jun 22, 2021 11:54 pm

UPDATE: finally done ! missing in catalog /controller/ api/order.php $this->request->post['trackcode']
Now everything work fine !!

Newbie

Posts

Joined
Wed Jun 16, 2021 3:27 pm

Post by Pamella » Sat Jun 26, 2021 10:52 pm

Great news ;) please, @melC_82 could you share it ? tried from an other "outdated" vQmod but... without success at this point

OC 3.0.3.7 EN (default theme) running on PHP 7.3 MariaDB 10.3 Linux / Apache 2.4


New member

Posts

Joined
Tue Oct 25, 2011 4:22 am
Who is online

Users browsing this forum: No registered users and 7 guests