Rename WordPress plugin from Dutchie Menus to Crawlsy Menus v1.3.0

- Renamed plugin to avoid WordPress.org naming conflict causing false update notifications
- Added /downloads static route to serve plugin zip file
- Updated all CSS classes from dutchie- to crawlsy- prefix
- Added plugin zip to backend/public/downloads for hosting
- Plugin available at: https://dispos.crawlsy.com/downloads/crawlsy-menus-1.3.0.zip

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Kelly
2025-12-01 16:29:21 -07:00
parent e345707db2
commit 511629b4e6
10 changed files with 264 additions and 247 deletions

View File

@@ -1,4 +1,5 @@
# Build stage # Build stage
# Image: code.cannabrands.app/creationshop/dispensary-scraper
FROM node:20-slim AS builder FROM node:20-slim AS builder
WORKDIR /app WORKDIR /app
@@ -49,6 +50,9 @@ COPY --from=builder /app/dist ./dist
# Create local images directory for when MinIO is not configured # Create local images directory for when MinIO is not configured
RUN mkdir -p /app/public/images/products RUN mkdir -p /app/public/images/products
# Copy static downloads (plugin files, etc.)
COPY public/downloads /app/public/downloads
EXPOSE 3010 EXPOSE 3010
CMD ["node", "dist/index.js"] CMD ["node", "dist/index.js"]

Binary file not shown.

View File

@@ -18,6 +18,10 @@ app.use(express.json());
const LOCAL_IMAGES_PATH = process.env.LOCAL_IMAGES_PATH || '/app/public/images'; const LOCAL_IMAGES_PATH = process.env.LOCAL_IMAGES_PATH || '/app/public/images';
app.use('/images', express.static(LOCAL_IMAGES_PATH)); app.use('/images', express.static(LOCAL_IMAGES_PATH));
// Serve static downloads (plugin files, etc.)
const LOCAL_DOWNLOADS_PATH = process.env.LOCAL_DOWNLOADS_PATH || '/app/public/downloads';
app.use('/downloads', express.static(LOCAL_DOWNLOADS_PATH));
app.get('/health', (req, res) => { app.get('/health', (req, res) => {
res.json({ status: 'ok', timestamp: new Date().toISOString() }); res.json({ status: 'ok', timestamp: new Date().toISOString() });
}); });

View File

