コード例 #1
0
ファイル: product.php プロジェクト: jigoshop/Jigoshop2
Render::output('shop/messages', array('messages' => $messages));
?>
	<?php 
do_action('jigoshop\\template\\product\\before_summary', $product);
?>
	<div class="summary">
		<h1><?php 
echo $product->getName();
?>
</h1>
		<p class="price"><?php 
echo Product::getPriceHtml($product);
?>
</p>
		<p class="stock"><?php 
echo Product::getStock($product);
?>
</p>
		<?php 
Product::printAddToCartForm($product, 'product');
?>
		<dl class="dl-horizontal">
			<?php 
if ($product->getSku()) {
    ?>
			<dt><?php 
    echo __('SKU', 'jigoshop');
    ?>
</dt><dd><?php 
    echo $product->getSku();
    ?>
コード例 #2
0
ファイル: stockReport.php プロジェクト: jigoshop/Jigoshop2
	<?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 
}
コード例 #3
0
ファイル: Products.php プロジェクト: jigoshop/Jigoshop2
 /**
  * Get additional information about the products of variables.
  *
  * @param \Jigoshop\Entity\Product\Variable $product - Product
  * @param string $type - chose to display sku or stock information
  *
  * @return string
  */
 public function getVariableAdditionalInfo($product, $type)
 {
     if ($product->getType() == Product\Variable::TYPE && $this->options->get('advanced.products_list.variations_sku_stock')) {
         $additionalInfo = '';
         /** @var \Jigoshop\Entity\Product\Variable\Variation $variation */
         /** @var Product\Attribute $attribute */
         foreach ($product->getVariations() as $variation) {
             if ($type == 'sku') {
                 $additionalInfo .= $variation->getProduct()->getSku() . '<br />';
             } elseif ($type == 'stock') {
                 $variation_name = array();
                 $attributes = $product->getVariableAttributes();
                 foreach ($attributes as $attribute) {
                     $variation_name[] = ProductHelper::getSelectOption($attribute->getOptions())[$variation->getAttribute($attribute->getId())->getValue()];
                 }
                 $additionalInfo .= join(' - ', $variation_name) . ' (' . $variation->getProduct()->getStock()->getStock() . ')<br />';
             }
         }
         return $additionalInfo;
     } else {
         if ($type == 'sku') {
             return $product->getSku();
         } elseif ($type == 'stock') {
             return ProductHelper::getStock($product);
         }
     }
 }