Files
cannaiq/wordpress-plugin/templates/product-grid.php
Kelly 66e07b2009 fix(monitor): remove non-existent worker columns from job_run_logs query
The job_run_logs table tracks scheduled job orchestration, not individual
worker jobs. Worker info (worker_id, worker_hostname) belongs on
dispensary_crawl_jobs, not job_run_logs.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 18:45:05 -07:00

75 lines
3.0 KiB
PHP

<?php
/**
* Template for Product Grid (used by shortcode)
*/
if (!defined('ABSPATH')) {
exit;
}
$columns = isset($atts['columns']) ? $atts['columns'] : 3;
?>
<div class="crawlsy-product-grid crawlsy-grid-cols-<?php echo esc_attr($columns); ?>">
<?php foreach ($products as $product):
$image_url = $product['image_url'] ?? $product['primary_image_url'] ?? $product['image_url_full'] ?? '';
$product_url = !empty($product['dutchie_url']) ? $product['dutchie_url'] : '#';
?>
<div class="crawlsy-product-card"
<?php if ($product_url !== '#'): ?>onclick="window.open('<?php echo esc_url($product_url); ?>', '_blank')"<?php endif; ?>
style="cursor: <?php echo ($product_url !== '#') ? 'pointer' : 'default'; ?>;">
<?php if (!empty($image_url)): ?>
<div class="crawlsy-product-image">
<img src="<?php echo esc_url($image_url); ?>"
alt="<?php echo esc_attr($product['name']); ?>"
loading="lazy" />
</div>
<?php endif; ?>
<div class="crawlsy-product-content">
<h3 class="crawlsy-product-title">
<?php echo esc_html($product['name']); ?>
</h3>
<?php if (!empty($product['brand'])): ?>
<div class="crawlsy-product-brand">
<?php echo esc_html($product['brand']); ?>
</div>
<?php endif; ?>
<?php if (!empty($product['description'])): ?>
<p class="crawlsy-product-description">
<?php echo esc_html(wp_trim_words($product['description'], 15)); ?>
</p>
<?php endif; ?>
<div class="crawlsy-product-meta">
<?php if (!empty($product['metadata']['thc'])): ?>
<span class="crawlsy-meta-item crawlsy-thc">
<strong>THC:</strong> <?php echo esc_html($product['metadata']['thc']); ?>
</span>
<?php endif; ?>
<?php if (!empty($product['metadata']['cbd'])): ?>
<span class="crawlsy-meta-item crawlsy-cbd">
<strong>CBD:</strong> <?php echo esc_html($product['metadata']['cbd']); ?>
</span>
<?php endif; ?>
</div>
<?php if (isset($product['price'])): ?>
<div class="crawlsy-product-price">
$<?php echo number_format($product['price'], 2); ?>
</div>
<?php endif; ?>
<?php if (!$product['in_stock']): ?>
<div class="crawlsy-out-of-stock">
<?php _e('Out of Stock', 'crawlsy-menus'); ?>
</div>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>