feat: Add premade card templates and click analytics
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
WordPress Plugin v2.0.0: - Add Promo Banner widget (dark banner with deal text) - Add Horizontal Product Row widget (wide list format) - Add Category Card widget (image-based categories) - Add Compact Card widget (dense grid layout) - Add CannaiQAnalytics click tracking (tracks add_to_cart, product_view, promo_click, category_click events) - Register cannaiq-templates Elementor category - Fix branding: CannaiQAnalytics (not CannaIQAnalytics) Backend: - Add POST /api/analytics/click endpoint for WordPress plugin - Accepts API token auth, records to product_click_events table - Stores metadata: product_name, price, category, url, referrer 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,7 +44,7 @@ class CannaIQ_Menus_Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register CannaIQ Elementor Widget Category
|
||||
* Register CannaIQ Elementor Widget Categories
|
||||
*/
|
||||
public function register_elementor_category($elements_manager) {
|
||||
$elements_manager->add_category(
|
||||
@@ -54,6 +54,13 @@ class CannaIQ_Menus_Plugin {
|
||||
'icon' => 'fa fa-cannabis',
|
||||
]
|
||||
);
|
||||
$elements_manager->add_category(
|
||||
'cannaiq-templates',
|
||||
[
|
||||
'title' => __('CannaiQ Templates', 'cannaiq-menus'),
|
||||
'icon' => 'fa fa-th-large',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function init() {
|
||||
@@ -116,6 +123,10 @@ class CannaIQ_Menus_Plugin {
|
||||
|
||||
// Card templates (v2.0)
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/card-template-premium.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/card-template-promo-banner.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/card-template-horizontal.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/card-template-category.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/card-template-compact.php';
|
||||
|
||||
// Register legacy widgets
|
||||
$widgets_manager->register(new \CannaIQ_Menus_Product_Grid_Widget());
|
||||
@@ -137,6 +148,10 @@ class CannaIQ_Menus_Plugin {
|
||||
|
||||
// Register card templates (v2.0)
|
||||
$widgets_manager->register(new \CannaIQ_Premium_Card_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Promo_Banner_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Card_Horizontal_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Card_Category_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Card_Compact_Widget());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,6 +181,15 @@ class CannaIQ_Menus_Plugin {
|
||||
CANNAIQ_MENUS_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
// Pass analytics config to JavaScript
|
||||
$api_token = get_option('cannaiq_api_token');
|
||||
wp_localize_script('cannaiq-menus-script', 'cannaiqAnalytics', [
|
||||
'enabled' => !empty($api_token),
|
||||
'api_url' => CANNAIQ_MENUS_API_URL,
|
||||
'api_token' => $api_token,
|
||||
'store_id' => get_option('cannaiq_default_store_id', 1),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user