| | |
| | | protected function getSections():array |
| | | { |
| | | if (!$this->sections) { |
| | | $sections = Options::get('menu_section_order'); |
| | | if (!is_array($sections)) { |
| | | $sections = []; |
| | | } |
| | | $this->sections = $sections; |
| | | $this->sections = aneb_menu_sections(); |
| | | } |
| | | |
| | | return $this->sections; |
| | |
| | | |
| | | $excerpt = get_the_excerpt($ID); |
| | | $isVariable = !empty($fields['variations']??[]); |
| | | $variations = $isVariable ? array_map('floatval', array_column($fields['variations'], 'price')) : []; |
| | | $priceRange = $isVariable ? |
| | | (jvbCurrency(min($variations)).' - '.jvbCurrency(max($variations))) : |
| | | jvbCurrency($fields['_price']??''); |
| | | |
| | | $priceRange = $fields['price']; |
| | | if ($isVariable) { |
| | | $prices = array_map('floatval', array_column($fields['variations'], 'price')); |
| | | $min = min($prices); |
| | | $max = max($prices); |
| | | $priceRange = $min===$max ? jvbCurrency($min) : jvbCurrency($min) .' - '.jvbCurrency($max); |
| | | |
| | | } |
| | | |
| | | // if (!$isVariable) { |
| | | // jvbDump($fields, 'Fields'); |
| | | // } |
| | | // jvbDump(get_post_thumbnail_id($ID), 'thumbnail'); |
| | | // $product = wc_get_product($ID); |
| | | // jvbDump($product->get_image_id(), 'product image'); |
| | | // jvbDump($product->get_gallery_image_ids(), 'Gallery images'); |
| | | if ($fields['post_title'] === 'Breakfast Poutine') { |
| | | jvbDump($ID); |
| | | jvbDump($fields); |
| | | } |
| | | |
| | | $out = sprintf( |
| | | '<div id="%s" class="menu-item%s" data-section="%s" data-label="%s" data-id="%s"> |