/** * Show the items in each list * * @since 1.0 * @return void */ function edd_wl_items_in_list_meta_box() { $items = get_post_meta(get_the_ID(), 'edd_wish_list', true); if ($items) { foreach ($items as $item) { $item_option = !empty($item['options']) ? '<span class="edd-wl-item-title-option"> – ' . edd_get_cart_item_price_name($item) . '</span>' : ''; ?> <p> <a href="<?php echo admin_url('post.php?post=' . $item['id'] . '&action=edit'); ?> "><?php echo get_the_title($item['id']); ?> </a> <?php echo $item_option; ?> <?php echo '<br />' . edd_cart_item_price($item['id'], $item['options']); ?> </p> <?php } ?> <p><strong><?php echo __('Total:', 'edd-wish-lists') . ' ' . edd_wl_get_list_total(get_the_ID()); ?> </strong></p> <?php } else { _e('No items have been added yet', 'edd-wish-lists'); } ?> <?php }
/** * Add Menu Cart to menu * * @return menu items including cart */ public function submenu_items() { global $post; $get_cart = edd_get_cart_contents(); $submenu_items = ''; if (edd_get_cart_contents() > 0) { foreach ($get_cart as $key => $item) { //$_product = $item['data']; if (count($get_cart) > 0) { $item_thumbnail = get_the_post_thumbnail($item['id'], apply_filters('edd_checkout_image_size', array(25, 25))); $item_name = get_the_title($item['id']); $item_quantity = '1'; $item_price = edd_cart_item_price($item['id'], $item['options']); // Item permalink if product visible $item_permalink = esc_url(get_permalink($item['id'])); $submenu_items[] = array('item_thumbnail' => $item_thumbnail, 'item_name' => $item_name, 'item_quantity' => $item_quantity, 'item_price' => $item_price, 'item_permalink' => $item_permalink); } } } else { $submenu_items = ''; } return $submenu_items; }
<td class="edd_cart_item_name"> <?php if (current_theme_supports('post-thumbnails') && has_post_thumbnail($item['id'])) { echo '<div class="edd_cart_item_image">'; echo get_the_post_thumbnail($item['id'], apply_filters('edd_checkout_image_size', array(25, 25))); echo '</div>'; } $item_title = get_the_title($item['id']); if (!empty($item['options']) && edd_has_variable_prices($item['id'])) { $item_title .= ' - ' . edd_get_cart_item_price_name($item); } echo '<span class="edd_checkout_cart_item_title">' . esc_html($item_title) . '</span>'; ?> </td> <td class="edd_cart_item_price"><?php echo edd_cart_item_price($item['id'], $item['options']); ?> </td> <td class="edd_cart_actions form-inline"> <?php if (edd_item_quantities_enabled()) { ?> <input type="number" min="1" step="1" name="edd-cart-download-<?php echo $key; ?> -quantity" data-key="<?php echo $key; ?> " class="form-control edd-input edd-item-quantity" value="<?php echo edd_get_cart_item_quantity($item['id'], $item['options']); ?>
/** * Outputs the item price * * @since 1.0.2 * @return [type] [description] */ function edd_wl_item_price($item_id, $options, $args = array()) { $defaults = apply_filters('edd_wl_item_price_defaults', array('wrapper_class' => '', 'wrapper' => 'span')); $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); ob_start(); // add our default class $default_class = ' edd-wl-item-price'; $wrapper_class .= $wrapper_class ? $default_class : trim($default_class); $price = apply_filters('edd_wl_item_price', edd_cart_item_price($item_id, $options), $item_id); $html = '<' . $wrapper . ' class="' . $wrapper_class . '"' . '>' . $price . '</' . $wrapper . '>'; echo $html; $template = ob_get_clean(); return apply_filters('edd_wl_item_price_html', $template); }