Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2004
    Posts
    364
    Plugin Contributions
    0

    Default Creating a Order Total Module

    Greetings,

    I'v been working on a new Order Total module and looking at the ot_gv code as a guide and been modifying and rewriting the gift card orders total code addon.

    My questions is that I can't seen to figure out how and where to add the code such that the module name / method shows on the invoice and the Payment/Shipping column on the admin orders page when it is used to cover the order balance? Currently, the GV name/method shows even though I'm not using it?

    I could update the GV defines here to what I want them to say:
    Code:
      define('PAYMENT_METHOD_GV', 'Gift Certificate/Coupon');
      define('PAYMENT_MODULE_GV', 'GV/DC');
    But that isn't the proper way to do it I'm sure!

    Suggestions?

    Thanks
    Experience is what you get when you don’t get what you want…

  2. #2
    Join Date
    Jul 2012
    Posts
    16,710
    Plugin Contributions
    17

    Default Re: Creating a Order Total Module

    There's a lot of possible directions to take this and/or the cause at this point. This new order_total module... how much/what has been changed away from the ot_gv code? Has it been modified to be a unique set of code?

    It almost sounds like the code still has at least some remnant of the ot_gv "definition" and based on the description that it may have a coding error causing it to always attach to those documents (unless I misunderstood).
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Nov 2004
    Posts
    364
    Plugin Contributions
    0

    Default Re: Creating a Order Total Module

    Quote Originally Posted by mc12345678 View Post
    There's a lot of possible directions to take this and/or the cause at this point. This new order_total module... how much/what has been changed away from the ot_gv code? Has it been modified to be a unique set of code?

    It almost sounds like the code still has at least some remnant of the ot_gv "definition" and based on the description that it may have a coding error causing it to always attach to those documents (unless I misunderstood).
    Hi mc12345678,

    Originally, I started with a copy of the ot_gv code and made it unique by renaming all references to that module (vars, defines, etc.).

    I abandoned that route once I found the gift card addon. I installed the gift card addon, which is an orders total module. Since my goal is to have a gift card type function and use it like a customer loyalty program where a customer can earn $$ that is credited to their card, I thought this would be a better route and modify from there.

    I first tested the GC module as is to make sure it was working as described. After a few fixes, it seemed to be working except for the issue that prompted my question about the code registering as if it was the GV module.

    I have gone through most of the gift card code line-by-line since I have made several modifications to fit my needs. I traced back where the GV defines get inserted to the order.php class. It is the only reference to the GV defines in all of the Zen Cart code.

    includes/classes/order.php

    Code:
    'payment_method' => (($this->info['payment_module_code'] == '' and $this->info['payment_method'] == '') ? PAYMENT_METHOD_GV : $this->info['payment_method']),
    'payment_module_code' => (($this->info['payment_module_code'] == '' and $this->info['payment_method'] == '') ? PAYMENT_MODULE_GV : $this->info['payment_module_code']),
    Looking at the code above, I would need to set those array elements to my gift card defines so the GV ones are not used. So, the question would be where in my code and how would I correctly set these so they are used when an order is paid for using a gift card?

    Code:
    $this->info['payment_method'] = PAYMENT_METHOD_GIFTCARD;
    $this->info['payment_module_code'] = PAYMENT_MODULE_GIFTCARD;
    Hope I'm explaining this clearly, thanks!
    Experience is what you get when you don’t get what you want…

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,366
    Plugin Contributions
    87

    Default Re: Creating a Order Total Module

    You could also review the documentation that I put together a couple of years ago: https://docs.zen-cart.com/Developer_..._total_modules

  5. #5
    Join Date
    Nov 2004
    Posts
    364
    Plugin Contributions
    0

    Default Re: Creating a Order Total Module

    Quote Originally Posted by lat9 View Post
    You could also review the documentation that I put together a couple of years ago: https://docs.zen-cart.com/Developer_..._total_modules
    Thanks lat9,

    This is very helpful. I knew there was some documentation, but not for 1.5.4 which I am using. The Order Total docs you referenced (1.6.0) would be the same for 1.5.4?

    I looked through the docs, but still couldn't find where you set the OT modules payment_method and payment_module_code such that it will show in the admin orders pages?
    Experience is what you get when you don’t get what you want…

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,366
    Plugin Contributions
    87

    Default Re: Creating a Order Total Module

    That documentation applies to order-total modules back to the Zen Cart 1.5.1 time-frame. Order-total modules don't have a payment method or a payment-module-code; that's for (er) payment modules.

  7. #7
    Join Date
    Nov 2004
    Posts
    364
    Plugin Contributions
    0

    Default Re: Creating a Order Total Module

    Quote Originally Posted by lat9 View Post
    That documentation applies to order-total modules back to the Zen Cart 1.5.1 time-frame. Order-total modules don't have a payment method or a payment-module-code; that's for (er) payment modules.
    lat9,

    Good to know about the ZC versions covered by your docs!

    That's what's confusing me when using gift vouchers, which is an order total module. The GV defines:

    Code:
      define('PAYMENT_METHOD_GV', 'Gift Certificate/Coupon');
      define('PAYMENT_MODULE_GV', 'GV/DC');
    are getting set here (notice it is using the GV as a payment method even though it is an order total module):

    includes/classes/order.php
    Code:
    'payment_method' => (($this->info['payment_module_code'] == '' and $this->info['payment_method'] == '') ? PAYMENT_METHOD_GV : $this->info['payment_method']),
    'payment_module_code' => (($this->info['payment_module_code'] == '' and $this->info['payment_method'] == '') ? PAYMENT_MODULE_GV : $this->info['payment_module_code']),
    If I had to guess, since the Gift Certificate/Coupon (GV) is built into ZC, it is hard coded to be the default (as show in the above code) payment if no other payment (credit card, money order, etc) is used. Even though the Gift Certificate/Coupon is an order total module!

    Maybe I need to modify the order.php class to look at my gift card order total module as a payment method similar to how it does this for the Gift Certificate/Coupon order total module?

    Can I set $this->info['payment_module_code'] and $this->info['payment_method'] from an order total module? If so, where?
    Experience is what you get when you don’t get what you want…

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,366
    Plugin Contributions
    87

    Default Re: Creating a Order Total Module

    The Gift Voucher (aka ot_gv) and Coupon (aka ot_coupon) order-totals are credit-class totals, so they're pseudo-payment modules.

  9. #9
    Join Date
    Nov 2004
    Posts
    364
    Plugin Contributions
    0

    Default Re: Creating a Order Total Module

    Quote Originally Posted by lat9 View Post
    The Gift Voucher (aka ot_gv) and Coupon (aka ot_coupon) order-totals are credit-class totals, so they're pseudo-payment modules.
    OK, that makes sense! So, I guess the gift card module I'm working on is as well.

    Currently, when either a Gift Voucher or Coupon is used to complete an order, you see the Gift Certificate/Coupon and GV/DC labels show up under the Payment Shipping column (GV/DC) on the admin orders list and order details page under payment type (Gift Certificate/Coupon).

    I would like for my gift card pseudo-payment module to show (GC) under the Payment Shipping column and (Gift Card) on the orders detail page as payment type when it is used to complete an order!
    Experience is what you get when you don’t get what you want…

 

 

Similar Threads

  1. Order total module problem
    By rottiejoe in forum General Questions
    Replies: 7
    Last Post: 21 Dec 2010, 10:33 AM
  2. I want an order-total module to display total w/o tax
    By ivanc in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 4
    Last Post: 31 Oct 2009, 12:11 PM
  3. Add obligatory clause to conclude order - Module Total Order
    By zildjian in forum Managing Customers and Orders
    Replies: 2
    Last Post: 7 Jun 2009, 06:41 PM
  4. Creating a custom order total module.
    By bcyde in forum General Questions
    Replies: 5
    Last Post: 25 Aug 2007, 06:07 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR