0

We currently have the following code which displays a link if a quotation is viewable:

        <td><?php echo $this->__($_quotation->getstatus()); ?></td>
        <td class="a-center">
            <?php if ($_quotation->isViewableByCustomer()): ?>
                    <a href="<?php echo $this->getViewUrl($_quotation) ?>"><?php echo $this->__('View Quotation') ?></a>
                <?php endif; ?>
        </td>

We're looking to show the link if the quotation status value equals Active or Expired but not Pending.

How should I change this code around to reflect this?

2
  • what is in the $_quotation function? Commented Jun 22, 2011 at 14:12
  • 1
    Post the code from the isViewableByCustomer() function Commented Jun 22, 2011 at 14:12

2 Answers 2

2

I'm assuming you intend to show the status cell in any condition, and only link to it if Active or Expired. at least that's how I read your question.

Assuming the function $_quotation->getstatus() returns the strings "Active" or "Expired" before internationalization, just add something like this to the condition that displays the link:

 <td><?php echo $this->__($_quotation->getstatus()); ?></td>
 <td class="a-center">
     <?php if ($_quotation->isViewableByCustomer() && ($_quotation->getstatus() == "Active" || $_quotation->getstatus() == "Expired")): ?>
          <a href="<?php echo $this->getViewUrl($_quotation) ?>"><?php echo $this->__('View Quotation') ?></a>
     <?php endif; ?>
 </td>

EDIT According to comment below, isViewableByCustomer() is not relevant here, so try:

 <td><?php echo $this->__($_quotation->getstatus()); ?></td>
 <td class="a-center">
     <?php if ($_quotation->getstatus() == "Active" || $_quotation->getstatus() == "Expired"): ?>
          <a href="<?php echo $this->getViewUrl($_quotation) ?>"><?php echo $this->__('View Quotation') ?></a>
     <?php endif; ?>
 </td>
Sign up to request clarification or add additional context in comments.

6 Comments

This works with active and also doesn't show pending which is great but the expired link still doesn't show
@Vince Pettit Then it's possible that getstatus() doesn't return exactly the string "Expired", but rather that string "Expired" is derived after internationalization __(). Find out exactly what getstatus() returns.
We've come across the following: const STATUS_NEW = 'New'; const STATUS_CUSTOMER_REQUEST = 'Pending'; const STATUS_ACTIVE = 'Active'; const STATUS_EXPIRED = 'Expired';
@Vince Pettit Somewhere where you can read the result on an expired record, just echo $_quotation->getstatus();. Also are you certain that isViewableByCustomer() is TRUE for expired records? If it is false, then the other side of the && won't be evaluated.
Just realised the isViewableByCustomer() will only give a true value on Active. This function can be dropped from the code. We need it to display the link on a value from echo $_quotation->getstatus();
|
0
   <?php if ($this->__($_quotation->getstatus() == "Active" || $this->__($_quotation->getstatus() == "Expired"){?><td><?php echo $this->__($_quotation->getstatus()); ?></td>
        <td class="a-center">
            <?php if ($_quotation->isViewableByCustomer()): ?>
                    <a href="<?php echo $this->getViewUrl($_quotation) ?>"><?php echo $this->__('View Quotation') ?></a>
                <?php endif; ?>
        </td>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.