@@ -1,53 +1,53 @@
/** /**
* Dutchie Menus - WordPress Plugin Styles * Crawlsy Menus - WordPress Plugin Styles
*/ */
/* Product Grid */ /* Product Grid */
.dutchie-product-grid { .crawlsy-product-grid {
display: grid; display: grid;
gap: 24px; gap: 24px;
margin: 20px 0; margin: 20px 0;
} }
.dutchie-grid-cols-2 { .crawlsy-grid-cols-2 {
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
} }
.dutchie-grid-cols-3 { .crawlsy-grid-cols-3 {
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
} }
.dutchie-grid-cols-4 { .crawlsy-grid-cols-4 {
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(4, 1fr);
} }
.dutchie-grid-cols-6 { .crawlsy-grid-cols-6 {
grid-template-columns: repeat(6, 1fr); grid-template-columns: repeat(6, 1fr);
} }
@media (max-width: 1024px) { @media (max-width: 1024px) {
.dutchie-grid-cols-4, .crawlsy-grid-cols-4,
.dutchie-grid-cols-6 { .crawlsy-grid-cols-6 {
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
} }
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.dutchie-grid-cols-3, .crawlsy-grid-cols-3,
.dutchie-grid-cols-4, .crawlsy-grid-cols-4,
.dutchie-grid-cols-6 { .crawlsy-grid-cols-6 {
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
} }
} }
@media (max-width: 480px) { @media (max-width: 480px) {
.dutchie-product-grid { .crawlsy-product-grid {
grid-template-columns: 1fr; grid-template-columns: 1fr;
} }
} }
/* Product Card */ /* Product Card */
.dutchie-product-card { .crawlsy-product-card {
background: #fff; background: #fff;
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
@@ -57,32 +57,32 @@
flex-direction: column; flex-direction: column;
} }
.dutchie-product-card:hover { .crawlsy-product-card:hover {
transform: translateY(-4px); transform: translateY(-4px);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
} }
.dutchie-product-image { .crawlsy-product-image {
width: 100%; width: 100%;
aspect-ratio: 1; aspect-ratio: 1;
overflow: hidden; overflow: hidden;
background: #f5f5f5; background: #f5f5f5;
} }
.dutchie-product-image img { .crawlsy-product-image img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
} }
.dutchie-product-content { .crawlsy-product-content {
padding: 16px; padding: 16px;
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.dutchie-product-title { .crawlsy-product-title {
font-size: 18px; font-size: 18px;
font-weight: 600; font-weight: 600;
margin: 0 0 8px 0; margin: 0 0 8px 0;
@@ -90,48 +90,48 @@
line-height: 1.4; line-height: 1.4;
} }
.dutchie-product-brand { .crawlsy-product-brand {
font-size: 14px; font-size: 14px;
color: #666; color: #666;
margin-bottom: 8px; margin-bottom: 8px;
} }
.dutchie-product-description { .crawlsy-product-description {
font-size: 14px; font-size: 14px;
color: #666; color: #666;
line-height: 1.6; line-height: 1.6;
margin: 0 0 12px 0; margin: 0 0 12px 0;
} }
.dutchie-product-meta { .crawlsy-product-meta {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 12px; gap: 12px;
margin: 12px 0; margin: 12px 0;
} }
.dutchie-meta-item { .crawlsy-meta-item {
font-size: 13px; font-size: 13px;
padding: 4px 10px; padding: 4px 10px;
border-radius: 4px; border-radius: 4px;
background: #f0f0f0; background: #f0f0f0;
} }
.dutchie-meta-item strong { .crawlsy-meta-item strong {
color: #333; color: #333;
} }
.dutchie-thc { .crawlsy-thc {
background: #e8f5e9; background: #e8f5e9;
color: #2e7d32; color: #2e7d32;
} }
.dutchie-cbd { .crawlsy-cbd {
background: #e3f2fd; background: #e3f2fd;
color: #1565c0; color: #1565c0;
} }
.dutchie-product-price { .crawlsy-product-price {
font-size: 20px; font-size: 20px;
font-weight: 700; font-weight: 700;
color: #2e7d32; color: #2e7d32;
@@ -139,7 +139,7 @@
padding-top: 12px; padding-top: 12px;
} }
.dutchie-out-of-stock { .crawlsy-out-of-stock {
display: inline-block; display: inline-block;
padding: 6px 12px; padding: 6px 12px;
background: #ffebee; background: #ffebee;
@@ -151,7 +151,7 @@
} }
/* Single Product */ /* Single Product */
.dutchie-single-product { .crawlsy-single-product {
background: #fff; background: #fff;
border-radius: 8px; border-radius: 8px;
padding: 24px; padding: 24px;
@@ -159,25 +159,25 @@
margin: 20px 0; margin: 20px 0;
} }
.dutchie-layout-horizontal { .crawlsy-layout-horizontal {
display: grid; display: grid;
grid-template-columns: 400px 1fr; grid-template-columns: 400px 1fr;
gap: 32px; gap: 32px;
} }
.dutchie-layout-vertical { .crawlsy-layout-vertical {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 24px; gap: 24px;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.dutchie-layout-horizontal { .crawlsy-layout-horizontal {
grid-template-columns: 1fr; grid-template-columns: 1fr;
} }
} }
.dutchie-single-product-image { .crawlsy-single-product-image {
width: 100%; width: 100%;
aspect-ratio: 1; aspect-ratio: 1;
overflow: hidden; overflow: hidden;
@@ -185,19 +185,19 @@
background: #f5f5f5; background: #f5f5f5;
} }
.dutchie-single-product-image img { .crawlsy-single-product-image img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
} }
.dutchie-single-product-details { .crawlsy-single-product-details {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 16px; gap: 16px;
} }
.dutchie-single-product-title { .crawlsy-single-product-title {
font-size: 28px; font-size: 28px;
font-weight: 700; font-weight: 700;
margin: 0; margin: 0;
@@ -205,22 +205,22 @@
line-height: 1.3; line-height: 1.3;
} }
.dutchie-single-product-brand { .crawlsy-single-product-brand {
font-size: 16px; font-size: 16px;
color: #666; color: #666;
} }
.dutchie-single-product-brand strong { .crawlsy-single-product-brand strong {
color: #333; color: #333;
} }
.dutchie-single-product-description { .crawlsy-single-product-description {
font-size: 16px; font-size: 16px;
line-height: 1.6; line-height: 1.6;
color: #555; color: #555;
} }
.dutchie-single-product-info { .crawlsy-single-product-info {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px; gap: 16px;
@@ -229,44 +229,44 @@
border-radius: 8px; border-radius: 8px;
} }
.dutchie-info-item { .crawlsy-info-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; gap: 4px;
} }
.dutchie-info-item strong { .crawlsy-info-item strong {
font-size: 14px; font-size: 14px;
color: #333; color: #333;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.5px; letter-spacing: 0.5px;
} }
.dutchie-info-item span { .crawlsy-info-item span {
font-size: 16px; font-size: 16px;
color: #555; color: #555;
} }
.dutchie-info-item.dutchie-terpenes span, .crawlsy-info-item.crawlsy-terpenes span,
.dutchie-info-item.dutchie-effects span, .crawlsy-info-item.crawlsy-effects span,
.dutchie-info-item.dutchie-flavors span { .crawlsy-info-item.crawlsy-flavors span {
font-size: 14px; font-size: 14px;
} }
.dutchie-single-product-price { .crawlsy-single-product-price {
font-size: 32px; font-size: 32px;
font-weight: 700; font-weight: 700;
color: #2e7d32; color: #2e7d32;
} }
/* Loading State */ /* Loading State */
.dutchie-loading { .crawlsy-loading {
text-align: center; text-align: center;
padding: 40px; padding: 40px;
color: #666; color: #666;
} }
.dutchie-loading:after { .crawlsy-loading:after {
content: "..."; content: "...";
animation: dots 1.5s steps(4, end) infinite; animation: dots 1.5s steps(4, end) infinite;
} }
@@ -293,7 +293,7 @@
} }
/* Error State */ /* Error State */
.dutchie-error { .crawlsy-error {
padding: 16px; padding: 16px;
background: #ffebee; background: #ffebee;
color: #c62828; color: #c62828;

View File

@@ -1,5 +1,5 @@
/** /**
* Dutchie Menus - WordPress Plugin JavaScript * Crawlsy Menus - WordPress Plugin JavaScript
*/ */
(function($) { (function($) {
@@ -24,7 +24,7 @@
}); });
}); });
document.querySelectorAll('.dutchie-product-image img[data-src]').forEach(img => { document.querySelectorAll('.crawlsy-product-image img[data-src]').forEach(img => {
imageObserver.observe(img); imageObserver.observe(img);
}); });
} }
@@ -48,7 +48,7 @@
threshold: 0.1 threshold: 0.1
}); });
document.querySelectorAll('.dutchie-product-card').forEach(card => { document.querySelectorAll('.crawlsy-product-card').forEach(card => {
cardObserver.observe(card); cardObserver.observe(card);
}); });
} }

View File

