Example #1
0
 /**
  * Get the legend for the main chart sidebar
  *
  * @return array
  */
 public function getChartLegend()
 {
     $legend = array();
     switch ($this->chartGroupBy) {
         case 'hour':
             /** @noinspection PhpUndefinedFieldInspection */
             $average_sales_title = sprintf(__('%s average sales per hour', 'jigoshop'), '<strong>' . Product::formatPrice($this->reportData->averageSales) . '</strong>');
             break;
         case 'day':
             /** @noinspection PhpUndefinedFieldInspection */
             $average_sales_title = sprintf(__('%s average daily sales', 'jigoshop'), '<strong>' . Product::formatPrice($this->reportData->averageSales) . '</strong>');
             break;
         case 'month':
         default:
             /** @noinspection PhpUndefinedFieldInspection */
             $average_sales_title = sprintf(__('%s average monthly sales', 'jigoshop'), '<strong>' . Product::formatPrice($this->reportData->averageSales) . '</strong>');
             break;
     }
     /** @noinspection PhpUndefinedFieldInspection */
     $legend[] = array('title' => sprintf(__('%s gross sales in this period', 'jigoshop'), '<strong>' . Product::formatPrice($this->reportData->totalSales) . '</strong>'), 'tip' => __('This is the sum of the order totals including shipping and taxes.', 'jigoshop'), 'color' => $this->chartColours['sales_amount'], 'highlight_series' => 5);
     /** @noinspection PhpUndefinedFieldInspection */
     $legend[] = array('title' => sprintf(__('%s net sales in this period', 'jigoshop'), '<strong>' . Product::formatPrice($this->reportData->netSales) . '</strong>'), 'tip' => __('This is the sum of the order totals excluding shipping and taxes.', 'jigoshop'), 'color' => $this->chartColours['net_sales_amount'], 'highlight_series' => 6);
     $legend[] = array('title' => $average_sales_title, 'color' => $this->chartColours['average'], 'highlight_series' => 2);
     /** @noinspection PhpUndefinedFieldInspection */
     $legend[] = array('title' => sprintf(__('%s orders placed', 'jigoshop'), '<strong>' . $this->reportData->totalOrders . '</strong>'), 'color' => $this->chartColours['order_count'], 'highlight_series' => 1);
     /** @noinspection PhpUndefinedFieldInspection */
     $legend[] = array('title' => sprintf(__('%s items purchased', 'jigoshop'), '<strong>' . $this->reportData->totalItems . '</strong>'), 'color' => $this->chartColours['item_count'], 'highlight_series' => 0);
     /** @noinspection PhpUndefinedFieldInspection */
     $legend[] = array('title' => sprintf(__('%s charged for shipping', 'jigoshop'), '<strong>' . Product::formatPrice($this->reportData->totalShipping) . '</strong>'), 'color' => $this->chartColours['shipping_amount'], 'highlight_series' => 4);
     /** @noinspection PhpUndefinedFieldInspection */
     $legend[] = array('title' => sprintf(__('%s worth of coupons used', 'jigoshop'), '<strong>' . Product::formatPrice($this->reportData->totalCoupons) . '</strong>'), 'color' => $this->chartColours['coupon_amount'], 'highlight_series' => 3);
     return $legend;
 }
Example #2
0
 public function getArgs()
 {
     $args = array();
     foreach ($this->mostDiscount as $coupon) {
         $args[] = array('total' => Product::formatPrice($coupon['amount']), 'url' => esc_url(add_query_arg('coupon_codes', $coupon['code'], add_query_arg('last_used', self::SLUG))), 'title' => $coupon['code']);
     }
     return $args;
 }
Example #3
0
 public function getArgs()
 {
     $args = array();
     foreach ($this->topEarners as $product) {
         $args[] = array('total' => Product::formatPrice($product->price), 'id' => $product->id, 'url' => esc_url(add_query_arg('product_ids', $product->id, add_query_arg('last_used', self::SLUG))), 'title' => $product->title);
     }
     return $args;
 }
Example #4
0
 /**
  * @return array
  */
 public function getChartLegend()
 {
     $legend = array();
     $this->getReportData();
     $totalDiscount = 0;
     $totalCoupons = 0;
     foreach ($this->reportData->orderCoupons as $order) {
         $totalDiscount += array_sum(array_map(function ($coupon) {
             return $coupon['amount'];
         }, $order->coupons));
         $totalCoupons += array_sum(array_map(function ($coupon) {
             return $coupon['usage'];
         }, $order->coupons));
     }
     $legend[] = array('title' => sprintf(__('%s discounts in total', 'jigoshop'), '<strong>' . Product::formatPrice($totalDiscount) . '</strong>'), 'color' => $this->chartColours['discount_amount'], 'highlight_series' => 1);
     $legend[] = array('title' => sprintf(__('%s coupons used in total', 'jigoshop'), '<strong>' . $totalCoupons . '</strong>'), 'color' => $this->chartColours['coupon_count'], 'highlight_series' => 0);
     return $legend;
 }
Example #5
0
 /**
  * Get the legend for the main chart sidebar
  *
  * @return array
  */
 public function getChartLegend()
 {
     if (!$this->productIds) {
         return array();
     }
     $legend = array();
     $totalSales = array_sum(array_map(function ($item) {
         return $item->order_item_amount;
     }, $this->reportData->orderItems));
     $totalItems = array_sum(array_map(function ($item) {
         return $item->order_item_count;
     }, $this->reportData->orderItems));
     $totalQuantity = array_sum(array_map(function ($item) {
         return $item->order_item_quantity;
     }, $this->reportData->orderItems));
     $legend[] = array('title' => sprintf(__('%s sales for the selected items', 'jigoshop'), '<strong>' . Product::formatPrice($totalSales) . '</strong>'), 'color' => $this->chartColours['sales_amount'], 'highlight_series' => 2);
     $legend[] = array('title' => sprintf(__('%s purchases for the selected items', 'jigoshop'), '<strong>' . $totalItems . '</strong>'), 'color' => $this->chartColours['item_count'], 'highlight_series' => 1);
     $legend[] = array('title' => sprintf(__('%s purchased quantity', 'jigoshop'), '<strong>' . $totalQuantity . '</strong>'), 'color' => $this->chartColours['item_quantity'], 'highlight_series' => 0);
     return $legend;
 }
Example #6
0
 public function displayColumn($column)
 {
     $post = $this->wp->getGlobalPost();
     if ($post === null) {
         return;
     }
     /** @var \Jigoshop\Entity\Coupon $coupon */
     $coupon = $this->couponService->find($post->ID);
     switch ($column) {
         case 'code':
             echo $coupon->getCode();
             break;
         case 'type':
             echo $this->couponService->getType($coupon);
             break;
         case 'amount':
             echo ProductHelper::formatNumericPrice($coupon->getAmount());
             break;
         case 'usage_limit':
             echo $coupon->getUsageLimit();
             break;
         case 'usage':
             echo $coupon->getUsage();
             break;
         case 'from':
             $from = $coupon->getFrom();
             if ($from) {
                 echo Formatter::date($from->getTimestamp());
             }
             break;
         case 'to':
             $to = $coupon->getTo();
             if ($to) {
                 echo Formatter::date($to->getTimestamp());
             }
             break;
         case 'is_individual':
             echo sprintf('<span class="glyphicon %s" aria-hidden="true"></span> <span class="sr-only">%s</span>', $coupon->isIndividualUse() ? 'glyphicon-ok' : 'glyphicon-remove', $coupon->isIndividualUse() ? __('Yes', 'jigoshop') : __('No', 'jigoshop'));
             break;
     }
 }
Example #7
0
 /**
  * Get the legend for the main chart sidebar
  *
  * @return array
  */
 public function getChartLegend()
 {
     if (!$this->showCategories) {
         return array();
     }
     $legend = array();
     $index = 0;
     foreach ($this->showCategories as $category) {
         $category = get_term($category, 'product_category');
         $total = 0;
         $product_ids = $this->getProductsInCategory($category->term_id);
         foreach ($product_ids as $id) {
             if (isset($this->reportData->itemSales[$id])) {
                 $total += $this->reportData->itemSales[$id];
             }
         }
         $legend[] = array('title' => sprintf(__('%s sales in %s', 'jigoshop'), '<strong>' . Product::formatPrice($total) . '</strong>', $category->name), 'color' => $this->chartColours[$index % sizeof($this->chartColours)], 'highlight_series' => $index);
         $index++;
     }
     return $legend;
 }
Example #8
0
	<?php 
if (count($lowStock) > 0) {
    ?>
		<ol>
			<?php 
    foreach ($lowStock as $item) {
        /** @var $item \Jigoshop\Entity\Product|\Jigoshop\Entity\Product\Purchasable */
        ?>
				<li><a href="<?php 
        echo get_edit_post_link($item->getId());
        ?>
"><?php 
        echo $item->getName();
        ?>
</a> <span><?php 
        printf(__('Stock: %d', 'jigoshop'), Product::getStock($item));
        ?>
</span></li>
			<?php 
    }
    ?>
		</ol>
	<?php 
} else {
    ?>
		<p class="message"><?php 
    echo __('No products are low in stock.', 'jigoshop');
    ?>
</p>
	<?php 
}
Example #9
0
}
?>
<ul class="product_list_widget recently_viewed_products">
	<?php 
