افزونه برای ajax کردن

armin_

تازه وارد
با سلام

با استفاده از این کد


کد:
<?php								echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">×</a>', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), __( 'Remove this item', 'woocommerce' ) ), $cart_item_key );
							?>
دگمه حذف محصول از سبد خرید رو میشه قرار داد.

این دگمه به صورت refresh کار می کنه صفحه refresh می کنه

میشه کاری کرد این به صورت ajax کار کنه؟؟؟

 

armin_

تازه وارد
خوب نمیشه کاری کرد تابعی که اجرا میشه برای این کار به صورت ajax فراخوانی بشه؟؟؟؟

ایا این تابع به درد می خورده


کد:
[COLOR=#929292][FONT=Menlo]/**[/FONT][/COLOR]
[COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1030"]1030 [/URL][COLOR=#929292] * woocommerce_ajax_remove_order_item function.[/COLOR][/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1031"]1031 [/URL][COLOR=#929292] *[/COLOR][/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1032"]1032 [/URL][COLOR=#929292] * @access public[/COLOR][/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1033"]1033 [/URL][COLOR=#929292] * @return void[/COLOR][/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1034"]1034 [/URL][COLOR=#929292] */[/COLOR][/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1035"]1035 [/URL][COLOR=#468847][B]function[/B][/COLOR] [URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#_woocommerce_ajax_remove_order_item"]woocommerce_ajax_remove_order_item[/URL]() {[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1036"]1036 [/URL]    [COLOR=#468847][B]global[/B][/COLOR] [COLOR=#C09853][B]$woocommerce[/B][/COLOR], [COLOR=#C09853][B]$wpdb[/B][/COLOR];[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1037"]1037 [/URL][/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1038"]1038 [/URL]    check_ajax_referer( [COLOR=#006DCC]'order-item'[/COLOR], [COLOR=#006DCC]'security'[/COLOR] );[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1039"]1039 [/URL][/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1040"]1040 [/URL]    [COLOR=#C09853][B]$order_item_ids[/B][/COLOR] = [COLOR=#C09853][B]$_POST[/B][/COLOR][[COLOR=#006DCC]'order_item_ids'[/COLOR]];[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1041"]1041 [/URL][/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1042"]1042 [/URL]    [COLOR=#468847][B]if[/B][/COLOR] ( [B]sizeof[/B]( [COLOR=#C09853][B]$order_item_ids[/B][/COLOR] ) > [COLOR=#006DCC]0[/COLOR] ) {[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1043"]1043 [/URL]        [COLOR=#468847][B]foreach[/B][/COLOR]( [COLOR=#C09853][B]$order_item_ids[/B][/COLOR] [COLOR=#468847][B]as[/B][/COLOR] [COLOR=#C09853][B]$id[/B][/COLOR] ) {[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1044"]1044 [/URL]            woocommerce_delete_order_item( absint( [COLOR=#C09853][B]$id[/B][/COLOR] ) );[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1045"]1045 [/URL]        }[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1046"]1046 [/URL]    }[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1047"]1047 [/URL][/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1048"]1048 [/URL]    [COLOR=#468847][B]die[/B][/COLOR]();[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1049"]1049 [/URL]}[/COLOR][COLOR=#C0C0C0][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1050"]1050  [/URL][/COLOR][URL="http://docs.woothemes.com/wc-apidocs/source-function-woocommerce_ajax_remove_order_item.html#1051"]1051 [/URL][COLOR=#C0C0C0][FONT=Menlo]add_action( [/FONT][/COLOR][COLOR=#006DCC][FONT=Menlo]'wp_ajax_woocommerce_remove_order_item'[/FONT][/COLOR][COLOR=#C0C0C0][FONT=Menlo], [/FONT][/COLOR][COLOR=#006DCC][FONT=Menlo]'woocommerce_ajax_remove_order_item'[/FONT][/COLOR][COLOR=#C0C0C0][FONT=Menlo] );[/FONT][/COLOR]
 

Mohammad

مدیر انجمن
پرسنل مدیریت
دوست عزیز. این اعمال باید روی قالب ها پیاده بشه... که کار سختی هست تقریبا...

 
بالا