Beispiel #1
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;
     }
 }
Beispiel #2
0
 public function displayColumn($column)
 {
     $post = $this->wp->getGlobalPost();
     if ($post === null) {
         return;
     }
     /** @var Product | Product\Variable $product */
     $product = $this->productService->find($post->ID);
     switch ($column) {
         case 'thumbnail':
             echo ProductHelper::getFeaturedImage($product, Options::IMAGE_THUMBNAIL);
             break;
         case 'price':
             echo ProductHelper::getPriceHtml($product);
             break;
         case 'featured':
             echo ProductHelper::isFeatured($product);
             break;
         case 'type':
             echo $this->type->getType($product->getType())->getName();
             break;
         case 'sku':
             echo $this->getVariableAdditionalInfo($product, 'sku');
             break;
         case 'stock':
             echo $this->getVariableAdditionalInfo($product, 'stock');
             break;
         case 'creation':
             $timestamp = strtotime($post->post_date);
             echo Formatter::date($timestamp);
             if ($product->isVisible()) {
                 echo '<br /><strong>' . __('Visible in', 'jigoshop') . '</strong>: ';
                 switch ($product->getVisibility()) {
                     case ProductEntity::VISIBILITY_SEARCH:
                         echo __('Search only', 'jigoshop');
                         break;
                     case ProductEntity::VISIBILITY_CATALOG:
                         echo __('Catalog only', 'jigoshop');
                         break;
                     case ProductEntity::VISIBILITY_PUBLIC:
                         echo __('Catalog and search', 'jigoshop');
                         break;
                 }
             }
             break;
     }
 }