foreach ($products as $product) {
    /** @var $product \Jigoshop\Entity\Product */
    ?>
	<li>
		<a href="<?php 
    echo $product->getLink();
    ?>
">
			<?php 
    echo Product::getFeaturedImage($product, Options::IMAGE_TINY);
    ?>
			<span class="js_widget_product_title"><?php 
    echo $product->getName();
    ?>
</span>
		</a>
		<span class="js_widget_product_price"><?php 
    echo Product::getPriceHtml($product);
    ?>
</span>
	</li>
	<?php 
}
?>
</ul>
<?php 
echo $after_widget;
Example #10
0
		<span class="js_widget_product_price"><?php 
        echo $item->getQuantity() . ' &times; ' . Product::formatPrice($item->getPrice());
        ?>
</span>
	</li>
	<?php 
    }
    ?>
</ul>
<p class="total">
	<strong><?php 
    _e('Subtotal', 'jigoshop');
    ?>
:</strong>
	<?php 
    echo Product::formatPrice($cart->getTotal());
    ?>
	<?php 
    do_action('jigoshop_widget_cart_before_buttons');
    ?>
	<p class="buttons">
		<a href="<?php 
    echo $cart_url;
    ?>
" class="btn btn-default"><?php 
    _e($view_cart_label, 'jigoshop');
    ?>
</a>
		<a href="<?php 
    echo $checkout_url;
    ?>
Example #11
0
	</a>
	<a href="<?php 
echo $product->getLink();
?>
">
		<?php 
do_action('jigoshop\\shop\\list\\product\\before_title', $product);
?>
		<strong><?php 
echo $product->getName();
?>
</strong>
		<?php 
do_action('jigoshop\\shop\\list\\product\\after_title', $product);
?>
	</a>
	<?php 
do_action('jigoshop\\shop\\list\\product\\before_button', $product);
?>
	<span class="price"><?php 
echo Product::getPriceHtml($product);
?>
</span>
	<?php 
Product::printAddToCartForm($product, 'list');
?>
	<?php 
do_action('jigoshop\\shop\\list\\product\\after', $product);
?>
</li>
Example #12
0
 /**
  * @param Wordpress $wp
  */
 public function addFrontendAssets(Wordpress $wp)
 {
     $post = $wp->getGlobalPost();
     $product = $this->productService->findForPost($post);
     if ($product instanceof Product\Variable) {
         $variations = array();
         foreach ($product->getVariations() as $variation) {
             /** @var $variation Product\Variable\Variation */
             $variations[$variation->getId()] = array('price' => $variation->getProduct()->getPrice(), 'html' => array('price' => \Jigoshop\Helper\Product::formatPrice($variation->getProduct()->getPrice())), 'attributes' => array());
             foreach ($variation->getAttributes() as $attribute) {
                 /** @var $attribute Product\Variable\Attribute */
                 $variations[$variation->getId()]['attributes'][$attribute->getAttribute()->getId()] = $attribute->getValue();
             }
         }
         Styles::add('jigoshop.product.variable', \JigoshopInit::getUrl() . '/assets/css/shop/product/variable.css');
         Scripts::add('jigoshop.product.variable', \JigoshopInit::getUrl() . '/assets/js/shop/product/variable.js', array('jquery'));
         Scripts::localize('jigoshop.product.variable', 'jigoshop_product_variable', array('variations' => $variations));
     }
 }
Example #13
0
?>
<div class="jigoshop" data-id="<?php 
echo $coupon->getId();
?>
">
	<fieldset>
		<?php 
Forms::constant(array('name' => 'jigoshop_coupon[code]', 'label' => __('Code', 'jigoshop'), 'description' => $coupon->getCode() ? '' : __('Will not appear until coupon is saved.  This is the front end code for use on the Cart.', 'jigoshop'), 'value' => $coupon->getCode()));
?>
	</fieldset>
	<fieldset>
		<?php 
Forms::select(array('id' => 'jigoshop_coupon_type', 'name' => 'jigoshop_coupon[type]', 'label' => __('Type', 'jigoshop'), 'options' => $types, 'value' => $coupon->getType()));
?>
		<?php 
Forms::text(array('name' => 'jigoshop_coupon[amount]', 'label' => __('Amount', 'jigoshop'), 'type' => 'number', 'description' => __('Enter an amount e.g. 9.99.', 'jigoshop'), 'tip' => __('Amount this coupon is worth. If it is a percentage, just include the number without the percentage sign.', 'jigoshop'), 'placeholder' => \Jigoshop\Helper\Product::formatNumericPrice(0), 'value' => $coupon->getAmount()));
?>
	</fieldset>
	<fieldset>
		<?php 
Forms::daterange(array('id' => 'coupon_date', 'name' => array('from' => 'jigoshop_coupon[from]', 'to' => 'jigoshop_coupon[to]'), 'label' => __('Coupon date', 'jigoshop'), 'tip' => __('Choose between which dates this coupon is enabled.  Leave empty for any date.', 'jigoshop'), 'placeholder' => __('Any date', 'jigoshop'), 'value' => array('from' => $coupon->getFrom() ? $coupon->getFrom()->format('m/d/Y') : '', 'to' => $coupon->getTo() ? $coupon->getTo()->format('m/d/Y') : '')));
?>
	</fieldset>
	<fieldset>
		<?php 
