2

I want to print different invoices, which aren't printed out with all data. Like the color. I see the product is deleted from Magento.

Is there any way to fix this?

Edit:

Invoice.phtml:

<td><?php echo $_product->getAttributeText('color'); ?></td>
<td><?php echo $_product->getAttributeText('size'); ?></td>

1 Answer 1

1

I tried following:

  1. Created product
  2. Created order, invoice
  3. Deleted created product
  4. Printed PDF invoice.

Product name exist in PDF invoice. Could you tell what exactly disappeared?

upd.1.

I'm not sure but I think it's impossible. When magento build invice - it takes data from sales_flat_invoice_item table. This table contain only two fields, related to the product: SKU and name (these fields exists in invoice table). Method getAttributeText($attributeCode) belongs to catalog/product model and the value is getting from there:

class Mage_Catalog_Model_Product extends Mage_Catalog_Model_Abstract
{
....
    public function getAttributeText($attributeCode)
    {
        return $this->getResource()
            ->getAttribute($attributeCode)
                ->getSource()
                    ->getOptionText($this->getData($attributeCode));
    }

As product doesn't exist anymore - its impossible.

3
  • The color of the product is the first thing that doesn't show up, and all other data of the invoice after the first data missing.
    – John
    Commented Apr 13, 2015 at 19:09
  • Maybe you have some customization? Could you attach 2 screenshots? 1 with existing and 1 with non-existing product.
    – zhartaunik
    Commented Apr 13, 2015 at 19:34
  • I have found the problem, in my invoice.phtml file, it refers to the product to retreive the attributes. I have edited my post. Is there any way to retrieve this from the order?
    – John
    Commented Apr 13, 2015 at 20:05

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.