@@ -1,13 +1,13 @@
<?php <?php
/** /**
* Plugin Name: Dutchie Menus * Plugin Name: Crawlsy Menus
* Plugin URI: https://creationshop.io * Plugin URI: https://creationshop.io
* Description: Display cannabis product menus from your Dutchie scraper with Elementor integration * Description: Display cannabis product menus from Crawlsy with Elementor integration
* Version: 1.3.0 * Version: 1.3.0
* Author: Creationshop * Author: Creationshop
* Author URI: https://creationshop.io * Author URI: https://creationshop.io
* License: GPL v2 or later * License: GPL v2 or later
* Text Domain: dutchie-menus * Text Domain: crawlsy-menus
* Requires PHP: 7.4 * Requires PHP: 7.4
*/ */
@@ -15,15 +15,15 @@ if (!defined('ABSPATH')) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
define('DUTCHIE_MENUS_VERSION', '1.3.0'); define('CRAWLSY_MENUS_VERSION', '1.3.0');
define('DUTCHIE_MENUS_API_URL', 'https://dispos.crawlsy.com/api'); define('CRAWLSY_MENUS_API_URL', 'https://dispos.crawlsy.com/api');
define('DUTCHIE_MENUS_PLUGIN_DIR', plugin_dir_path(__FILE__)); define('CRAWLSY_MENUS_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('DUTCHIE_MENUS_PLUGIN_URL', plugin_dir_url(__FILE__)); define('CRAWLSY_MENUS_PLUGIN_URL', plugin_dir_url(__FILE__));
/** /**
* Main Plugin Class * Main Plugin Class
*/ */
class Dutchie_Menus_Plugin { class Crawlsy_Menus_Plugin {
private static $instance = null; private static $instance = null;
@@ -44,9 +44,12 @@ class Dutchie_Menus_Plugin {
public function init() { public function init() {
// Initialize plugin // Initialize plugin
load_plugin_textdomain('dutchie-menus', false, dirname(plugin_basename(__FILE__)) . '/languages'); load_plugin_textdomain('crawlsy-menus', false, dirname(plugin_basename(__FILE__)) . '/languages');
// Register shortcodes // Register shortcodes (keeping backward compatible shortcode names)
add_shortcode('crawlsy_products', [$this, 'products_shortcode']);
add_shortcode('crawlsy_product', [$this, 'single_product_shortcode']);
// Legacy shortcode support
add_shortcode('dutchie_products', [$this, 'products_shortcode']); add_shortcode('dutchie_products', [$this, 'products_shortcode']);
add_shortcode('dutchie_product', [$this, 'single_product_shortcode']); add_shortcode('dutchie_product', [$this, 'single_product_shortcode']);
} }
@@ -55,11 +58,11 @@ class Dutchie_Menus_Plugin {
* Register Elementor Widgets * Register Elementor Widgets
*/ */
public function register_elementor_widgets($widgets_manager) { public function register_elementor_widgets($widgets_manager) {
require_once DUTCHIE_MENUS_PLUGIN_DIR . 'widgets/product-grid.php'; require_once CRAWLSY_MENUS_PLUGIN_DIR . 'widgets/product-grid.php';
require_once DUTCHIE_MENUS_PLUGIN_DIR . 'widgets/single-product.php'; require_once CRAWLSY_MENUS_PLUGIN_DIR . 'widgets/single-product.php';
$widgets_manager->register(new \Dutchie_Menus_Product_Grid_Widget()); $widgets_manager->register(new \Crawlsy_Menus_Product_Grid_Widget());
$widgets_manager->register(new \Dutchie_Menus_Single_Product_Widget()); $widgets_manager->register(new \Crawlsy_Menus_Single_Product_Widget());
} }
/** /**
@@ -67,17 +70,17 @@ class Dutchie_Menus_Plugin {
*/ */
public function enqueue_scripts() { public function enqueue_scripts() {
wp_enqueue_style( wp_enqueue_style(
'dutchie-menus-styles', 'crawlsy-menus-styles',
DUTCHIE_MENUS_PLUGIN_URL . 'assets/css/dutchie-menus.css', CRAWLSY_MENUS_PLUGIN_URL . 'assets/css/crawlsy-menus.css',
[], [],
DUTCHIE_MENUS_VERSION CRAWLSY_MENUS_VERSION
); );
wp_enqueue_script( wp_enqueue_script(
'dutchie-menus-script', 'crawlsy-menus-script',
DUTCHIE_MENUS_PLUGIN_URL . 'assets/js/dutchie-menus.js', CRAWLSY_MENUS_PLUGIN_URL . 'assets/js/crawlsy-menus.js',
['jquery'], ['jquery'],
DUTCHIE_MENUS_VERSION, CRAWLSY_MENUS_VERSION,
true true
); );
} }
@@ -87,10 +90,10 @@ class Dutchie_Menus_Plugin {
*/ */
public function add_admin_menu() { public function add_admin_menu() {
add_menu_page( add_menu_page(
'Dutchie Menus', 'Crawlsy Menus',
'Dutchie Menus', 'Crawlsy Menus',
'manage_options', 'manage_options',
'dutchie-menus', 'crawlsy-menus',
[$this, 'admin_page'], [$this, 'admin_page'],
'dashicons-products', 'dashicons-products',
30 30
@@ -101,7 +104,13 @@ class Dutchie_Menus_Plugin {
* Register Plugin Settings * Register Plugin Settings
*/ */
public function register_settings() { public function register_settings() {
register_setting('dutchie_menus_settings', 'dutchie_api_token'); register_setting('crawlsy_menus_settings', 'crawlsy_api_token');
// Migrate old setting if exists
$old_token = get_option('dutchie_api_token');
if ($old_token && !get_option('crawlsy_api_token')) {
update_option('crawlsy_api_token', $old_token);
}
} }
/** /**
@@ -110,19 +119,19 @@ class Dutchie_Menus_Plugin {
public function admin_page() { public function admin_page() {
?> ?>
<div class="wrap"> <div class="wrap">
<h1>Dutchie Menus Settings</h1> <h1>Crawlsy Menus Settings</h1>
<p>Version <?php echo DUTCHIE_MENUS_VERSION; ?> by <a href="https://creationshop.io" target="_blank">Creationshop</a></p> <p>Version <?php echo CRAWLSY_MENUS_VERSION; ?> by <a href="https://creationshop.io" target="_blank">Creationshop</a></p>
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php settings_fields('dutchie_menus_settings'); ?> <?php settings_fields('crawlsy_menus_settings'); ?>
<?php do_settings_sections('dutchie_menus_settings'); ?> <?php do_settings_sections('crawlsy_menus_settings'); ?>
<table class="form-table"> <table class="form-table">
<tr> <tr>
<th scope="row"><label for="dutchie_api_token">API Token</label></th> <th scope="row"><label for="crawlsy_api_token">API Token</label></th>
<td> <td>
<input type="password" id="dutchie_api_token" name="dutchie_api_token" <input type="password" id="crawlsy_api_token" name="crawlsy_api_token"
value="<?php echo esc_attr(get_option('dutchie_api_token')); ?>" value="<?php echo esc_attr(get_option('crawlsy_api_token')); ?>"
class="regular-text" /> class="regular-text" />
<p class="description">Your authentication token from the admin dashboard. The token includes your store configuration.</p> <p class="description">Your authentication token from the admin dashboard. The token includes your store configuration.</p>
</td> </td>
@@ -141,8 +150,8 @@ class Dutchie_Menus_Plugin {
<script> <script>
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
$('#test-api-connection').on('click', function() { $('#test-api-connection').on('click', function() {
var apiUrl = '<?php echo DUTCHIE_MENUS_API_URL; ?>'; var apiUrl = '<?php echo CRAWLSY_MENUS_API_URL; ?>';
var apiToken = $('#dutchie_api_token').val(); var apiToken = $('#crawlsy_api_token').val();
$('#api-test-result').html('<p>Testing connection...</p>'); $('#api-test-result').html('<p>Testing connection...</p>');
@@ -190,7 +199,7 @@ class Dutchie_Menus_Plugin {
} }
ob_start(); ob_start();
include DUTCHIE_MENUS_PLUGIN_DIR . 'templates/product-grid.php'; include CRAWLSY_MENUS_PLUGIN_DIR . 'templates/product-grid.php';
return ob_get_clean(); return ob_get_clean();
} }
@@ -213,7 +222,7 @@ class Dutchie_Menus_Plugin {
} }
ob_start(); ob_start();
include DUTCHIE_MENUS_PLUGIN_DIR . 'templates/single-product.php'; include CRAWLSY_MENUS_PLUGIN_DIR . 'templates/single-product.php';
return ob_get_clean(); return ob_get_clean();
} }
@@ -221,14 +230,14 @@ class Dutchie_Menus_Plugin {
* Fetch Products from API * Fetch Products from API
*/ */
public function fetch_products($args = []) { public function fetch_products($args = []) {
$api_token = get_option('dutchie_api_token'); $api_token = get_option('crawlsy_api_token');
if (!$api_token) { if (!$api_token) {
return false; return false;
} }
$query_args = http_build_query($args); $query_args = http_build_query($args);
$url = DUTCHIE_MENUS_API_URL . '/products?' . $query_args; $url = CRAWLSY_MENUS_API_URL . '/products?' . $query_args;
$response = wp_remote_get($url, [ $response = wp_remote_get($url, [
'headers' => [ 'headers' => [
@@ -251,13 +260,13 @@ class Dutchie_Menus_Plugin {
* Fetch Single Product from API * Fetch Single Product from API
*/ */
public function fetch_product($id) { public function fetch_product($id) {
$api_token = get_option('dutchie_api_token'); $api_token = get_option('crawlsy_api_token');
if (!$api_token) { if (!$api_token) {
return false; return false;
} }
$url = DUTCHIE_MENUS_API_URL . '/products/' . intval($id); $url = CRAWLSY_MENUS_API_URL . '/products/' . intval($id);
$response = wp_remote_get($url, [ $response = wp_remote_get($url, [
'headers' => [ 'headers' => [
@@ -278,8 +287,8 @@ class Dutchie_Menus_Plugin {
} }
// Initialize Plugin // Initialize Plugin
function dutchie_menus() { function crawlsy_menus() {
return Dutchie_Menus_Plugin::instance(); return Crawlsy_Menus_Plugin::instance();
} }
dutchie_menus(); crawlsy_menus();

View File

@@ -10,57 +10,57 @@ if (!defined('ABSPATH')) {
$columns = isset($atts['columns']) ? $atts['columns'] : 3; $columns = isset($atts['columns']) ? $atts['columns'] : 3;
?> ?>
<div class="dutchie-product-grid dutchie-grid-cols-<?php echo esc_attr($columns); ?>"> <div class="crawlsy-product-grid crawlsy-grid-cols-<?php echo esc_attr($columns); ?>">
<?php foreach ($products as $product): ?> <?php foreach ($products as $product): ?>
<div class="dutchie-product-card"> <div class="crawlsy-product-card">
<?php if (!empty($product['image_url_full'])): ?> <?php if (!empty($product['image_url_full'])): ?>
<div class="dutchie-product-image"> <div class="crawlsy-product-image">
<img src="<?php echo esc_url($product['image_url_full']); ?>" <img src="<?php echo esc_url($product['image_url_full']); ?>"
alt="<?php echo esc_attr($product['name']); ?>" alt="<?php echo esc_attr($product['name']); ?>"
loading="lazy" /> loading="lazy" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="dutchie-product-content"> <div class="crawlsy-product-content">
<h3 class="dutchie-product-title"> <h3 class="crawlsy-product-title">
<?php echo esc_html($product['name']); ?> <?php echo esc_html($product['name']); ?>
</h3> </h3>
<?php if (!empty($product['brand'])): ?> <?php if (!empty($product['brand'])): ?>
<div class="dutchie-product-brand"> <div class="crawlsy-product-brand">
<?php echo esc_html($product['brand']); ?> <?php echo esc_html($product['brand']); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($product['description'])): ?> <?php if (!empty($product['description'])): ?>
<p class="dutchie-product-description"> <p class="crawlsy-product-description">
<?php echo esc_html(wp_trim_words($product['description'], 15)); ?> <?php echo esc_html(wp_trim_words($product['description'], 15)); ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
<div class="dutchie-product-meta"> <div class="crawlsy-product-meta">
<?php if (!empty($product['metadata']['thc'])): ?> <?php if (!empty($product['metadata']['thc'])): ?>
<span class="dutchie-meta-item dutchie-thc"> <span class="crawlsy-meta-item crawlsy-thc">
<strong>THC:</strong> <?php echo esc_html($product['metadata']['thc']); ?> <strong>THC:</strong> <?php echo esc_html($product['metadata']['thc']); ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($product['metadata']['cbd'])): ?> <?php if (!empty($product['metadata']['cbd'])): ?>
<span class="dutchie-meta-item dutchie-cbd"> <span class="crawlsy-meta-item crawlsy-cbd">
<strong>CBD:</strong> <?php echo esc_html($product['metadata']['cbd']); ?> <strong>CBD:</strong> <?php echo esc_html($product['metadata']['cbd']); ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php if (isset($product['price'])): ?> <?php if (isset($product['price'])): ?>
<div class="dutchie-product-price"> <div class="crawlsy-product-price">
$<?php echo number_format($product['price'], 2); ?> $<?php echo number_format($product['price'], 2); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!$product['in_stock']): ?> <?php if (!$product['in_stock']): ?>
<div class="dutchie-out-of-stock"> <div class="crawlsy-out-of-stock">
<?php _e('Out of Stock', 'dutchie-menus'); ?> <?php _e('Out of Stock', 'crawlsy-menus'); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@@ -8,50 +8,50 @@ if (!defined('ABSPATH')) {
} }
?> ?>
<div class="dutchie-single-product dutchie-layout-horizontal"> <div class="crawlsy-single-product crawlsy-layout-horizontal">
<?php if (!empty($product['image_url_full'])): ?> <?php if (!empty($product['image_url_full'])): ?>
<div class="dutchie-single-product-image"> <div class="crawlsy-single-product-image">
<img src="<?php echo esc_url($product['image_url_full']); ?>" <img src="<?php echo esc_url($product['image_url_full']); ?>"
alt="<?php echo esc_attr($product['name']); ?>" /> alt="<?php echo esc_attr($product['name']); ?>" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="dutchie-single-product-details"> <div class="crawlsy-single-product-details">
<h2 class="dutchie-single-product-title"> <h2 class="crawlsy-single-product-title">
<?php echo esc_html($product['name']); ?> <?php echo esc_html($product['name']); ?>
</h2> </h2>
<?php if (!empty($product['brand'])): ?> <?php if (!empty($product['brand'])): ?>
<div class="dutchie-single-product-brand"> <div class="crawlsy-single-product-brand">
<strong><?php _e('Brand:', 'dutchie-menus'); ?></strong> <strong><?php _e('Brand:', 'crawlsy-menus'); ?></strong>
<?php echo esc_html($product['brand']); ?> <?php echo esc_html($product['brand']); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($product['description'])): ?> <?php if (!empty($product['description'])): ?>
<div class="dutchie-single-product-description"> <div class="crawlsy-single-product-description">
<?php echo wp_kses_post(nl2br($product['description'])); ?> <?php echo wp_kses_post(nl2br($product['description'])); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="dutchie-single-product-info"> <div class="crawlsy-single-product-info">
<?php if (!empty($product['metadata']['thc'])): ?> <?php if (!empty($product['metadata']['thc'])): ?>
<div class="dutchie-info-item"> <div class="crawlsy-info-item">
<strong><?php _e('THC:', 'dutchie-menus'); ?></strong> <strong><?php _e('THC:', 'crawlsy-menus'); ?></strong>
<span><?php echo esc_html($product['metadata']['thc']); ?></span> <span><?php echo esc_html($product['metadata']['thc']); ?></span>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($product['metadata']['cbd'])): ?> <?php if (!empty($product['metadata']['cbd'])): ?>
<div class="dutchie-info-item"> <div class="crawlsy-info-item">
<strong><?php _e('CBD:', 'dutchie-menus'); ?></strong> <strong><?php _e('CBD:', 'crawlsy-menus'); ?></strong>
<span><?php echo esc_html($product['metadata']['cbd']); ?></span> <span><?php echo esc_html($product['metadata']['cbd']); ?></span>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($product['metadata']['terpenes'])): ?> <?php if (!empty($product['metadata']['terpenes'])): ?>
<div class="dutchie-info-item dutchie-terpenes"> <div class="crawlsy-info-item crawlsy-terpenes">
<strong><?php _e('Terpenes:', 'dutchie-menus'); ?></strong> <strong><?php _e('Terpenes:', 'crawlsy-menus'); ?></strong>
<?php if (is_array($product['metadata']['terpenes'])): ?> <?php if (is_array($product['metadata']['terpenes'])): ?>
<span><?php echo esc_html(implode(', ', $product['metadata']['terpenes'])); ?></span> <span><?php echo esc_html(implode(', ', $product['metadata']['terpenes'])); ?></span>
<?php else: ?> <?php else: ?>
@@ -61,8 +61,8 @@ if (!defined('ABSPATH')) {
<?php endif; ?> <?php endif; ?>
<?php if (!empty($product['metadata']['effects'])): ?> <?php if (!empty($product['metadata']['effects'])): ?>
<div class="dutchie-info-item dutchie-effects"> <div class="crawlsy-info-item crawlsy-effects">
<strong><?php _e('Effects:', 'dutchie-menus'); ?></strong> <strong><?php _e('Effects:', 'crawlsy-menus'); ?></strong>
<?php if (is_array($product['metadata']['effects'])): ?> <?php if (is_array($product['metadata']['effects'])): ?>
<span><?php echo esc_html(implode(', ', $product['metadata']['effects'])); ?></span> <span><?php echo esc_html(implode(', ', $product['metadata']['effects'])); ?></span>
<?php else: ?> <?php else: ?>
@@ -72,8 +72,8 @@ if (!defined('ABSPATH')) {
<?php endif; ?> <?php endif; ?>
<?php if (!empty($product['metadata']['flavors'])): ?> <?php if (!empty($product['metadata']['flavors'])): ?>
<div class="dutchie-info-item dutchie-flavors"> <div class="crawlsy-info-item crawlsy-flavors">
<strong><?php _e('Flavors:', 'dutchie-menus'); ?></strong> <strong><?php _e('Flavors:', 'crawlsy-menus'); ?></strong>
<?php if (is_array($product['metadata']['flavors'])): ?> <?php if (is_array($product['metadata']['flavors'])): ?>
<span><?php echo esc_html(implode(', ', $product['metadata']['flavors'])); ?></span> <span><?php echo esc_html(implode(', ', $product['metadata']['flavors'])); ?></span>
<?php else: ?> <?php else: ?>
@@ -84,14 +84,14 @@ if (!defined('ABSPATH')) {
</div> </div>
<?php if (isset($product['price'])): ?> <?php if (isset($product['price'])): ?>
<div class="dutchie-single-product-price"> <div class="crawlsy-single-product-price">
$<?php echo number_format($product['price'], 2); ?> $<?php echo number_format($product['price'], 2); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!$product['in_stock']): ?> <?php if (!$product['in_stock']): ?>
<div class="dutchie-out-of-stock"> <div class="crawlsy-out-of-stock">
<?php _e('Out of Stock', 'dutchie-menus'); ?> <?php _e('Out of Stock', 'crawlsy-menus'); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@@ -7,14 +7,14 @@ if (!defined('ABSPATH')) {
exit; exit;
} }
class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base { class Crawlsy_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
public function get_name() { public function get_name() {
return 'dutchie_product_grid'; return 'crawlsy_product_grid';
} }
public function get_title() { public function get_title() {
return __('Dutchie Product Grid', 'dutchie-menus'); return __('Crawlsy Product Grid', 'crawlsy-menus');
} }
public function get_icon() { public function get_icon() {
@@ -31,7 +31,7 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->start_controls_section( $this->start_controls_section(
'content_section', 'content_section',
[ [
'label' => __('Content', 'dutchie-menus'), 'label' => __('Content', 'crawlsy-menus'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
] ]
); );
@@ -39,9 +39,9 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'store_id', 'store_id',
[ [
'label' => __('Store ID', 'dutchie-menus'), 'label' => __('Store ID', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::NUMBER, 'type' => \Elementor\Controls_Manager::NUMBER,
'default' => get_option('dutchie_default_store_id', 1), 'default' => get_option('crawlsy_default_store_id', 1),
'min' => 1, 'min' => 1,
] ]
); );
@@ -49,17 +49,17 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'category_id', 'category_id',
[ [
'label' => __('Category ID', 'dutchie-menus'), 'label' => __('Category ID', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::NUMBER, 'type' => \Elementor\Controls_Manager::NUMBER,
'default' => '', 'default' => '',
'description' => __('Leave empty to show all categories', 'dutchie-menus'), 'description' => __('Leave empty to show all categories', 'crawlsy-menus'),
] ]
); );
$this->add_control( $this->add_control(
'limit', 'limit',
[ [
'label' => __('Number of Products', 'dutchie-menus'), 'label' => __('Number of Products', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::NUMBER, 'type' => \Elementor\Controls_Manager::NUMBER,
'default' => 12, 'default' => 12,
'min' => 1, 'min' => 1,
@@ -70,14 +70,14 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'columns', 'columns',
[ [
'label' => __('Columns', 'dutchie-menus'), 'label' => __('Columns', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SELECT, 'type' => \Elementor\Controls_Manager::SELECT,
'default' => '3', 'default' => '3',
'options' => [ 'options' => [
'2' => __('2 Columns', 'dutchie-menus'), '2' => __('2 Columns', 'crawlsy-menus'),
'3' => __('3 Columns', 'dutchie-menus'), '3' => __('3 Columns', 'crawlsy-menus'),
'4' => __('4 Columns', 'dutchie-menus'), '4' => __('4 Columns', 'crawlsy-menus'),
'6' => __('6 Columns', 'dutchie-menus'), '6' => __('6 Columns', 'crawlsy-menus'),
], ],
] ]
); );
@@ -85,10 +85,10 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'in_stock_only', 'in_stock_only',
[ [
'label' => __('In Stock Only', 'dutchie-menus'), 'label' => __('In Stock Only', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -97,10 +97,10 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'search', 'search',
[ [
'label' => __('Search Filter', 'dutchie-menus'), 'label' => __('Search Filter', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::TEXT, 'type' => \Elementor\Controls_Manager::TEXT,
'default' => '', 'default' => '',
'description' => __('Filter products by name', 'dutchie-menus'), 'description' => __('Filter products by name', 'crawlsy-menus'),
] ]
); );
@@ -110,7 +110,7 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->start_controls_section( $this->start_controls_section(
'display_section', 'display_section',
[ [
'label' => __('Display Options', 'dutchie-menus'), 'label' => __('Display Options', 'crawlsy-menus'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
] ]
); );
@@ -118,10 +118,10 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_image', 'show_image',
[ [
'label' => __('Show Image', 'dutchie-menus'), 'label' => __('Show Image', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -130,10 +130,10 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_price', 'show_price',
[ [
'label' => __('Show Price', 'dutchie-menus'), 'label' => __('Show Price', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -142,10 +142,10 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_thc', 'show_thc',
[ [
'label' => __('Show THC', 'dutchie-menus'), 'label' => __('Show THC', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -154,10 +154,10 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_cbd', 'show_cbd',
[ [
'label' => __('Show CBD', 'dutchie-menus'), 'label' => __('Show CBD', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -166,10 +166,10 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_description', 'show_description',
[ [
'label' => __('Show Description', 'dutchie-menus'), 'label' => __('Show Description', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'no', 'default' => 'no',
] ]
@@ -181,7 +181,7 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->start_controls_section( $this->start_controls_section(
'style_section', 'style_section',
[ [
'label' => __('Style', 'dutchie-menus'), 'label' => __('Style', 'crawlsy-menus'),
'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
] ]
); );
@@ -189,11 +189,11 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'card_background', 'card_background',
[ [
'label' => __('Card Background', 'dutchie-menus'), 'label' => __('Card Background', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::COLOR, 'type' => \Elementor\Controls_Manager::COLOR,
'default' => '#ffffff', 'default' => '#ffffff',
'selectors' => [ 'selectors' => [
'{{WRAPPER}} .dutchie-product-card' => 'background-color: {{VALUE}};', '{{WRAPPER}} .crawlsy-product-card' => 'background-color: {{VALUE}};',
], ],
] ]
); );
@@ -201,7 +201,7 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'card_border_radius', 'card_border_radius',
[ [
'label' => __('Border Radius', 'dutchie-menus'), 'label' => __('Border Radius', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SLIDER, 'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => ['px'], 'size_units' => ['px'],
'range' => [ 'range' => [
@@ -214,7 +214,7 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
'size' => 8, 'size' => 8,
], ],
'selectors' => [ 'selectors' => [
'{{WRAPPER}} .dutchie-product-card' => 'border-radius: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .crawlsy-product-card' => 'border-radius: {{SIZE}}{{UNIT}};',
], ],
] ]
); );
@@ -222,11 +222,11 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'text_color', 'text_color',
[ [
'label' => __('Text Color', 'dutchie-menus'), 'label' => __('Text Color', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::COLOR, 'type' => \Elementor\Controls_Manager::COLOR,
'default' => '#333333', 'default' => '#333333',
'selectors' => [ 'selectors' => [
'{{WRAPPER}} .dutchie-product-card' => 'color: {{VALUE}};', '{{WRAPPER}} .crawlsy-product-card' => 'color: {{VALUE}};',
], ],
] ]
); );
@@ -251,61 +251,61 @@ class Dutchie_Menus_Product_Grid_Widget extends \Elementor\Widget_Base {
$args['search'] = $settings['search']; $args['search'] = $settings['search'];
} }
$plugin = Dutchie_Menus_Plugin::instance(); $plugin = Crawlsy_Menus_Plugin::instance();
$products = $plugin->fetch_products($args); $products = $plugin->fetch_products($args);
if (!$products) { if (!$products) {
echo '<p>' . __('No products found.', 'dutchie-menus') . '</p>'; echo '<p>' . __('No products found.', 'crawlsy-menus') . '</p>';
return; return;
} }
$columns = $settings['columns']; $columns = $settings['columns'];
?> ?>
<div class="dutchie-product-grid dutchie-grid-cols-<?php echo esc_attr($columns); ?>"> <div class="crawlsy-product-grid crawlsy-grid-cols-<?php echo esc_attr($columns); ?>">
<?php foreach ($products as $product): ?> <?php foreach ($products as $product): ?>
<div class="dutchie-product-card"> <div class="crawlsy-product-card">
<?php if ($settings['show_image'] === 'yes' && !empty($product['image_url_full'])): ?> <?php if ($settings['show_image'] === 'yes' && !empty($product['image_url_full'])): ?>
<div class="dutchie-product-image"> <div class="crawlsy-product-image">
<img src="<?php echo esc_url($product['image_url_full']); ?>" <img src="<?php echo esc_url($product['image_url_full']); ?>"
alt="<?php echo esc_attr($product['name']); ?>" alt="<?php echo esc_attr($product['name']); ?>"
loading="lazy" /> loading="lazy" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="dutchie-product-content"> <div class="crawlsy-product-content">
<h3 class="dutchie-product-title"> <h3 class="crawlsy-product-title">
<?php echo esc_html($product['name']); ?> <?php echo esc_html($product['name']); ?>
</h3> </h3>
<?php if ($settings['show_description'] === 'yes' && !empty($product['description'])): ?> <?php if ($settings['show_description'] === 'yes' && !empty($product['description'])): ?>
<p class="dutchie-product-description"> <p class="crawlsy-product-description">
<?php echo esc_html(wp_trim_words($product['description'], 15)); ?> <?php echo esc_html(wp_trim_words($product['description'], 15)); ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
<div class="dutchie-product-meta"> <div class="crawlsy-product-meta">
<?php if ($settings['show_thc'] === 'yes' && !empty($product['metadata']['thc'])): ?> <?php if ($settings['show_thc'] === 'yes' && !empty($product['metadata']['thc'])): ?>
<span class="dutchie-meta-item dutchie-thc"> <span class="crawlsy-meta-item crawlsy-thc">
<strong>THC:</strong> <?php echo esc_html($product['metadata']['thc']); ?> <strong>THC:</strong> <?php echo esc_html($product['metadata']['thc']); ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
<?php if ($settings['show_cbd'] === 'yes' && !empty($product['metadata']['cbd'])): ?> <?php if ($settings['show_cbd'] === 'yes' && !empty($product['metadata']['cbd'])): ?>
<span class="dutchie-meta-item dutchie-cbd"> <span class="crawlsy-meta-item crawlsy-cbd">
<strong>CBD:</strong> <?php echo esc_html($product['metadata']['cbd']); ?> <strong>CBD:</strong> <?php echo esc_html($product['metadata']['cbd']); ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php if ($settings['show_price'] === 'yes' && isset($product['price'])): ?> <?php if ($settings['show_price'] === 'yes' && isset($product['price'])): ?>
<div class="dutchie-product-price"> <div class="crawlsy-product-price">
$<?php echo number_format($product['price'], 2); ?> $<?php echo number_format($product['price'], 2); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!$product['in_stock']): ?> <?php if (!$product['in_stock']): ?>
<div class="dutchie-out-of-stock"> <div class="crawlsy-out-of-stock">
<?php _e('Out of Stock', 'dutchie-menus'); ?> <?php _e('Out of Stock', 'crawlsy-menus'); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@@ -7,14 +7,14 @@ if (!defined('ABSPATH')) {
exit; exit;
} }
class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base { class Crawlsy_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
public function get_name() { public function get_name() {
return 'dutchie_single_product'; return 'crawlsy_single_product';
} }
public function get_title() { public function get_title() {
return __('Dutchie Single Product', 'dutchie-menus'); return __('Crawlsy Single Product', 'crawlsy-menus');
} }
public function get_icon() { public function get_icon() {
@@ -31,7 +31,7 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->start_controls_section( $this->start_controls_section(
'content_section', 'content_section',
[ [
'label' => __('Content', 'dutchie-menus'), 'label' => __('Content', 'crawlsy-menus'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
] ]
); );
@@ -39,22 +39,22 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'product_id', 'product_id',
[ [
'label' => __('Product ID', 'dutchie-menus'), 'label' => __('Product ID', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::NUMBER, 'type' => \Elementor\Controls_Manager::NUMBER,
'default' => '', 'default' => '',
'description' => __('Enter the product ID to display', 'dutchie-menus'), 'description' => __('Enter the product ID to display', 'crawlsy-menus'),
] ]
); );
$this->add_control( $this->add_control(
'layout', 'layout',
[ [
'label' => __('Layout', 'dutchie-menus'), 'label' => __('Layout', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SELECT, 'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'horizontal', 'default' => 'horizontal',
'options' => [ 'options' => [
'horizontal' => __('Horizontal', 'dutchie-menus'), 'horizontal' => __('Horizontal', 'crawlsy-menus'),
'vertical' => __('Vertical', 'dutchie-menus'), 'vertical' => __('Vertical', 'crawlsy-menus'),
], ],
] ]
); );
@@ -65,7 +65,7 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->start_controls_section( $this->start_controls_section(
'display_section', 'display_section',
[ [
'label' => __('Display Options', 'dutchie-menus'), 'label' => __('Display Options', 'crawlsy-menus'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
] ]
); );
@@ -73,10 +73,10 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_image', 'show_image',
[ [
'label' => __('Show Image', 'dutchie-menus'), 'label' => __('Show Image', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -85,10 +85,10 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_price', 'show_price',
[ [
'label' => __('Show Price', 'dutchie-menus'), 'label' => __('Show Price', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -97,10 +97,10 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_description', 'show_description',
[ [
'label' => __('Show Description', 'dutchie-menus'), 'label' => __('Show Description', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -109,10 +109,10 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_thc', 'show_thc',
[ [
'label' => __('Show THC', 'dutchie-menus'), 'label' => __('Show THC', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -121,10 +121,10 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_cbd', 'show_cbd',
[ [
'label' => __('Show CBD', 'dutchie-menus'), 'label' => __('Show CBD', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -133,10 +133,10 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_terpenes', 'show_terpenes',
[ [
'label' => __('Show Terpenes', 'dutchie-menus'), 'label' => __('Show Terpenes', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -145,10 +145,10 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_effects', 'show_effects',
[ [
'label' => __('Show Effects', 'dutchie-menus'), 'label' => __('Show Effects', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -157,10 +157,10 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'show_brand', 'show_brand',
[ [
'label' => __('Show Brand', 'dutchie-menus'), 'label' => __('Show Brand', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SWITCHER, 'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Yes', 'dutchie-menus'), 'label_on' => __('Yes', 'crawlsy-menus'),
'label_off' => __('No', 'dutchie-menus'), 'label_off' => __('No', 'crawlsy-menus'),
'return_value' => 'yes', 'return_value' => 'yes',
'default' => 'yes', 'default' => 'yes',
] ]
@@ -172,7 +172,7 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->start_controls_section( $this->start_controls_section(
'style_section', 'style_section',
[ [
'label' => __('Style', 'dutchie-menus'), 'label' => __('Style', 'crawlsy-menus'),
'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
] ]
); );
@@ -180,11 +180,11 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'background_color', 'background_color',
[ [
'label' => __('Background Color', 'dutchie-menus'), 'label' => __('Background Color', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::COLOR, 'type' => \Elementor\Controls_Manager::COLOR,
'default' => '#ffffff', 'default' => '#ffffff',
'selectors' => [ 'selectors' => [
'{{WRAPPER}} .dutchie-single-product' => 'background-color: {{VALUE}};', '{{WRAPPER}} .crawlsy-single-product' => 'background-color: {{VALUE}};',
], ],
] ]
); );
@@ -192,7 +192,7 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'border_radius', 'border_radius',
[ [
'label' => __('Border Radius', 'dutchie-menus'), 'label' => __('Border Radius', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::SLIDER, 'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => ['px'], 'size_units' => ['px'],
'range' => [ 'range' => [
@@ -205,7 +205,7 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
'size' => 8, 'size' => 8,
], ],
'selectors' => [ 'selectors' => [
'{{WRAPPER}} .dutchie-single-product' => 'border-radius: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .crawlsy-single-product' => 'border-radius: {{SIZE}}{{UNIT}};',
], ],
] ]
); );
@@ -213,11 +213,11 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$this->add_control( $this->add_control(
'text_color', 'text_color',
[ [
'label' => __('Text Color', 'dutchie-menus'), 'label' => __('Text Color', 'crawlsy-menus'),
'type' => \Elementor\Controls_Manager::COLOR, 'type' => \Elementor\Controls_Manager::COLOR,
'default' => '#333333', 'default' => '#333333',
'selectors' => [ 'selectors' => [
'{{WRAPPER}} .dutchie-single-product' => 'color: {{VALUE}};', '{{WRAPPER}} .crawlsy-single-product' => 'color: {{VALUE}};',
], ],
] ]
); );
@@ -229,64 +229,64 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
$settings = $this->get_settings_for_display(); $settings = $this->get_settings_for_display();
if (empty($settings['product_id'])) { if (empty($settings['product_id'])) {
echo '<p>' . __('Please enter a product ID.', 'dutchie-menus') . '</p>'; echo '<p>' . __('Please enter a product ID.', 'crawlsy-menus') . '</p>';
return; return;
} }
$plugin = Dutchie_Menus_Plugin::instance(); $plugin = Crawlsy_Menus_Plugin::instance();
$product = $plugin->fetch_product($settings['product_id']); $product = $plugin->fetch_product($settings['product_id']);
if (!$product) { if (!$product) {
echo '<p>' . __('Product not found.', 'dutchie-menus') . '</p>'; echo '<p>' . __('Product not found.', 'crawlsy-menus') . '</p>';
return; return;
} }
$layout = $settings['layout']; $layout = $settings['layout'];
?> ?>
<div class="dutchie-single-product dutchie-layout-<?php echo esc_attr($layout); ?>"> <div class="crawlsy-single-product crawlsy-layout-<?php echo esc_attr($layout); ?>">
<?php if ($settings['show_image'] === 'yes' && !empty($product['image_url_full'])): ?> <?php if ($settings['show_image'] === 'yes' && !empty($product['image_url_full'])): ?>
<div class="dutchie-single-product-image"> <div class="crawlsy-single-product-image">
<img src="<?php echo esc_url($product['image_url_full']); ?>" <img src="<?php echo esc_url($product['image_url_full']); ?>"
alt="<?php echo esc_attr($product['name']); ?>" /> alt="<?php echo esc_attr($product['name']); ?>" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="dutchie-single-product-details"> <div class="crawlsy-single-product-details">
<h2 class="dutchie-single-product-title"> <h2 class="crawlsy-single-product-title">
<?php echo esc_html($product['name']); ?> <?php echo esc_html($product['name']); ?>
</h2> </h2>
<?php if ($settings['show_brand'] === 'yes' && !empty($product['brand'])): ?> <?php if ($settings['show_brand'] === 'yes' && !empty($product['brand'])): ?>
<div class="dutchie-single-product-brand"> <div class="crawlsy-single-product-brand">
<strong><?php _e('Brand:', 'dutchie-menus'); ?></strong> <strong><?php _e('Brand:', 'crawlsy-menus'); ?></strong>
<?php echo esc_html($product['brand']); ?> <?php echo esc_html($product['brand']); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if ($settings['show_description'] === 'yes' && !empty($product['description'])): ?> <?php if ($settings['show_description'] === 'yes' && !empty($product['description'])): ?>
<div class="dutchie-single-product-description"> <div class="crawlsy-single-product-description">
<?php echo wp_kses_post(nl2br($product['description'])); ?> <?php echo wp_kses_post(nl2br($product['description'])); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="dutchie-single-product-info"> <div class="crawlsy-single-product-info">
<?php if ($settings['show_thc'] === 'yes' && !empty($product['metadata']['thc'])): ?> <?php if ($settings['show_thc'] === 'yes' && !empty($product['metadata']['thc'])): ?>
<div class="dutchie-info-item"> <div class="crawlsy-info-item">
<strong><?php _e('THC:', 'dutchie-menus'); ?></strong> <strong><?php _e('THC:', 'crawlsy-menus'); ?></strong>
<span><?php echo esc_html($product['metadata']['thc']); ?></span> <span><?php echo esc_html($product['metadata']['thc']); ?></span>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if ($settings['show_cbd'] === 'yes' && !empty($product['metadata']['cbd'])): ?> <?php if ($settings['show_cbd'] === 'yes' && !empty($product['metadata']['cbd'])): ?>
<div class="dutchie-info-item"> <div class="crawlsy-info-item">
<strong><?php _e('CBD:', 'dutchie-menus'); ?></strong> <strong><?php _e('CBD:', 'crawlsy-menus'); ?></strong>
<span><?php echo esc_html($product['metadata']['cbd']); ?></span> <span><?php echo esc_html($product['metadata']['cbd']); ?></span>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if ($settings['show_terpenes'] === 'yes' && !empty($product['metadata']['terpenes'])): ?> <?php if ($settings['show_terpenes'] === 'yes' && !empty($product['metadata']['terpenes'])): ?>
<div class="dutchie-info-item dutchie-terpenes"> <div class="crawlsy-info-item crawlsy-terpenes">
<strong><?php _e('Terpenes:', 'dutchie-menus'); ?></strong> <strong><?php _e('Terpenes:', 'crawlsy-menus'); ?></strong>
<?php if (is_array($product['metadata']['terpenes'])): ?> <?php if (is_array($product['metadata']['terpenes'])): ?>
<span><?php echo esc_html(implode(', ', $product['metadata']['terpenes'])); ?></span> <span><?php echo esc_html(implode(', ', $product['metadata']['terpenes'])); ?></span>
<?php else: ?> <?php else: ?>
@@ -296,8 +296,8 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
<?php endif; ?> <?php endif; ?>
<?php if ($settings['show_effects'] === 'yes' && !empty($product['metadata']['effects'])): ?> <?php if ($settings['show_effects'] === 'yes' && !empty($product['metadata']['effects'])): ?>
<div class="dutchie-info-item dutchie-effects"> <div class="crawlsy-info-item crawlsy-effects">
<strong><?php _e('Effects:', 'dutchie-menus'); ?></strong> <strong><?php _e('Effects:', 'crawlsy-menus'); ?></strong>
<?php if (is_array($product['metadata']['effects'])): ?> <?php if (is_array($product['metadata']['effects'])): ?>
<span><?php echo esc_html(implode(', ', $product['metadata']['effects'])); ?></span> <span><?php echo esc_html(implode(', ', $product['metadata']['effects'])); ?></span>
<?php else: ?> <?php else: ?>
@@ -308,14 +308,14 @@ class Dutchie_Menus_Single_Product_Widget extends \Elementor\Widget_Base {
</div> </div>
<?php if ($settings['show_price'] === 'yes' && isset($product['price'])): ?> <?php if ($settings['show_price'] === 'yes' && isset($product['price'])): ?>
<div class="dutchie-single-product-price"> <div class="crawlsy-single-product-price">
$<?php echo number_format($product['price'], 2); ?> $<?php echo number_format($product['price'], 2); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!$product['in_stock']): ?> <?php if (!$product['in_stock']): ?>
<div class="dutchie-out-of-stock"> <div class="crawlsy-out-of-stock">
<?php _e('Out of Stock', 'dutchie-menus'); ?> <?php _e('Out of Stock', 'crawlsy-menus'); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>