Forms::text(array('name' => 'jigoshop_coupon[usage_limit]', 'label' => __('Usage limit', 'jigoshop'), 'type' => 'number', 'description' => sprintf(__('Times used: %s', 'jigoshop'), $coupon->getUsage()), 'tip' => __('Control how many times this coupon may be used.', 'jigoshop'), 'placeholder' => 0, 'value' => $coupon->getUsageLimit()));
?>
		<?php 
Forms::checkbox(array('name' => 'jigoshop_coupon[individual_use]', 'label' => __('Individual use', 'jigoshop'), 'description' => __('Prevent other coupons from being used while this one is applied to the Cart.', 'jigoshop'), 'checked' => $coupon->isIndividualUse()));
?>
		<?php 
Example #14
0
 public function fill(OrderInterface $order, array $data)
 {
     if (!empty($data['customer']) && is_numeric($data['customer'])) {
         $data['customer'] = $this->customerService->find($data['customer']);
     }
     if (isset($data['customer'])) {
         if (!empty($data['customer'])) {
             $data['customer'] = $this->wp->getHelpers()->maybeUnserialize($data['customer']);
         } else {
             $data['customer'] = new CustomerEntity\Guest();
         }
         if (isset($data['billing_address'])) {
             $data['billing_address'] = array_merge(array_flip(array_keys(ProductHelper::getBasicBillingFields())), $data['billing_address']);
             /** @var CustomerEntity $customer */
             $customer = $data['customer'];
             $customer->setBillingAddress($this->createAddress($data['billing_address']));
         }
         if (isset($data['shipping_address'])) {
             $data['shipping_address'] = array_merge(array_flip(array_keys(ProductHelper::getBasicShippingFields())), $data['shipping_address']);
             /** @var CustomerEntity $customer */
             $customer = $data['customer'];
             $customer->setShippingAddress($this->createAddress($data['shipping_address']));
         }
         $order->setCustomer($data['customer']);
         unset($data['customer']);
     }
     /** @var OrderInterface $order */
     $order = $this->wp->applyFilters('jigoshop\\factory\\order\\fetch\\after_customer', $order);
     if (isset($data['items'])) {
         $order->removeItems();
     }
     //We do not want to add coupons and from directly, without validation.
     $coupons = null;
     if (isset($data['coupons'])) {
         $coupons = $data['coupons'];
         unset($data['coupons']);
     }
     if (isset($data['discount'])) {
         unset($data['discount']);
     }
     $order->restoreState($data);
     if ($coupons) {
         $coupons = $this->wp->getHelpers()->maybeUnserialize($coupons);
         if (isset($coupons[0]) && is_array($coupons[0])) {
             $codes = array_map(function ($coupon) {
                 return $coupon['code'];
             }, $coupons);
         } else {
             $codes = $coupons;
         }
         $coupons = $this->couponService->getByCodes($codes);
         foreach ($coupons as $coupon) {
             /** @var Coupon $coupon */
             try {
                 $order->addCoupon($coupon);
             } catch (Exception $e) {
                 $this->messages->addWarning($e->getMessage(), false);
             }
         }
     }
     return $this->wp->applyFilters('jigoshop\\factory\\order\\fill', $order);
 }
Example #15
0
?>
</a></td>
	<td class="product-name">
		<a href="<?php 
echo $url;
?>
"><?php 
echo apply_filters('jigoshop\\template\\shop\\checkout\\product_title', $product->getName(), $product, $item);
?>
</a>
		<?php 
echo Product::getVariation($variation, $item);
?>
		<?php 
do_action('jigoshop\\template\\shop\\checkout\\after_product_title', $product, $item);
?>
	</td>
	<td class="product-price"><?php 
echo Product::formatPrice($price);
?>
</td>
	<td class="product-quantity"><?php 
echo $item->getQuantity();
?>
</td>
	<td class="product-subtotal"><?php 
echo Product::formatPrice($item->getQuantity() * $price);
?>
</td>
</tr>
Example #16
0
<?php

use Jigoshop\Helper\Forms;
use Jigoshop\Helper\Product;
/**
 * @var $method \Jigoshop\Shipping\Method Method to display.
 * @var $order \Jigoshop\Entity\Order Order to display.
 */
?>
<li class="list-group-item shipping-<?php 
echo $method->getId();
?>
 clearfix">
	<label>
		<input type="radio" name="order[shipping]" value="<?php 
echo $method->getId();
?>
" <?php 
echo Forms::checked($order->hasShippingMethod($method), true);
?>
 />
		<?php 
echo $method->getName();
?>
	</label>
	<span class="pull-right"><?php 
echo Product::formatPrice($method->calculate($order));
?>
</span>
</li>
Example #17
0
						<?php 
        foreach ($attribute->getOptions() as $option) {
            /** @var $option Attribute\Option */
            ?>
							<?php 
            Forms::checkbox(array('name' => 'product[attributes][' . $attribute->getId() . '][options]', 'id' => 'product_attributes_' . $attribute->getId() . '_option_' . $option->getId(), 'classes' => array('attribute-' . $attribute->getId()), 'label' => $option->getLabel(), 'value' => apply_filters('jigoshop\\template\\admin\\product\\attribute\\multiselect\\value', $option->getId(), $attribute, $option), 'multiple' => true, 'checked' => in_array($option->getId(), $attribute->getValue())));
            ?>
						<?php 
        }
        ?>
					<?php 
        break;
    case Attribute\Select::TYPE:
        ?>
					<div class="panel-body"><?php 
        Forms::select(array('name' => 'product[attributes][' . $attribute->getId() . ']', 'classes' => array('attribute-' . $attribute->getId()), 'value' => apply_filters('jigoshop\\template\\admin\\product\\attribute\\select\\value', $attribute->getValue(), $attribute), 'options' => Product::getSelectOption($attribute->getOptions()), 'size' => 12));
        ?>
					</div><?php 
        break;
    case Attribute\Text::TYPE:
        ?>
					<div class="panel-body"><?php 
        Forms::text(array('name' => 'product[attributes][' . $attribute->getId() . ']', 'classes' => array('attribute-' . $attribute->getId(), $attribute->isLocal() ? 'local' : ''), 'value' => apply_filters('jigoshop\\template\\admin\\product\\attribute\\text\\value', $attribute->getValue(), $attribute), 'size' => 12));
        ?>
					</div><?php 
        break;
}
?>
		</div>
	</div>
</li>
Example #18
0
 /**
  * @param $coupon Coupon
  */
 public function addCoupon($coupon)
 {
     if (!is_object($coupon)) {
         parent::addCoupon($coupon);
         return;
     }
     if (isset($this->couponData[$coupon->getId()])) {
         return;
     }
     if (is_numeric($coupon->getOrderTotalMinimum()) && $this->getTotal() < $coupon->getOrderTotalMinimum()) {
         throw new Exception(sprintf(__('Cannot apply coupon "%s". Order total less than %s.'), $coupon->getCode(), ProductHelper::formatPrice($coupon->getOrderTotalMinimum())));
     }
     if (is_numeric($coupon->getOrderTotalMaximum()) && $this->getTotal() > $coupon->getOrderTotalMaximum()) {
         throw new Exception(sprintf(__('Cannot apply coupon "%s". Order total more than %s.'), $coupon->getCode(), ProductHelper::formatPrice($coupon->getOrderTotalMaximum())));
     }
     if ($coupon->isIndividualUse()) {
         $this->removeAllCouponsExcept(array());
     }
     $discount = $coupon->getDiscount($this);
     $this->couponData[$coupon->getId()] = array('object' => $coupon, 'discount' => $discount);
     parent::addCoupon($coupon->getCode());
     $this->addDiscount($discount);
 }
Example #19
0
 /**
  * @param $order Order The order.
  *
  * @return string Items formatted for email.
  */
 private function formatItems($order)
 {
     //		$inc_tax = $this->options->get('tax.included');
     $result = '';
     // validate if any item has cost less than 0. If that's the case, we can't use price including tax
     // TODO: Support for "price includes tax"
     //		$use_inc_tax = $inc_tax;
     //		if ($inc_tax) {
     //			foreach ($this->items as $item) {
     //				$use_inc_tax = ($item['cost_inc_tax'] >= 0);
     //				if (!$use_inc_tax) {
     //					break;
     //				}
     //			}
     //		}
     foreach ($order->getItems() as $item) {
         /** @var $item Order\Item */
         $itemResult = '';
         $product = $item->getProduct();
         $itemResult .= $item->getQuantity() . ' x ' . html_entity_decode($this->wp->applyFilters('jigoshop\\emails\\product_title', $item->getName(), $product, $item), ENT_QUOTES, 'UTF-8');
         if ($product->getSku()) {
             $itemResult .= ' (#' . $product->getSku() . ')';
         }
         // TODO: Support for "price includes tax"
         //			if ($use_inc_tax && $item['cost_inc_tax'] >= 0) {
         //				$return .= ' - '.html_entity_decode(strip_tags(jigoshop_price($item['cost_inc_tax'] * $item['qty'], array('ex_tax_label' => 0))), ENT_COMPAT, 'UTF-8');
         //			} else {
         $itemResult .= ' - ' . ProductHelper::formatPrice($item->getCost());
         //			}
         if ($product instanceof Product\Variable) {
             $variation = $product->getVariation($item->getMeta('variation_id')->getValue());
             $itemResult .= PHP_EOL;
             foreach ($variation->getAttributes() as $attribute) {
                 /** @var $attribute \Jigoshop\Entity\Product\Variable\Attribute */
                 $itemResult .= $attribute->getAttribute()->getLabel() . ': ' . $attribute->getItemValue($item) . ', ';
             }
             $itemResult = rtrim($itemResult, ',');
         }
         $itemResult = $this->wp->applyFilters('jigoshop\\emails\\order_item', $itemResult, $item, $order);
         $result .= $itemResult . PHP_EOL;
     }
     return $result;
 }
Example #20
0
 /**
  * Renders images section of product page.
  *
  * @param $product \Jigoshop\Entity\Product The product to render data for.
  */
 public function productImages($product)
 {
     $imageClasses = apply_filters('jigoshop\\product\\image_classes', array('featured-image'), $product);
     $featured = ProductHelper::getFeaturedImage($product, Options::IMAGE_LARGE);
     $featuredUrl = ProductHelper::hasFeaturedImage($product) ? $this->wp->wpGetAttachmentUrl($this->wp->getPostThumbnailId($product->getId())) : '';
     $thumbnails = $this->productService->getAttachments($product, Options::IMAGE_THUMBNAIL)['gallery'];
     Render::output('shop/product/images', array('product' => $product, 'featured' => $featured, 'featuredUrl' => $featuredUrl, 'thumbnails' => is_array($thumbnails) ? $thumbnails : array(), 'imageClasses' => $imageClasses));
 }
Example #21
0
    ?>
			<span class="order-time"><?php 
    echo get_the_time(_x('M d, Y', 'dashboard', 'jigoshop'), $order->getId());
    ?>
</span>
			<small>
				<?php 
    echo count($order->getItems());
    ?>
 <?php 
    echo _n('Item', 'Items', count($order->getItems()), 'jigoshop');
    ?>
,
				<span	class="total-quantity"><?php 
    echo __('Total Quantity', 'jigoshop');
    ?>
 <?php 
    echo $totalItems;
    ?>
</span>
				<span	class="order-cost"><?php 
    echo Helper\Product::formatPrice($order->getTotal());
    ?>
</span>
			</small>
		</li>
	<?php 
}
?>
</ul>
Example #22
0
 /**
  * Returns list of default fields for shipping section.
  *
  * @param Address $address Address to fill values for.
  *
  * @return array Default fields.
  */
 public function getDefaultShippingFields(Address $address)
 {
     return ProductHelper::getBasicShippingFields(array('first_name' => array('value' => $address->getFirstName(), 'columnSize' => 6), 'last_name' => array('value' => $address->getLastName(), 'columnSize' => 6), 'company' => array('value' => $address instanceof CompanyAddress ? $address->getCompany() : '', 'columnSize' => 12), 'address' => array('value' => $address->getAddress(), 'columnSize' => 12), 'country' => array('options' => Country::getAllowed(), 'value' => $address->getCountry(), 'columnSize' => 6), 'state' => array('type' => Country::hasStates($address->getCountry()) ? 'select' : 'text', 'options' => Country::getStates($address->getCountry()), 'value' => $address->getState(), 'columnSize' => 6), 'city' => array('value' => $address->getCity(), 'columnSize' => 6), 'postcode' => array('value' => $address->getPostcode(), 'columnSize' => 6)));
 }
Example #23
0
		<a href="<?php 
echo $url;
?>
"><?php 
echo apply_filters('jigoshop\\template\\shop\\cart\\product_title', $product->getName(), $product, $item);
?>
</a>
		<?php 
echo Product::getVariation($variation, $item);
?>
		<?php 
do_action('jigoshop\\template\\shop\\cart\\after_product_title', $product, $item);
?>
	</td>
	<td class="product-price"><?php 
echo apply_filters('jigoshop\\template\\shop\\cart\\product_price', Product::formatPrice($price), $price, $product, $item);
?>
</td>
	<td class="product-quantity"><input type="number" name="cart[<?php 
echo $key;
?>
]" value="<?php 
echo $item->getQuantity();
?>
" /></td>
	<td class="product-subtotal"><?php 
echo apply_filters('jigoshop\\template\\shop\\cart\\product_subtotal', Product::formatPrice($item->getQuantity() * $price), $item->getQuantity() * $price, $product, $item);
?>
</td>
</tr>
Example #24
0
    ?>
					<?php 
}
?>
				</ul>
			</div>
		</div>
		<?php 
Forms::constant(array('name' => 'order[subtotal]', 'id' => 'subtotal', 'label' => __('Subtotal', 'jigoshop'), 'placeholder' => 0.0, 'size' => 12, 'value' => Product::formatPrice($order->getSubtotal())));
?>
		<?php 
Forms::text(array('name' => 'order[discount]', 'label' => sprintf(__('Discount (%s)', 'jigoshop'), Currency::symbol()), 'placeholder' => 0.0, 'value' => $order->getDiscount()));
?>
		<?php 
