From ccf5e61a075c35d24befc175994b5cb8957ca322 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 26 Aug 2026 21:45:53 +0000
Subject: [PATCH] =Extra JVB() calls replaced, minor tweaks
---
inc/blocks/MenuBlock.php | 100 +++++++++++++++++++++++++++++++-------------------
1 files changed, 62 insertions(+), 38 deletions(-)
diff --git a/inc/blocks/MenuBlock.php b/inc/blocks/MenuBlock.php
index 24d3759..a623d7c 100644
--- a/inc/blocks/MenuBlock.php
+++ b/inc/blocks/MenuBlock.php
@@ -215,54 +215,78 @@
<div>
<h4>%s — %s</h4>
%s
- </div>', //Note: we had 3 %s%s%s before the last </div> last time. This was to add optional ingredients or preparation time duration, not default in WooCommerce
+ </div><a href="?add-to-cart=%d&variation_id=%d"
+ data-quantity="1"
+ data-product_id="%d"
+ data-variation_id="%d"
+ class="add_to_cart_button ajax_add_to_cart add-to-cart">
+ %s
+ <span>Add to Cart</span>
+</a>', //Note: we had 3 %s%s%s before the last </div> last time. This was to add optional ingredients or preparation time duration, not default in WooCommerce
$row['title'],
jvbCurrency($row['price']),
empty($row['description']) ? '' : wpautop($row['description']),
+ $ID,
+ $row['id'],
+ $ID,
+ $row['id'],
+ jvbIcon('plus-square')
);
- $out .= Form::render(
- $row['id'],
- '',
- [
- 'type' => 'quantity',
- 'label' => $row['title'],
- 'min' => 0,
- 'max' => 30,
- 'data' => [
- 'price' => $row['price'],
- 'id' => $row['id'],
- 'sku' => $row['sku'],
- 'name' => $row['title'],
- 'add-to-cart' => ''
- ],
- 'add' => 'Add 1 '.$row['title'].' to cart',
- 'remove' => 'Remove 1 '.$row['title']. ' from cart',
- ]
- );
+// $out .= Form::render(
+// $row['id'],
+// '',
+// [
+// 'type' => 'quantity',
+// 'label' => $row['title'],
+// 'min' => 0,
+// 'max' => 30,
+// 'data' => [
+// 'price' => $row['price'],
+// 'id' => $row['id'],
+// 'sku' => $row['sku'],
+// 'name' => $row['title'],
+// 'add-to-cart' => ''
+// ],
+// 'add' => 'Add 1 '.$row['title'].' to cart',
+// 'remove' => 'Remove 1 '.$row['title']. ' from cart',
+// ]
+// );
$out .= '</div>';
}
} else {
- $out .= Form::render(
+ $out .= sprintf(
+ '<a href="?add-to-cart=%d"
+ data-quantity="1"
+ data-product_id="%d"
+ class="add_to_cart_button ajax_add_to_cart add-to-cart">
+ %s
+ <span>Add to Cart</span>
+ </a>',
$ID,
- '',
- [
- 'type' => 'quantity',
- 'label' => 'Add to Order',
- 'min' => 0,
- 'max' => 30,
- 'step' => 1,
- 'data' => [
- 'price' => $fields['_price'],
- 'id' => $ID,
- 'name' => $fields['post_title'],
- 'step' => 1,
- 'add-to-cart' => '',
- ],
- 'add' => 'Add 1 '.$fields['post_title'].' to cart',
- 'remove' => 'Remove 1 '.$fields['title']. ' from cart',
- ]
+ $ID,
+ jvbIcon('plus-square')
);
+// $out .= Form::render(
+// $ID,
+// '',
+// [
+// 'type' => 'quantity',
+// 'label' => 'Add to Order',
+// 'min' => 0,
+// 'max' => 30,
+// 'step' => 1,
+// 'data' => [
+// 'price' => $fields['_price'],
+// 'id' => $ID,
+// 'name' => $fields['post_title'],
+// 'step' => 1,
+// 'add-to-cart' => '',
+// ],
+// 'add' => 'Add 1 '.$fields['post_title'].' to cart',
+// 'remove' => 'Remove 1 '.$fields['title']. ' from cart',
+// ]
+// );
}
$out .= '</div></div>';
--
Gitblit v1.10.0