/** * @param $order Order The order. * * @return array Available arguments with proper values. */ private function getOrderEmailArguments($order) { $billingAddress = $order->getCustomer()->getBillingAddress(); $shippingAddress = $order->getCustomer()->getShippingAddress(); return $this->wp->applyFilters('jigoshop\\emails\\order_variables', array('blog_name' => $this->wp->getBloginfo('name'), 'order_number' => $order->getNumber(), 'order_date' => $this->wp->getHelpers()->dateI18n($this->wp->getOption('date_format')), 'shop_name' => $this->options->get('general.company_name'), 'shop_address_1' => $this->options->get('general.company_address_1'), 'shop_address_2' => $this->options->get('general.company_address_2'), 'shop_tax_number' => $this->options->get('general.company_tax_number'), 'shop_phone' => $this->options->get('general.company_phone'), 'shop_email' => $this->options->get('general.company_email'), 'customer_note' => $order->getCustomerNote(), 'order_items' => $this->formatItems($order), 'subtotal' => ProductHelper::formatPrice($order->getSubtotal()), 'shipping' => ProductHelper::formatPrice($order->getShippingPrice()), 'shipping_cost' => ProductHelper::formatPrice($order->getShippingPrice()), 'shipping_cost_raw' => $order->getShippingPrice(), 'shipping_method' => $order->getShippingMethod() ? $order->getShippingMethod()->getName() : '', 'discount' => ProductHelper::formatPrice($order->getDiscount()), 'total_tax' => ProductHelper::formatPrice($order->getTotalTax()), 'total' => ProductHelper::formatPrice($order->getTotal()), 'is_local_pickup' => $order->getShippingMethod() && $order->getShippingMethod()->getId() == LocalPickup::NAME ? true : null, 'checkout_url' => $order->getStatus() == Order\Status::PENDING ? OrderHelper::getPayLink($order) : null, 'payment_method' => $order->getPaymentMethod()->getName(), 'billing_first_name' => $billingAddress->getFirstName(), 'billing_last_name' => $billingAddress->getLastName(), 'billing_company' => $billingAddress instanceof CompanyAddress ? $billingAddress->getCompany() : '', 'billing_address_1' => $billingAddress->getAddress(), 'billing_address_2' => '', 'billing_postcode' => $billingAddress->getPostcode(), 'billing_city' => $billingAddress->getCity(), 'billing_country' => Country::getName($billingAddress->getCountry()), 'billing_country_raw' => $billingAddress->getCountry(), 'billing_state' => Country::hasStates($billingAddress->getCountry()) ? Country::getStateName($billingAddress->getCountry(), $billingAddress->getState()) : $billingAddress->getState(), 'billing_state_raw' => $billingAddress->getState(), 'billing_email' => $billingAddress->getEmail(), 'billing_phone' => $billingAddress->getPhone(), 'shipping_first_name' => $shippingAddress->getFirstName(), 'shipping_last_name' => $shippingAddress->getLastName(), 'shipping_company' => $shippingAddress instanceof CompanyAddress ? $shippingAddress->getCompany() : '', 'shipping_address_1' => $shippingAddress->getAddress(), 'shipping_address_2' => '', 'shipping_postcode' => $shippingAddress->getPostcode(), 'shipping_city' => $shippingAddress->getCity(), 'shipping_country' => Country::getName($shippingAddress->getCountry()), 'shipping_country_raw' => $shippingAddress->getCountry(), 'shipping_state' => Country::hasStates($shippingAddress->getCountry()) ? Country::getStateName($shippingAddress->getCountry(), $shippingAddress->getState()) : $shippingAddress->getState(), 'shipping_state_raw' => $shippingAddress->getState()), $order); }
/** * Returns location string based on current translation. * * @return string Location string. */ public function getLocation() { // TODO: Write documentation about changing customer location string return trim(sprintf(_x('%1$s, %2$s', 'customer', 'jigoshop'), Country::getName($this->getCountry()), Country::hasStates($this->getCountry()) ? Country::getStateName($this->getCountry(), $this->getState()) : $this->getState(), $this->getPostcode()), ' ,'); }
?> </dd> <dt><?php echo __('Postcode', 'jigoshop'); ?> </dt> <dd><?php echo $address->getPostcode(); ?> </dd> <dt><?php echo __('State/province', 'jigoshop'); ?> </dt> <dd><?php echo Country::getStateName($address->getCountry(), $address->getState()); ?> </dd> <dt><?php echo __('Country', 'jigoshop'); ?> </dt> <dd><?php echo Country::getName($address->getCountry()); ?> </dd> <?php if ($address->getPhone()) { ?> <dt><?php echo __('Phone', 'jigoshop');
private function getRow($user, $columnKey) { switch ($columnKey) { case 'customer_name': return $user->last_name && $user->first_name ? $user->last_name . ', ' . $user->first_name : '-'; case 'username': return $user->user_login; case 'location': $stateCode = $this->wp->getUserMeta($user->ID, 'billing_state', true); $countryCode = $this->wp->getUserMeta($user->ID, 'billing_country', true); $state = Country::hasState($countryCode, $stateCode) ? Country::getStateName($countryCode, $stateCode) : $stateCode; $country = Country::exists($countryCode) ? Country::getName($countryCode) : $countryCode; $value = ''; if ($state) { $value .= $state . ', '; } $value .= $country; if ($value) { return $value; } else { return '-'; } case 'email': return '<a href="mailto:' . $user->user_email . '">' . $user->user_email . '</a>'; case 'spent': return Product::formatPrice($this->getCustomerTotalSpent($user->ID)); case 'orders': return $this->getCustomerOrderCount($user->ID); case 'last_order': $lastOrder = $this->getCustomerLastOrder($user->ID); if ($lastOrder) { /** @var \Jigoshop\Entity\Order $order */ $order = $this->orderService->find($lastOrder->order_id); return '<a href="' . admin_url('post.php?post=' . $lastOrder->order_id . '&action=edit') . '">#' . $order->getNumber() . '</a> – ' . date_i18n(get_option('date_format'), strtotime($lastOrder->order_date)); } return '-'; case 'user_actions': $actions = array(); $actions['edit'] = array('url' => admin_url('user-edit.php?user_id=' . $user->ID), 'name' => __('Edit', 'jigoshop'), 'action' => 'edit'); $actions = $this->wp->applyFilters('jigoshop\\admin\\reports\\table\\customer_list\\user_actions', $actions, $user); return $actions; default: return $this->wp->applyFilters('jigoshop\\admin\\reports\\table\\customer_list\\row', '', $user, $columnKey); } }