kamiar3712 0 ارسال شده در آبان 93 گزارش بازنشر ارسال شده در آبان 93 سلام دوباره دوستاندر وردرپرس و افزونه ووکامرس:برای بخش کارمزد بنده افزونه تخفیف را woocommerce-bulk-discount به کارمزد تغییر دادم یعنی در بخشی که قرار است بصورت تخفیف مبلغ کسر شود, مبلغ اضافه میشود:public function filter_cart_product_subtotal( $subtotal, $_product, $quantity ) { if ( !$_product || !$quantity ) { return $subtotal; } if ( $this->coupon_check() ) { return $subtotal; } if ( get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) != '' && get_post_meta( $_product->id, "_bulkdiscount_enabled", true ) !== 'yes' ) { return $subtotal; } $coeff = $this->discount_coeffs[$this->get_actual_id( $_product )]['coeff']; if ( ( get_option( 'woocommerce_t4m_discount_type', '' ) == 'flat' ) ) { $newsubtotal = woocommerce_price( max( 0, ( $_product->get_price() * $quantity ) + $coeff ) ); } else { $newsubtotal = woocommerce_price( $_product->get_price() * $quantity * $coeff ); } return $newsubtotal;همان طور که متوجه شده اید با + $coeff مبلغ اضافه میشود و اتفاقا در صدورفاکتور در ردیف کالا, مشکلی وجود ندارد و بدرستی کارمزد اضافه میشود اما درجمع کل سبد خرید دوباره مبلغ کسر میشود و بشکلی که انگار مبلغ کالا بهصورت تخفیف محاسبه شده, بیان میشود.در تصویر هم مشخص است.http://s5.picofile.com/file/8147425292/Error.JPGتقریبا سه تا چهار فایل درگیر هستند که آخرین کدی که به آن رسیدیم بصورت زیر است که در اینجا قرار میدهم:ابتدا تابع wc_cart_totals_subtotal_html(); :<tr class="cart-subtotal"> <th><?php _e( 'Cart Subtotal', 'woocommerce' ); ?></th> <td><?php wc_cart_totals_subtotal_html(); ?></td></tr>و:function wc_cart_totals_subtotal_html() { echo WC()->cart->get_cart_subtotal();}و در نهایت که فکر میکنم باید در این بخش به دنبال مشکل گشت:/** * Gets the sub total (after calculation). * * @params bool whether to include compound taxes * @return string formatted price */ public function get_cart_subtotal( $compound = false ) { // If the cart has compound tax, we want to show the subtotal as // cart + shipping + non-compound taxes (after discount) if ( $compound ) { $cart_subtotal = wc_price( $this->cart_contents_total + $this->shipping_total + $this->get_taxes_total( false, false ) ); // Otherwise we show cart items totals only (before discount) } else { // Display varies depending on settings if ( $this->tax_display_cart == 'excl' ) { $cart_subtotal = wc_price( $this->subtotal_ex_tax ); if ( $this->tax_total > 0 && $this->prices_include_tax ) { $cart_subtotal .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>'; } } else { $cart_subtotal = wc_price( $this->subtotal ); if ( $this->tax_total > 0 && !$this->prices_include_tax ) { $cart_subtotal .= ' <small>' . WC()->countries->inc_tax_or_vat() . '</small>'; } } }دوستان نظری دارند؟دوستان نظری دارند؟ نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .