Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,833
    Plugin Contributions
    31

    Default COD module, display of text description

    var $code, $title, $description, $enabled;

    // class constructor
    function cod() {
    global $order;

    $this->code = 'cod';
    $this->title = MODULE_PAYMENT_COD_TEXT_TITLE;
    $this->description = MODULE_PAYMENT_COD_TEXT_DESCRIPTION;

    As far as I can see, the constant MODULE_PAYMENT_COD_TEXT_DESCRIPTION, albeit defined and stuffed into $description, does not actually get used/shown/output anywhere.

    Am I correct?
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

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

    Default Re: COD module, display of text description

    Use of $description is not limited to COD, but included in all payment modules based on a sample of payment modules from the includes/modules/payment directory...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,833
    Plugin Contributions
    31

    Default Re: COD module, display of text description

    Use of $description is not limited to COD, but included in all payment modules based on a sample of payment modules from the includes/modules/payment directory...
    Yes, $description is "defined"...but is it actually "used"?
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

  4. #4
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: COD module, display of text description

    Quote Originally Posted by torvista View Post
    Yes, $description is "defined"...but is it actually "used"?

    Search of php files for ->description found the only use as an assignment of the constant to it. Nothing that used it. Going to try to expand the search to other potential uses. Note, it is also used in payment modules. Previous post was to identify that applies to more than just COD and appears to be either for a future feature or leftover from a past one (haven't gone searching older versions for the same.)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: COD module, display of text description

    Nope, didn't find it used anywhere else when using developers toolkit to search 'everything' for ->description on the catalog side. Guess could check the admin side as well...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: COD module, display of text description

    Ah ha. It's used in admin/modules.php so it appears...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,833
    Plugin Contributions
    31

    Default Re: COD module, display of text description

    I have been digging in this, cleaning up ancient hacks to show additional information with each of the payment modules on offer in the catalog.

    I think the process is worthy of documentation, and maybe some reworking...

    MODULE_PAYMENT_COD_TEXT_TITLE - used in catalog and admin
    MODULE_PAYMENT_COD_TEXT_DESCRIPTION - used in admin only, in the infobox.

    Note that changes in override files are not used/do not show up in the admin, only the original constants.

    To use MODULE_PAYMENT_COD_TEXT_DESCRIPTION in the catalog a couple of edits are required
    in the payment module

    function selection() {//steve edited - shown on checkout_payment
    /* ORIGINAL return array('id' => $this->code,
    'module' => $this->title);*/

    return array('id' => $this->code,
    'module' => $this->title,
    'description' => $this->description);//steve added
    }
    Now in tpl_checkout_payment.php it can be used

    <label for="pmt-<?php echo $selection[$i]['id']; ?>" class="radioButtonLabel"><?php echo $selection[$i]['module']; ?></label>
    <?php echo $selection[$i]['description']; //steve added ?>
    I wanted to add icons in that description which would have shown up in the admin as broken links, but since the overrides are not used in the admin, it's ok.

    Or, you can add an extra define eg:
    MODULE_PAYMENT_COD_ICON

    add the code:

    function selection() {//steve edited - shown on checkout_payment
    /* ORIGINAL return array('id' => $this->code,
    'module' => $this->title);*/

    return array('id' => $this->code,
    'module' => $this->title,
    'description' => $this->description,
    'icon' => MODULE_PAYMENT_COD_ICON);//steve added
    }
    and in the template

    <label for="pmt-<?php echo $selection[$i]['id']; ?>" class="radioButtonLabel"><?php echo $selection[$i]['module']; ?></label>
    <?php echo $selection[$i]['icon']; //steve added ?>
    <?php echo $selection[$i]['description']; //steve added ?>
    There is another built-in way which in the end I have opted to use.

    In the module:
    function selection() {//steve edited - shown on checkout_payment
    /* ORIGINAL return array('id' => $this->code,
    'module' => $this->title);*/

    return array('id' => $this->code,
    'module' => $this->title,
    'fields'=>array(array('title' =>MODULE_PAYMENT_COD_CATALOG_ICON,
    'field' => MODULE_PAYMENT_COD_TEXT_DESCRIPTION))
    );

    }
    and this gets output automatically by the original code in the tpl_checkout_payment.php:

    <div class="ccinfo">
    <?php
    for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {
    ?>
    <label <?php echo (isset($selection[$i]['fields'][$j]['tag']) ? 'for="'.$selection[$i]['fields'][$j]['tag'] . '" ' : ''); ?>class="inputLabelPayment"><?php echo $selection[$i]['fields'][$j]['title']; ?></label><?php echo $selection[$i]['fields'][$j]['field']; ?>
    <br class="clearBoth" />
    <?php
    }
    ?>
    </div>
    I note the "title" array item is wrapped in a label tag and provision is made to add the "for" tag to this label. Not sure what the reasoning behind this is/was. Possibly to make the whole text block clickable to select the radio button?
    In which case the template needs to be modified.

    <label <?php echo (isset($selection[$i]['fields'][$j]['tag']) ? 'for="pmt-'.$selection[$i]['fields'][$j]['tag'] . '" ' : ''); ?>class="inputLabelPayment"><?php echo $selection[$i]['fields'][$j]['title']; ?></label><?php echo $selection[$i]['fields'][$j]['field']; ?>
    So, several ways to skin the cat here. I prefer the last method to add extra info to the payment method. It needs some styling to get it shipshape but I just wanted to explain the bones of it.

    I also put the payment methods in divs with styling to better control the positioning of the subsequent text.

    And on the checkout confirmation page, you can do similar stuff with this function in the module:

    function confirmation() {//steve edited, shown on checkout_confirmation
    return array('title' => '',
    'fields'=>array(array('title' =>MODULE_PAYMENT_COD_CATALOG_ICON',
    'field' => MODULE_PAYMENT_COD_TEXT_DESCRIPTION)) );
    }
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

 

 

Similar Threads

  1. modify USPS module display text on checkout pages?
    By mcqueeneycoins in forum Addon Shipping Modules
    Replies: 10
    Last Post: 2 Jun 2012, 06:05 PM
  2. display product description on step 2 payment module
    By mariedesignz in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 11 Feb 2010, 12:29 AM
  3. CoD Description?
    By dudeshouse in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 21 Oct 2008, 11:20 AM
  4. Cloning COD Module
    By SteveCollins in forum Addon Payment Modules
    Replies: 4
    Last Post: 26 May 2008, 10:37 PM

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