wp_die(__('I\'m trying to load a step but couldn\'t find it! Please go back and try again.','coupon-generator-for-woocommerce'),__('Could not find step','coupon-generator-for-woocommerce'));
wp_die(__('I\'m trying to load a generator step but couldn\'t find the right callback! Please go back and try again.','coupon-generator-for-woocommerce'),__('Could not find step','coupon-generator-for-woocommerce'));
endif;
$handler=$this->steps[$step]['handler'];
if(is_callable(array($this,$handler))):
call_user_func(array($this,$handler));
endif;
}
/**
* Introduction handler.
*
* Handler to output the introduction page (step 0).
<p><?php_e('Thank you for using WooCommerce Coupon Generator. To use the coupon generator you have to go through the following steps.','coupon-generator-for-woocommerce');?>
<spanclass='description'><?php_e('Here you can set the coupon settings you\'re used to set in the default WooCommerce coupon settings.','coupon-generator-for-woocommerce');?></span>
<imgclass="help_tip"data-tip='<?php_e('Number of coupons to generate in this batch','coupon-generator-for-woocommerce');?>'src="<?phpechoWC()->plugin_url();?>/assets/images/help.png"height="16"width="16"/>
$wpdb->query($wpdb->prepare("INSERT INTO $wpdb->posts SET
post_author=%d,
post_date=%s,
post_date_gmt=%s,
post_title=%s,
post_status='publish',
comment_status='closed',
ping_status='closed',
post_name=%s,
post_modified=%s,
post_modified_gmt=%s,
post_type='shop_coupon'
",
get_current_user_id(),
current_time('mysql'),
current_time('mysql',1),
sanitize_title($coupon_code),
$coupon_code,
current_time('mysql'),
current_time('mysql',1)
));
$insert_coupon_ids[]=$wpdb->insert_id;
$coupon_id=$wpdb->insert_id;
// Set GUID
// $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET guid=%s WHERE ID=%d", get_permalink( $coupon_id ), $coupon_id ) ); // Slow
$wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET guid=%s WHERE ID=%d",esc_url_raw(add_query_arg(array('post_type'=>'shop_coupon','p'=>$coupon_id),home_url())),$coupon_id));// 10% faster -1 query per coupon
WooCommerce Coupon Generator is a coupon generator that allows you to setup and generator tens of thousands of coupons at the same time.
By going through 3 easy steps you can setup your desired coupons and start generating the coupons.
**Generation process**<br />
Step 0) Introduction, ‘how to’<br />
Step 1) Select coupon settings<br />
Step 2) Select generation settings<br />
Step 3) Coupons are being generated<br />
The coupons are generated in a very effective way so they will even work on low-cost hosting. During the generation process you will get updates about the progress.
Tested up to **1,000,000** (!!) coupons.
**Please leave a rating if you found this plugin useful**
If you have a feature request, let me know, they're always welcome!
== Installation ==
1. Upload the folder `woocommerce-coupon-generator to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to the generation page and start generating :-)
== Screenshots ==
1. Start of generating coupons
2. Coupon options
3. Generation options
4. Generating coupons
5. Generated coupons
== Changelog ==
= 1.0.2 - 2017/04/13 =
* [Fix] - WC 3.0 incompatibility with the 'Products' / 'Excluded products' coupon setting