Download & Extend

Flexicharge doesn't "Suppress" zero value rows correctly

Project:e-Commerce
Version:5.x-3.6
Component:flexicharge
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

When a charge has the "Suppress this row in the cart if the total charge = 0" checkbox set, Flexicharge does not always suppress the relevant row.

It appears there are two actual problems.

  1. The more significant issue is that the code for suppressing the row does not always seems to work.

    For example:

      // hide this charge if required.
      // if (empty($rate) and !empty($misc->hide_if_zero)) {
      if (1) {
        foreach ($txn->misc AS $m) {
          if ($m->chid == $misc->chid) {
            $txn->misc[$m->chid]->seen = TRUE;
            watchdog ('debug', 'Custom3 charge should be hidden...');
          }
        }     
      }

    This overrides the test for the rate or the checkbox, so should always suppress the relevant row. But it doesn't. And the log confirms that the code has been executed.
  2. The less significant issue is that the test for the checkbox does not always seems to work.

    There are two versions of this test.

    From sitewide.inc: if (empty($rate) and !empty($misc->hide_if_zero)) {
    From shipping.inc: if ($rate === 0 && $misc->hide_if_zero) {

    However, in either case, the latter portion does not always seem to return the expected result (i.e. true if the checkbox is set).

Full example attached.

AttachmentSizeStatusTest resultOperations
custom3.zip1.6 KBIgnored: Check issue status.NoneNone

Comments

#1

I should add that the attachment is based on sitewide.inc rather than custom.inc as custom.inc didn't include the relevant functionality. (And the global search and replace from "sitewide" / "site-wide" to "custom3" has created a few strange comments.)

#2

#228968: Flexicharge always showing rows in review even when £0:00 looks similar, but is marked as a duplicate of #228989: Flexicharge not adding up charges for mixed product types which actually doesn't look so similar...

Nevertheless, I've tried the solution for the latter, i.e. the patch at
http://drupal.org/node/228989#comment-772398.

I've also ensured that my code has the relevant breaks
(http://drupal.org/node/148157#comment-637931),

But none of this seems to have made any difference.

nobody click here