Pregunta

Cómo comprobar cuál es la fuente $ (factura o nota de crédito) en función de las facturas insertTotals pdf / Nota de crédito / envío.

protected function insertTotals($page, $source){

    $order = $source->getOrder();
    $totals = $this->_getTotalsList($source);
    $lineBlock = array(
        'lines'  => array(),
        'height' => 15
    );
    foreach ($totals as $total) {
        $total->setOrder($order)
            ->setSource($source);

        if ($total->canDisplay()) {
            $total->setFontSize(10);
            foreach ($total->getTotalsForDisplay() as $totalData) {

                $lineBlock['lines'][] = array(
                    array(
                        'text'      => $totalData['label'],
                        'feed'      => 475,
                        'align'     => 'right',
                        'font_size' => $totalData['font_size'],
                        'font'      => 'bold'
                    ),
                    array(
                        'text'      => $totalData['amount'],
                        'feed'      => 565,
                        'align'     => 'right',
                        'font_size' => $totalData['font_size'],
                        'font'      => 'bold'
                    ),
                );


            }

        }


    }

    $this->y -= 10;
    $page = $this->drawLineBlocks($page, array($lineBlock));
    return $page;



}

Esto es lo que se llama la función de Creditmemo.php:

$this->insertTotals($page, $creditmemo);

Y a partir de Invoice.php:

$this->insertTotals($page, $invoice);
¿Fue útil?

Solución

    if ($source instanceof Mage_Sales_Model_Order_Creditmemo) {
        //Creditmemo stuff here
    }
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top