示例#1
0
 /**
  * Finds item for specified WordPress post.
  *
  * @param $post \WP_Post WordPress post.
  * @return Order Item found.
  */
 public function findForPost($post)
 {
     if (!isset($this->objects[$post->ID])) {
         $this->objects[$post->ID] = $this->service->findForPost($post);
     }
     return $this->objects[$post->ID];
 }
示例#2
0
 /**
  * Finds item for specified WordPress post.
  *
  * @param $post \WP_Post WordPress post.
  * @return Order Item found.
  */
 public function findForPost($post)
 {
     if (!isset($this->objects[$post->ID])) {
         $cachedOrder = $this->instanceCache->getItem('order_' . $post->ID);
         if ($cachedOrder->get() instanceof Order) {
             $this->objects[$post->ID] = $cachedOrder->get();
         } else {
             $this->objects[$post->ID] = $this->service->findForPost($post);
             $cachedOrder->set($this->objects[$post->ID]);
             $this->instanceCache->save($cachedOrder);
         }
     }
     return $this->objects[$post->ID];
 }
示例#3
0
 /**
  * Replace order title.
  * @param $title
  *
  * @return mixed
  */
 public function replaceTitle($title)
 {
     $post = $this->wp->getGlobalPost();
     if ($post->post_type == Types::ORDER) {
         /** @var Entity $order */
         $order = $this->orderService->findForPost($post);
         $title = sprintf(__('Order #%s', 'jigoshop'), $order->getNumber());
     }
     return $title;
 }
示例#4
0
 public function actionsBox()
 {
     $post = $this->wp->getGlobalPost();
     /** @var \Jigoshop\Entity\Order $order */
     $order = $this->orderService->findForPost($post);
     $delete_text = '';
     if (current_user_can("delete_post", $post->ID)) {
         if (!EMPTY_TRASH_DAYS) {
             $delete_text = __('Delete Permanently');
         } else {
             $delete_text = __('Move to Trash');
         }
     }
     $this->renderModifiedPublishBoxContent($post);
     Render::output('admin/order/actionsBox', array('order' => $order, 'delete_text' => $delete_text));
 }