foreach ($tax as $class => $option) {
    ?>
			<?php 
    Forms::constant(array('name' => 'order[tax][' . $class . ']', 'label' => $option['label'], 'placeholder' => 0.0, 'value' => $option['value'], 'size' => 12, 'classes' => array($orderTax[$class] > 0 ? '' : 'not-active')));
    ?>
		<?php 
}
?>
		<?php 
Forms::constant(array('name' => 'order[total]', 'id' => 'total', 'label' => __('Total', 'jigoshop'), 'placeholder' => 0.0, 'size' => 12, 'value' => Product::formatPrice($order->getTotal())));
?>
		<?php 
do_action('jigoshop\\admin\\order\\totalsBox\\after_total', $order);
?>
	</div>
</div>
Example #25
0
				<th scope="row"><?php 
_e('Discount', 'jigoshop');
?>
</th>
				<td><?php 
echo Product::formatPrice($order->getDiscount());
?>
</td>
			</tr>
			<tr id="cart-total">
				<th scope="row"><?php 
_e('Total', 'jigoshop');
?>
</th>
				<td><?php 
echo Product::formatPrice($order->getTotal());
?>
</td>
			</tr>
			</tbody>
		</table>
	</div>
</div>
<?php 
if ($order->getStatus() == Status::PENDING) {
    ?>
<a href="<?php 
    echo $cancelUrl;
    ?>
" class="btn btn-danger"><?php 
    _e('Cancel this order', 'jigoshop');
Example #26
0
    \Jigoshop\Helper\Render::output('admin/order/item/' . $item->getType(), array('order' => $order, 'item' => $item));
    ?>
			<?php 
}
?>
			</tbody>
			<tfoot>
			<tr>
				<td colspan="3"><?php 
Forms::text(array('name' => 'new_item', 'id' => 'new-item', 'placeholder' => __('Search for products...', 'jigoshop')));
?>
</td>
				<td><button class="btn btn-primary" id="add-item"><?php 
_e('Add item', 'jigoshop');
?>
</button></td>
				<td class="text-right"><strong><?php 
_e('Product subtotal:', 'jigoshop');
?>
</strong></td>
				<td id="product-subtotal"><?php 
Forms::constant(array('name' => 'order[subtotal]', 'value' => Product::formatPrice($order->getProductSubtotal())));
?>
</td>
				<td></td>
			</tr>
			</tfoot>
		</table>
	</div>
</div>
Example #27
0
 /**
  * Processes change of item quantity and returns updated item value and cart details.
  */
 public function ajaxUpdateItem()
 {
     $cart = $this->cartService->getCurrent();
     try {
         $cart->updateQuantity($_POST['item'], (int) $_POST['quantity']);
         $this->cartService->save($cart);
         $item = $cart->getItem($_POST['item']);
         if ($item === null) {
             throw new Exception(__('Item not found.', 'jigoshop'));
         }
         // TODO: Support for "Prices includes tax"
         $price = $this->options->get('tax.price_tax') == 'with_tax' ? $item->getPrice() + $item->getTax() / $item->getQuantity() : $item->getPrice();
         $response = $this->getAjaxCartResponse($cart);
         // Add some additional fields
         $response['item_price'] = $price;
         $response['item_subtotal'] = $price * $item->getQuantity();
         $response['html']['item_price'] = Product::formatPrice($price);
         $response['html']['item_subtotal'] = Product::formatPrice($price * $item->getQuantity());
     } catch (NotEnoughStockException $e) {
         $response = array('success' => false, 'error' => sprintf(__('Sorry, we do not have enough units in stock. We have got only %s in stock', 'jigoshop'), $e->getStock()));
     } catch (Exception $e) {
         if ($cart->isEmpty()) {
             $response = array('success' => true, 'empty_cart' => true, 'html' => Render::get('shop/cart/empty', array('shopUrl' => $this->wp->getPermalink($this->options->getPageId(Pages::SHOP)))));
         } else {
             $response = $this->getAjaxCartResponse($cart);
             $response['remove_item'] = true;
         }
     }
     echo json_encode($response);
     exit;
 }
Example #28
0
<?php

use Jigoshop\Helper\Forms;
use Jigoshop\Helper\Product;
/**
 * @var $method \Jigoshop\Shipping\Method Method to display.
 * @var $cart \Jigoshop\Entity\Cart Current cart.
 */
?>
<li class="list-group-item shipping-<?php 
echo $method->getId();
?>
 clearfix">
	<label>
		<input type="radio" name="jigoshop_order[shipping_method]" value="<?php 
echo $method->getId();
?>
" <?php 
echo Forms::checked($cart->hasShippingMethod($method), true);
?>
 />
		<?php 
echo $method->getTitle();
?>
	</label>
	<span class="pull-right"><?php 
