예제 #1
0
/**
 * Generate variations
 *
 * @since 3.8.9
 * @access private
 *
 * @uses wpsc_update_variations()       Updates product variations given
 * @uses wpsc_admin_product_listing()   DEPRECATED
 *
 * @return array|WP_Error Response args if successful, WP_Error if otherwise
 */
function _wpsc_ajax_update_variations()
{
    $product_id = absint($_REQUEST["product_id"]);
    wpsc_update_variations();
    ob_start();
    wpsc_admin_product_listing($product_id);
    $content = ob_get_clean();
    return array('content' => $content);
}
 private function generate_variations()
 {
     if (!isset($_REQUEST['action2']) || $_REQUEST['action2'] != 'generate') {
         return;
     }
     check_admin_referer('wpsc_generate_product_variations', '_wpsc_generate_product_variations_nonce');
     wpsc_update_variations();
     $sendback = remove_query_arg(array('_wp_http_referer', 'updated'));
     wp_redirect(add_query_arg('tab', 'manage', $sendback));
     exit;
 }