<?php global $post; $articles = Aplazame_Serializers::getArticlesCampaign(array($post)); ?> <div id="aplazame_campaigns_tab" class="panel woocommerce_options_panel"> <div class="options_group" id="aplazame_campaigns_container"> </div> </div> <script> var campaignsContainer = document.getElementById("aplazame_campaigns_container"); var articles = <?php echo json_encode($articles); ?> ; function associateArticlesToCampaign(articles, campaignId) { apiRequest("POST", "/me/campaigns/" + campaignId + "/articles", articles, function () { }); } function removeArticlesFromCampaign(articles, campaignId) { var articleIds = articles.map(function (article) { return article.id; }); apiRequest("DELETE", "/me/campaigns/" + campaignId + "/articles?article-mid=" + articleIds.join(","), null, function () { });
public function history() { $order = new WC_Order($_GET['order_id']); if (static::is_aplazame_order($order->id) && $this->is_private_key_verified()) { $qs = get_posts(array('meta_key' => '_billing_email', 'meta_value' => $order->billing_email, 'post_type' => 'shop_order', 'numberposts' => -1)); wp_send_json(Aplazame_Serializers::get_history($qs)); return null; } status_header(403); return null; }
<?php if (!defined('ABSPATH')) { exit; } /** @var WC_Aplazame $aplazame */ global $aplazame; if (!$aplazame->enabled) { return; } /** @var WooCommerce $woocommerce */ global $woocommerce; $cart = $woocommerce->cart; $user = wp_get_current_user(); $order = new WC_Order($_GET['order_id']); ?> <script type="text/javascript"> aplazame.checkout(<?php echo json_encode(Aplazame_Serializers::get_checkout($order, $cart->get_checkout_url(), $aplazame->redirect->id, $user), 128); ?> ); </script>
public function getCustomerHistory(Customer $customer, $limit) { $serializer = new Aplazame_Serializers(); return $serializer->getHistory($customer, $limit); }