echo Product::formatPrice($method->calculate($cart));
?>
</span>
</li>
Example #29
0
	<td class="id"><?php 
Forms::constant(array('name' => 'order[items][' . $id . '][id]', 'value' => $item->getProduct()->getId()));
?>
</td>
	<td class="sku"><?php 
Forms::constant(array('name' => 'order[items][' . $id . '][sku]', 'value' => $item->getProduct()->getSku()));
?>
</td>
	<td class="name"><?php 
Forms::constant(array('name' => 'order[items][' . $id . '][name]', 'value' => apply_filters('jigoshop\\template\\admin\\order\\item_title', $item->getName(), $item->getProduct(), $item)));
?>
</td>
	<td class="price"><?php 
Forms::text(array('name' => 'order[items][' . $id . '][price]', 'value' => Product::formatNumericPrice($item->getPrice())));
?>
</td>
	<td class="quantity"><?php 
Forms::text(array('name' => 'quantity[' . $id . ']', 'value' => $item->getQuantity()));
?>
</td>
	<td class="total"><?php 
Forms::constant(array('name' => 'order[items][' . $id . '][total]', 'value' => Product::formatPrice($item->getCost())));
?>
</td>
	<td class="actions">
		<a href="" class="close remove"><span aria-hidden="true">&times;</span><span class="sr-only"><?php 
_e('Remove', 'jigoshop');
?>
</span></a>
	</td>
</tr>
Example #30
0
</button>
		</div>
		<div class="col-md-10">
			<fieldset>
			<?php 
Forms::select(array('name' => 'product[variation][' . $variation->getId() . '][product][type]', 'classes' => array('variation-type'), 'label' => __('Type', 'jigoshop'), 'value' => $product->getType(), 'options' => $allowedSubtypes, 'size' => 11));
Forms::text(array('name' => 'product[variation][' . $variation->getId() . '][product][regular_price]', 'label' => __('Price', 'jigoshop'), 'placeholder' => __('Price not announced', 'jigoshop'), 'value' => $product->getPrice(), 'size' => 11));
Forms::select(array('name' => 'product[variation][' . $variation->getId() . '][product][tax_classes]', 'label' => __('Tax classes', 'jigoshop'), 'multiple' => true, 'value' => $variation->getProduct()->getTaxClasses(), 'options' => $taxClasses, 'classes' => array($product->isTaxable() ? '' : 'not-active'), 'size' => 11));
?>
			</fieldset>
			<fieldset>
			<?php 
Forms::text(array('name' => 'product[variation][' . $variation->getId() . '][product][sku]', 'label' => __('SKU', 'jigoshop'), 'value' => $product->getSku(), 'placeholder' => $variation->getParent()->getId() . ' - ' . $variation->getId(), 'size' => 11));
Forms::text(array('name' => 'product[variation][' . $variation->getId() . '][product][brand]', 'label' => __('Brand', 'jigoshop'), 'value' => $product->getBrand(), 'size' => 11));
Forms::text(array('name' => 'product[variation][' . $variation->getId() . '][product][gtin]', 'label' => __('GTIN', 'jigoshop'), 'tip' => 'Global Trade Item Number', 'value' => $product->getGtin(), 'size' => 11));
Forms::text(array('name' => 'product[variation][' . $variation->getId() . '][product][mpn]', 'label' => __('MPN', 'jigoshop'), 'tip' => 'Manufacturer Part Number', 'value' => $product->getMpn(), 'size' => 11));
?>
			</fieldset>
			<fieldset>
			<?php 
Forms::text(array('name' => 'product[variation][' . $variation->getId() . '][product][stock_stock]', 'label' => __('Stock', 'jigoshop'), 'value' => $product->getStock()->getStock(), 'size' => 11));
Forms::text(array('name' => 'product[variation][' . $variation->getId() . '][product][sales_price]', 'label' => __('Sale price', 'jigoshop'), 'value' => $product->getSales()->getPrice(), 'placeholder' => ProductHelper::formatNumericPrice(0), 'size' => 11));
Forms::daterange(array('id' => 'product_variation_' . $variation->getId() . '_product_sales_date', 'name' => array('from' => 'product[variation][' . $variation->getId() . '][product][sales_from]', 'to' => 'product[variation][' . $variation->getId() . '][product][sales_to]'), 'label' => __('Sale date', 'jigoshop'), 'value' => array('from' => $product->getSales()->getFrom()->format('m/d/Y'), 'to' => $product->getSales()->getTo()->format('m/d/Y')), 'size' => 11, 'startDate' => $product->getSales()->getFrom()->format('m/d/Y'), 'endDate' => $product->getSales()->getTo()->format('m/d/Y')));
?>
			</fieldset>
			<?php 
do_action('jigoshop\\admin\\variation', $variation, $product);
?>
		</div>
	</div>
</li>