WooCommerce-pdf-faturanın WOOCS ile çalışması nasıl yapılır?
woocommerce-pdf-invoice eklentisi, faturaları pdf formatında yazdırmanıza olanak tanır. Ama bir şey var – WOOCS ile düzgün çalışmasını sağlayacak hiçbir filtre ve eylem yok. Bu yüzden bu soruyu araştırmaya karar verdim ve woocommerce-pdf-invoice eklenti kodunu hackleyerek bu görevleri yeniden canlandırdım. WOOCS ile woocommerce-pdf-fatura kullanmak istiyorsanız aynısını yapabilirsiniz.
- MyCAD'de yazılım Güncelleme ye git plugins/woocommerce-pdf-invoice/includes/woo-pdf-invoice.class.php
- Dosyada 8 yerde değişiklik yapmamız gerekiyor woo-pdf-invoice.class.php
- Finf işlevi toplamı ve sonrakinde kodu değiştir:
public function total() { if(class_exists('WOOCS')) { return (double) WOOCS::normalize_order_data($this->orderData->id, $this->orderData->order_total); } else { dönüş (çift) $this->orderData->order_total; } }
- Bunun gibi bir şey alacaksınız:
- Ardından row_total işlevini bulun ve sonraki kodu ekrandaki gibi buraya ekleyin:
if(class_exists('WOOCS')) { $line_subtotal = WOOCS::normalize_order_data($this->orderData->id, $line_subtotal); }
- Ardından item_price işlevini bulun ve kodu ekrandaki gibi değiştirin:
if((((double) $fiyat) * (int) $item['qty']) == (double) $this->row_total($item, $this->orderData)) { if(class_exists('WOOCS) ')) { return WOOCS::normalize_order_data($this->orderData->id, $price); } başka { dönüş $fiyat; } } else { if(class_exists('WOOCS')) { return WOOCS::normalize_order_data($this->orderData->id, $price); } başka { dönüş $fiyat; } }
- Ardından get_totals işlevini bulun ve sonraki kodu ekrandaki gibi değiştirin:
if(class_exists('WOOCS')) { $totals['subtotal'] = array( 'name'=>$this->invoiceOptions['woo_pdf_title_subtotal'], 'value'=>(double) WOOCS::normalize_order_data($ this->orderData->id, $ara toplam), ); } else { $toplam['alt toplam'] = array( 'ad'=>$bu->invoiceOptions['woo_pdf_title_subtotal'], 'değer'=>(double) $ara toplam, ); }
- Aynı işlevde dizeyi // Toplamın altındaki vergileri yalnızca vergiler dahil ara toplam görüntüleniyorsa görüntüle ve sonraki kodu ekle:
if(class_exists('WOOCS')) { $totals['total'] = array( 'name'=>$this->invoiceOptions['woo_pdf_title_total'], 'value'=>(double) WOOCS::normalize_order_data($ this->orderData->id, $this->orderData->order_total), ); } else { $toplam['toplam'] = array( 'ad'=>$bu->invoiceOptions['woo_pdf_title_total'], 'değer'=>(double) $this->orderData->order_total, ); }
- render_left_block işlevini bulun ve sonraki kodu değiştirin:
if(class_exists('WOOCS')) { $blocks = array( 'amount_in_words'=>array( 'title'=>$this->invoiceOptions['woo_pdf_title_amount_in_words'], 'text'=>$this->get_amount_in_words(( double)WOOCS::normalize_order_data($this->orderData->id, $this->orderData->order_total), $this->invoiceOptions), ), ); } else { $blocks = array( 'amount_in_words'=>array( 'title'=>$this->invoiceOptions['woo_pdf_title_amount_in_words'], 'text'=>$this->get_amount_in_words((double) $this->orderData) ->order_total, $this->invoiceOptions), ), ); }
- Miktar_in_kelimeleri işlevine gidin ve sonraki kodu değiştirin:
if(class_exists('WOOCS')) { $currency = get_post_meta($this->orderData->id, '_woocs_order_currency', DOĞRU); if(!$self) { $dize .= ' '; $dizge .= $para birimi; } }else{ if(!$self) { $string .= ' '; $string .= _n('dolar', 'dolar', $sayı, 'woo_pdf'); } }
Hepsi bu!