Post by darth_danny » Tue Aug 09, 2016 8:21 pm

Hi,

I created a custom payment method based the tutorial on

http://code.tutsplus.com/tutorials/crea ... -cms-22393

But during testing I realized there is an issue with the description of how the order status' are set up as saving a default status in admin or selecting the status in the callback does not work.

New member

Posts

Joined
Wed Jul 27, 2016 5:41 pm

Post by straightlight » Tue Aug 09, 2016 8:30 pm

The provided link demonstrates old ways on developing payment modules since the codes are for v1.5x of Opencart in addition that the extensions are loaded under the extension folder nowadays with the latest version release of Opencart.

As for the order statuses, when created the module, did you also implemented the dropdown options in the admin module form so that you must also select the order statuses event as compared to other payment modules and your order statuses options that must also be defined in your admin - > systems - > settings - > edit store page?

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 darth_danny » Tue Aug 09, 2016 8:50 pm

Yes I did. Here are some scripts to illustrate what i mean:

following the code instructions, i have this script in the admin view

Code: Select all

                    <select name="mobile_money_order_status_id" id="input-status" class="form-control">
                        <?php foreach ($order_statuses as $order_status) { ?>
                        <?php if ($order_status['order_status_id'] == $mobile_money_order_status_id) { ?>
                        <option value="<?php echo $order_status['order_status_id']; ?>" selected="selected"><?php echo $order_status['name']; ?></option>
                        <?php } else { ?>
                        <option value="<?php echo $order_status['order_status_id']; ?>"><?php echo $order_status['name']; ?></option>
                        <?php } ?>
                        <?php } ?>
                  </select>
I cannot see a reference to how $mobile_money_order_status_id (undefined variable notice ) is created and how it can be referenced in the payment method callback when updating the order with a status

New member

Posts

Joined
Wed Jul 27, 2016 5:41 pm

Post by straightlight » Tue Aug 09, 2016 9:13 pm

I cannot see a reference to how $mobile_money_order_status_id (undefined variable notice ) is created and how it can be referenced in the payment method callback when updating the order with a status
That could be an issue already. Do you have an API documentation you could provide so to see how and when this variable for mobile must be used?

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 darth_danny » Tue Aug 09, 2016 9:20 pm

Hi,
What I have done for now is I removed the IF statement within the foreach. Now I can get the default status from the callback. My problem now is if I want to label the status as failed. does
addOrderhistory
function accept as a parameter the text order status and not the order status id?

If would be easier to use in the callback when I am setting up conditions for successful and unsuccessful orders

New member

Posts

Joined
Wed Jul 27, 2016 5:41 pm

Post by straightlight » Wed Aug 10, 2016 12:39 am

darth_danny wrote:Hi,
What I have done for now is I removed the IF statement within the foreach. Now I can get the default status from the callback. My problem now is if I want to label the status as failed. does
addOrderhistory
function accept as a parameter the text order status and not the order status id?

If would be easier to use in the callback when I am setting up conditions for successful and unsuccessful orders
The addOrderHistory method has the order status ID into its parameter rather than a text string, which is the way it should be pretty much as capturing your text string from the order status ID can easily be achieved in order to know if there's a corresponding match. Another way to do it would be by querying the order status ID with your text string into a separated model file which can still return a true result if the API right before calling the addOrderHistory method officially as it must return identical string results compared to your Opencart order status for this the specific store. This can be verified within a simple IF statement. :)

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 gmurillo » Thu Dec 01, 2016 12:31 am

Works perfect for me addOrderhistory
Thanks :D

Newbie

Posts

Joined
Thu Jan 21, 2016 4:53 am
Who is online

Users browsing this forum: No registered users and 3 guests