当前位置: 首页>>代码示例>>PHP>>正文


PHP hikashop_getZone函数代码示例

本文整理汇总了PHP中hikashop_getZone函数的典型用法代码示例。如果您正苦于以下问题:PHP hikashop_getZone函数的具体用法?PHP hikashop_getZone怎么用?PHP hikashop_getZone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了hikashop_getZone函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hikashop_product_price_for_quantity_in_cart

 function hikashop_product_price_for_quantity_in_cart(&$product)
 {
     $currencyClass = hikashop_get('class.currency');
     $quantity = @$product->cart_product_quantity;
     $plugin = JPluginHelper::getPlugin('system', 'custom_price');
     if (version_compare(JVERSION, '2.5', '<')) {
         jimport('joomla.html.parameter');
         $params = new JParameter($plugin->params);
     } else {
         $params = new JRegistry($plugin->params);
     }
     $taxes = $params->get('taxes', 0);
     $column = $params->get('field', 'amount');
     if (!empty($product->{$column})) {
         if (empty($product->prices)) {
             $price = new stdClass();
             $price->price_currency_id = hikashop_getCurrency();
             $price->price_min_quantity = 1;
             $product->prices = array($price);
         }
         foreach ($product->prices as $k => $price) {
             if ($taxes && $product->product_type == 'variant' && empty($product->product_tax_id)) {
                 $productClass = hikashop_get('class.product');
                 $main = $productClass->get($product->product_parent_id);
                 $product->product_tax_id = $main->product_tax_id;
             }
             switch ($taxes) {
                 case 2:
                     $product->prices[$k]->price_value = $currencyClass->getUntaxedPrice($product->{$column}, hikashop_getZone(), $product->product_tax_id);
                     $product->prices[$k]->taxes = $currencyClass->taxRates;
                     $product->prices[$k]->price_value_with_tax = $product->{$column};
                     break;
                 case 1:
                     $product->prices[$k]->price_value = $product->{$column};
                     $product->prices[$k]->price_value_with_tax = $currencyClass->getTaxedPrice($product->{$column}, hikashop_getZone(), $product->product_tax_id);
                     $product->prices[$k]->taxes = $currencyClass->taxRates;
                     break;
                 case 0:
                 default:
                     $product->prices[$k]->price_value = $product->{$column};
                     $product->prices[$k]->price_value_with_tax = $product->{$column};
                     break;
             }
         }
     }
     $currencyClass->quantityPrices($product->prices, $quantity, $product->cart_product_total_quantity);
 }
开发者ID:q0821,项目名称:esportshop,代码行数:47,代码来源:custom_price.php

示例2: getCartSumm

 static function getCartSumm()
 {
     $config =& hikashop_config();
     $main_currency = (int) $config->get('main_currency', 1);
     $zone_id = hikashop_getZone('shipping');
     if ($config->get('tax_zone_type', 'shipping') == 'billing') {
         $tax_zone_id = hikashop_getZone('billing');
     } else {
         $tax_zone_id = $zone_id;
     }
     $discount_before_tax = (int) $config->get('discount_before_tax', 0);
     $cart = hikashop_get('class.cart');
     $cartInfo = $cart->loadCart();
     $cart_id = $cartInfo->cart_id;
     if ($cart_id == 0) {
         return 0;
     }
     $products = $cart->get($cart_id);
     $total = null;
     $currencyClass = hikashop_get('class.currency');
     $currency_id = hikashop_getCurrency();
     $ids = array();
     $mainIds = array();
     foreach ($products as $product) {
         $ids[] = $product->product_id;
     }
     $currencyClass->getPrices($products, $ids, $currency_id, $main_currency, $tax_zone_id, $discount_before_tax);
     foreach ($products as $k => $row) {
         unset($products[$k]->cart_modified);
         unset($products[$k]->cart_coupon);
         $currencyClass->calculateProductPriceForQuantity($products[$k]);
     }
     $currencyClass->calculateTotal($products, $total, $currency_id);
     if (isset($total->prices) && isset($total->prices[0]) && isset($total->prices[0]->price_value) && !empty($total->prices[0]->price_value)) {
         $sum = $total->prices[0]->price_value;
     } else {
         $sum = 0;
     }
     return $sum;
 }
开发者ID:Giftd,项目名称:giftd-joomla,代码行数:40,代码来源:hikashop.php

示例3: hikashop_config

 function &loadFullCart($additionalInfos = false, $keepEmptyCart = false, $skipChecks = false)
 {
     $app = JFactory::getApplication();
     $database = JFactory::getDBO();
     $config =& hikashop_config();
     $currencyClass = hikashop_get('class.currency');
     $productClass = hikashop_get('class.product');
     $main_currency = (int) $config->get('main_currency', 1);
     $currency_id = hikashop_getCurrency();
     if (!in_array($currency_id, $currencyClass->publishedCurrencies())) {
         $currency_id = $main_currency;
     }
     $zone_id = hikashop_getZone('shipping');
     if ($config->get('tax_zone_type', 'shipping') == 'billing') {
         $tax_zone_id = hikashop_getZone('billing');
     } else {
         $tax_zone_id = $zone_id;
     }
     $discount_before_tax = (int) $config->get('discount_before_tax', 0);
     $cart = new stdClass();
     $cart->products = $this->get(@$this->cart->cart_id, $keepEmptyCart, isset($this->cart->cart_type) ? $this->cart->cart_type : '');
     $cart->cart_id = (int) @$this->cart->cart_id;
     $cart->cart_type = @$this->cart->cart_type;
     $cart->cart_params = @$this->cart->cart_params;
     $cart->coupon = null;
     $cart->shipping = null;
     $cart->total = null;
     $cart->additional = array();
     if (!empty($cart->products)) {
         $ids = array();
         $mainIds = array();
         foreach ($cart->products as $product) {
             $ids[] = $product->product_id;
             if ($product->product_parent_id == '0') {
                 $mainIds[] = (int) $product->product_id;
             } else {
                 $mainIds[] = (int) $product->product_parent_id;
             }
         }
         $query = 'SELECT a.*, b.* FROM ' . hikashop_table('product_category') . ' AS a LEFT JOIN ' . hikashop_table('category') . ' AS b ON a.category_id = b.category_id WHERE a.product_id IN(' . implode(',', $mainIds) . ') ORDER BY a.ordering ASC';
         $database->setQuery($query);
         $categories = $database->loadObjectList();
         $quantityDisplayType = hikashop_get('type.quantitydisplay');
         foreach ($cart->products as $k => $row) {
             if ($row->product_parent_id != 0 && $row->cart_product_parent_id != '0') {
                 $row->product_quantity_layout = $cart->products[$row->cart_product_parent_id]->product_quantity_layout;
                 $row->product_min_per_order = $cart->products[$row->cart_product_parent_id]->product_min_per_order;
                 $row->product_max_per_order = $cart->products[$row->cart_product_parent_id]->product_max_per_order;
             }
             if (empty($row->product_quantity_layout) || $row->product_quantity_layout == 'inherit') {
                 $categoryQuantityLayout = '';
                 if (!empty($categories)) {
                     foreach ($categories as $category) {
                         if ($category->product_id == $row->product_id && !empty($category->category_quantity_layout) && $quantityDisplayType->check($category->category_quantity_layout, $app->getTemplate())) {
                             $categoryQuantityLayout = $category->category_quantity_layout;
                             break;
                         }
                     }
                 }
             }
             if (!empty($row->product_quantity_layout) && $row->product_quantity_layout != 'inherit') {
                 $qLayout = $row->product_quantity_layout;
             } elseif (!empty($categoryQuantityLayout) && $categoryQuantityLayout != 'inherit') {
                 $qLayout = $categoryQuantityLayout;
             } else {
                 $qLayout = $config->get('product_quantity_display', 'show_default');
             }
             $cart->products[$k]->product_quantity_layout = $qLayout;
         }
         JArrayHelper::toInteger($ids);
         $query = 'SELECT * FROM ' . hikashop_table('file') . ' WHERE file_ref_id IN (' . implode(',', $ids) . ') AND file_type IN( \'product\',\'file\') ORDER BY file_ref_id ASC, file_ordering ASC';
         $database->setQuery($query);
         $images = $database->loadObjectList();
         if (!empty($images)) {
             foreach ($cart->products as $k => $row) {
                 $productClass->addFiles($cart->products[$k], $images);
             }
         }
         foreach ($cart->products as $k => $row) {
             if ($row->product_type == 'variant') {
                 foreach ($cart->products as $k2 => $row2) {
                     if ($row->product_parent_id == $row2->product_id) {
                         $cart->products[$k2]->variants[] =& $cart->products[$k];
                         break;
                     }
                 }
             }
         }
         $query = 'SELECT a.*,b.* FROM ' . hikashop_table('variant') . ' AS a LEFT JOIN ' . hikashop_table('characteristic') . ' AS b ON a.variant_characteristic_id=b.characteristic_id WHERE a.variant_product_id IN (' . implode(',', $ids) . ') ORDER BY a.ordering,b.characteristic_value';
         $database->setQuery($query);
         $characteristics = $database->loadObjectList();
         if (!empty($characteristics)) {
             foreach ($cart->products as $key => $product) {
                 if ($product->product_type != 'variant') {
                     $element =& $cart->products[$key];
                     $product_id = $product->product_id;
                     $mainCharacteristics = array();
                     foreach ($characteristics as $characteristic) {
                         if ($product_id == $characteristic->variant_product_id) {
                             $mainCharacteristics[$product_id][$characteristic->characteristic_parent_id][$characteristic->characteristic_id] = $characteristic;
//.........这里部分代码省略.........
开发者ID:rodhoff,项目名称:MNW,代码行数:101,代码来源:cart.php

示例4: _loadResults

 function _loadResults($table_name, $switch_table, $ids, $columns = null)
 {
     $database = JFactory::getDBO();
     $query = '';
     JArrayHelper::toInteger($ids);
     if (!in_array($switch_table, array('characteristic'))) {
         foreach ($columns as $column) {
             hikashop_securefield($column);
         }
     }
     switch ($table_name) {
         case 'product':
             switch ($switch_table) {
                 case 'price':
                     $taxedPrice = false;
                     $priceValue = false;
                     foreach ($columns as $k => $column) {
                         if ($column == 'price_value_with_tax') {
                             unset($columns[$k]);
                             $taxedPrice = true;
                         }
                         if ($column == 'price_value') {
                             $priceValue = true;
                         }
                     }
                     $addColumn = '';
                     if (!$priceValue && $taxedPrice) {
                         if (count($columns) != 0) {
                             $addColumn .= ', ';
                         }
                         $addColumn .= 'price_value';
                     }
                     $query = 'SELECT ' . implode(',', $columns) . $addColumn . ', price_product_id, price_id';
                     $query .= ' FROM ' . hikashop_table('price');
                     $query .= ' WHERE price_product_id IN (' . implode(',', $ids) . ')';
                     $query .= ' ORDER BY price_id ASC';
                     if ($taxedPrice) {
                         $productClass = hikashop_get('class.product');
                         $currencyHelper = hikashop_get('class.currency');
                         $productClass->getProducts($ids);
                         $zone_id = hikashop_getZone();
                         $database->setQuery($query);
                         $rows = $database->loadObjectList();
                         foreach ($rows as $k => $row) {
                             if (isset($productClass->all_products[$row->price_product_id]) && $productClass->all_products[$row->price_product_id]->product_type == 'main') {
                                 $rows[$k]->price_value_with_tax = $currencyHelper->getTaxedPrice($row->price_value, $zone_id, $productClass->all_products[$row->price_product_id]->product_tax_id);
                             } elseif (isset($productClass->all_products[$productClass->all_products[$row->price_product_id]->product_parent_id]->product_tax_id)) {
                                 $rows[$k]->price_value_with_tax = $currencyHelper->getTaxedPrice($row->price_value, $zone_id, $productClass->all_products[$productClass->all_products[$row->price_product_id]->product_parent_id]->product_tax_id);
                             } else {
                                 $rows[$k]->price_value_with_tax = $rows[$k]->price_value;
                             }
                             if (!$priceValue) {
                                 unset($rows[$k]->price_value);
                             }
                         }
                         $query = '';
                         return $rows;
                     }
                     break;
                 case 'category':
                     $query = 'SELECT c.' . implode(',c.', $columns) . ',pc.product_id,c.category_id';
                     $query .= ' FROM ' . hikashop_table('category') . ' AS c';
                     $query .= ' INNER JOIN ' . hikashop_table('product_category') . ' AS pc ON pc.category_id = c.category_id';
                     $query .= ' WHERE product_id IN (' . implode(',', $ids) . ')';
                     $query .= ' ORDER BY product_category_id';
                     break;
                 case 'characteristic':
                     $query = 'SELECT DISTINCT characteristic.characteristic_id,characteristic.characteristic_parent_id, characteristic.characteristic_value, variant.variant_product_id FROM ' . hikashop_table('characteristic') . ' AS characteristic ';
                     $query .= ' LEFT JOIN ' . hikashop_table('variant') . ' AS variant ON characteristic.characteristic_id = variant.variant_characteristic_id';
                     $query .= ' WHERE variant_product_id IN (' . implode(',', $ids) . ')';
                     $query .= ' ORDER BY variant.ordering';
                     break;
                 case 'related':
                     $query = 'SELECT r.product_id ,p.product_id as \'related_id\',p.product_name, r.product_related_type';
                     $query .= ' FROM ' . hikashop_table('product_related') . ' AS r';
                     $query .= ' INNER JOIN ' . hikashop_table('product') . ' AS p ON r.product_related_id = p.product_id';
                     $query .= ' WHERE r.product_id IN (' . implode(',', $ids) . ')';
                     $query .= ' ORDER BY p.product_id ASC';
                     break;
                 case 'files':
                     $query = 'SELECT *';
                     $query .= ' FROM ' . hikashop_table('file');
                     $query .= ' WHERE file_ref_id IN (' . implode(',', $ids) . ') AND file_type = "file"';
                     $query .= ' ORDER BY file_ordering, file_ref_id ASC';
                     break;
                 case 'images':
                     $query = 'SELECT *';
                     $query .= ' FROM ' . hikashop_table('file');
                     $query .= ' WHERE file_ref_id IN (' . implode(',', $ids) . ') AND file_type = "product"';
                     $query .= ' ORDER BY file_ordering, file_ref_id ASC';
                     break;
             }
             break;
         case 'order':
             switch ($switch_table) {
                 case 'order':
                     $query = 'SELECT o.order_id,p.payment_name,p.payment_id,s.shipping_name,s.shipping_id';
                     $query .= ' FROM ' . hikashop_table('order') . ' as o';
                     $query .= ' LEFT JOIN ' . hikashop_table('shipping') . ' as s ON o.order_shipping_id = s.shipping_id';
                     $query .= ' LEFT JOIN ' . hikashop_table('payment') . ' as p ON o.order_payment_id = p.payment_id';
//.........这里部分代码省略.........
开发者ID:rodhoff,项目名称:MNW,代码行数:101,代码来源:massaction.php

示例5: product_add

 function product_add($order_id = 0)
 {
     $config =& hikashop_config();
     $currencyClass = hikashop_get('class.currency');
     $classOrder = hikashop_get('class.order');
     if ($order_id == 0) {
         $data = $this->_cleanOrder();
         $product_ids = JRequest::getVar('cid', array(), '', 'array');
     } else {
         $data = new stdClass();
         $data->order_id = $order_id;
         $product_ids = JRequest::getVar('product_ids', array(), '', 'array');
     }
     $quantities = JRequest::getVar('quantity', array(), '', 'array');
     $rows = array();
     if (!empty($product_ids)) {
         JArrayHelper::toInteger($product_ids);
         $database = JFactory::getDBO();
         $query = 'SELECT * FROM ' . hikashop_table('product') . ' WHERE product_id IN (' . implode(',', $product_ids) . ')';
         $database->setQuery($query);
         $rows = $database->loadObjectList();
     }
     $user_id = 0;
     $main_currency = (int) $config->get('main_currency', 1);
     $discount_before_tax = (int) $config->get('discount_before_tax', 0);
     if (!empty($data->order_id)) {
         $orderData = $classOrder->get($data->order_id);
         $currency_id = $orderData->order_currency_id;
         $user_id = $orderData->order_user_id;
     } else {
         $currency_id = hikashop_getCurrency();
     }
     $zone_id = hikashop_getZone(null);
     $currencyClass->getPrices($rows, $product_ids, $currency_id, $main_currency, $zone_id, $discount_before_tax, $user_id);
     $element = array();
     if (!empty($rows)) {
         foreach ($rows as $k => $row) {
             $obj = new stdClass();
             $obj->order_product_name = $row->product_name;
             $obj->order_product_code = $row->product_code;
             $obj->order_product_quantity = !empty($quantities[$row->product_id]) ? $quantities[$row->product_id] : 1;
             $currencyClass->pricesSelection($row->prices, $obj->order_product_quantity);
             $obj->product_id = $row->product_id;
             $obj->order_id = (int) $data->order_id;
             if (!empty($row->prices)) {
                 foreach ($row->prices as $price) {
                     $obj->order_product_price = $price->price_value;
                     $obj->order_product_tax = $price->price_value_with_tax - $price->price_value;
                     $obj->order_product_tax_info = $price->taxes;
                 }
             }
             $element[$k] = $obj;
         }
     }
     $result = false;
     $cart_type = JRequest::getString('cart_type', 'cart');
     $cart_id = JRequest::getString($cart_type . '_id', '0');
     if (!empty($data->order_id)) {
         $data->product = $element;
         $classOrder = hikashop_get('class.order');
         $classOrder->recalculateFullPrice($data);
         $result = $classOrder->save($data);
     } else {
         //cart type
         $classCart = hikashop_get('class.cart');
         if ($cart_id == '0') {
             $cart = $classCart->initCart();
             $cart_id = $classCart->save($cart);
         }
         $cart = new stdClass();
         $cart->cart_id = $cart_id;
         $cart->cart_type = $cart_type;
         JRequest::setVar('cart_type', $cart_type);
         JRequest::setVar($cart_type . '_id', $cart_id);
         $result = true;
         foreach ($element as $data) {
             if (!$classCart->update($data->product_id, $data->order_product_quantity, 1, 'cart', false, true)) {
                 $result = false;
             }
         }
         if ($result) {
             $this->_terminate($cart, 'showcart');
         } else {
             $this->product_select();
         }
     }
     if ($result && $order_id == 0) {
         $this->_terminate($data, 1);
     } else {
         return true;
     }
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:92,代码来源:order.php

示例6: compare

 function compare()
 {
     if (!hikashop_level(2)) {
         return;
     }
     $app = JFactory::getApplication();
     $cids = JRequest::getVar('cid', array(), '', 'array');
     $config =& hikashop_config();
     $this->assignRef('config', $config);
     global $Itemid;
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     if (empty($menu)) {
         if (!empty($Itemid)) {
             $menus->setActive($Itemid);
             $menu = $menus->getItem($Itemid);
         }
     }
     if (empty($cids)) {
         if (is_object($menu)) {
             jimport('joomla.html.parameter');
             $category_params = new HikaParameter($menu->params);
             $cids = $category_params->get('product_id');
             if (!is_array($cids)) {
                 $cids = array($cids);
             }
             foreach ($cids as $k => $cid) {
                 if ($k > 7) {
                     unset($cids[$k]);
                 }
             }
         }
     }
     if (empty($cids)) {
         return;
     }
     $c = array();
     foreach ($cids as $cid) {
         if (strpos($cid, ',') !== false) {
             $c = array_merge($c, explode(',', $cid));
         } else {
             $c[] = (int) $cid;
         }
     }
     $cids = $c;
     JArrayHelper::toInteger($cids);
     $empty = '';
     $default_params = $config->get('default_params');
     jimport('joomla.html.parameter');
     $params = new HikaParameter($empty);
     foreach ($default_params as $k => $param) {
         $params->set($k, $param);
     }
     $main_currency = (int) $config->get('main_currency', 1);
     $params->set('main_currency', $main_currency);
     $discount_before_tax = (int) $config->get('discount_before_tax', 0);
     $params->set('discount_before_tax', $discount_before_tax);
     $params->set('show_compare', (int) $config->get('show_compare', 0));
     $compare_limit = (int) $config->get('compare_limit', 5);
     $params->set('compare_limit', $compare_limit);
     $compare_inc_lastseen = (int) $config->get('compare_inc_lastseen', 0);
     $params->set('compare_inc_lastseen', $compare_inc_lastseen);
     $params->set('compare_show_name_separator', (int) $config->get('compare_show_name_separator', 1));
     $params->set('catalogue', (int) $config->get('catalogue', 0));
     $params->set('add_to_cart', (int) 1);
     $params->set('show_price_weight', (int) $config->get('show_price_weight', 0));
     $params->set('characteristic_display', $config->get('characteristic_display', 'table'));
     $params->set('characteristic_display_text', $config->get('characteristic_display_text', 1));
     $params->set('show_quantity_field', $config->get('show_quantity_field', 1));
     $this->assignRef('params', $params);
     if (count($cids) > $compare_limit) {
         $cids = array_slice($cids, 0, $compare_limit);
     }
     $filters = array('a.product_id IN (' . implode(',', $cids) . ')');
     hikashop_addACLFilters($filters, 'product_access', 'a');
     $query = 'SELECT DISTINCT a.product_id, a.*,b.product_category_id, b.category_id, b.ordering FROM ' . hikashop_table('product') . ' AS a LEFT JOIN ' . hikashop_table('product_category') . ' AS b ON a.product_id = b.product_id WHERE ' . implode(' AND ', $filters) . ' ORDER BY b.ordering ASC, a.product_id ASC';
     $database = JFactory::getDBO();
     $database->setQuery($query);
     $elements = $database->loadObjectList();
     if (empty($elements)) {
         return;
     }
     $this->modules = $config->get('product_show_modules', '');
     $module = hikashop_get('helper.module');
     $this->modules = $module->setModuleData($this->modules);
     $currencyClass = hikashop_get('class.currency');
     $currency_id = hikashop_getCurrency();
     $zone_id = hikashop_getZone(null);
     $cart = hikashop_get('helper.cart');
     $this->assignRef('cart', $cart);
     $this->selected_variant_id = 0;
     $productClass = hikashop_get('class.product');
     $this->assignRef('currencyHelper', $currencyClass);
     $fieldsClass = hikashop_get('class.field');
     $this->assignRef('fieldsClass', $fieldsClass);
     $classbadge = hikashop_get('class.badge');
     $this->assignRef('classbadge', $classbadge);
     $fields = array(0 => array());
     $unset = array();
     $done = array();
//.........这里部分代码省略.........
开发者ID:rodhoff,项目名称:MNW,代码行数:101,代码来源:view.html.php

示例7: computePrice

 function computePrice($order, &$payment, $price_all, $payment_price, $currency)
 {
     $currencyClass = hikashop_get('class.currency');
     $zone_id = hikashop_getZone('shipping');
     $payment->payment_currency_id = $currency;
     if (!empty($payment->payment_params->payment_algorithm) && $payment->payment_params->payment_algorithm == 'realcost') {
         if (!empty($payment->payment_params->payment_tax_id) && @$order->full_total->prices[0]->price_value != @$order->full_total->prices[0]->price_value_with_tax) {
             $payment_price_with_tax = $currencyClass->getTaxedPrice($payment_price, $zone_id, $payment->payment_params->payment_tax_id);
             $payment_percentage = (double) @$payment->payment_params->payment_percentage / 100;
             $payment_percentage_with_tax = $currencyClass->getTaxedPrice($payment_percentage, $zone_id, $payment->payment_params->payment_tax_id);
         } else {
             $payment_price_with_tax = $payment_price;
             $payment_percentage_with_tax = (double) @$payment->payment_params->payment_percentage / 100;
         }
         $payment_checkout = ($price_all + $payment_price_with_tax) / (1 - $payment_percentage_with_tax);
         $payment->payment_price_with_tax = $currencyClass->round($payment_checkout - $price_all, $currencyClass->getRounding($currency, true));
         $payment->payment_price = $currencyClass->getUntaxedPrice($payment->payment_price_with_tax, $zone_id, $payment->payment_params->payment_tax_id);
         $payment->payment_tax = $payment->payment_price_with_tax - $payment->payment_price;
         return $payment->payment_price;
     } else {
         $payment->payment_price = $currencyClass->round($price_all * (double) @$payment->payment_params->payment_percentage / 100 + $payment_price, $currencyClass->getRounding($currency, true));
         if (!empty($payment->payment_params->payment_tax_id) && isset($order->full_total->prices[0]->price_value_without_payment_with_tax)) {
             $payment->payment_price_with_tax = $currencyClass->getTaxedPrice($payment->payment_price, $zone_id, $payment->payment_params->payment_tax_id);
             $payment->payment_tax = $payment->payment_price_with_tax - $payment->payment_price;
             return $payment->payment_price_with_tax;
         }
     }
     return $payment->payment_price;
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:29,代码来源:payment.php

示例8: processPayments

 function processPayments(&$usable_rates)
 {
     if (!empty($usable_rates)) {
         $this->convertPayments($usable_rates);
         $zone_id = hikashop_getZone();
         foreach ($usable_rates as $k => $rate) {
             $round = $this->getRounding(@$rate->payment_currency_id, true);
             if (!empty($rate->payment_params->payment_tax_id) && bccomp($rate->payment_price, 0, 5)) {
                 if (!empty($usable_rates[$k]->taxes_added)) {
                     continue;
                 }
                 $usable_rates[$k]->taxes_added = true;
                 $usable_rates[$k]->payment_price_with_tax = $this->getTaxedPrice($rate->payment_price, $zone_id, $rate->payment_params->payment_tax_id, $round);
                 $usable_rates[$k]->taxes = $this->taxRates;
                 if (isset($rate->payment_price_orig) && bccomp($rate->payment_price_orig, 0, 5)) {
                     $usable_rates[$k]->payment_price_orig_with_tax = $this->getTaxedPrice($rate->payment_price_orig, $zone_id, $rate->payment_params->payment_tax_id, $round);
                     $usable_rates[$k]->taxes_orig = $this->taxRates;
                 } else {
                     $usable_rates[$k]->payment_price_orig = 0.0;
                     $usable_rates[$k]->payment_price_orig_with_tax = 0.0;
                 }
             } else {
                 if (!is_object($usable_rates[$k])) {
                     $usable_rates[$k] = new stdClass();
                 }
                 $usable_rates[$k]->payment_price_with_tax = @$rate->payment_price;
                 $usable_rates[$k]->payment_price_orig_with_tax = @$usable_rates[$k]->payment_price_orig;
             }
         }
     }
     JPluginHelper::importPlugin('hikashop');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onAfterProcessPayments', array(&$usable_rates));
 }
开发者ID:q0821,项目名称:esportshop,代码行数:34,代码来源:currency.php

示例9: addRate

 function addRate(&$rates, $service_types, $parcel, &$rate, $currency, $nb_package)
 {
     if (empty($nb_package)) {
         $nb_package = 1;
     }
     $app = JFactory::getApplication();
     if ($parcel->country_code == 'AU') {
         $queryParams = array("from_postcode" => $parcel->from_postcode, "to_postcode" => $parcel->to_postcode, "length" => $parcel->Length, "width" => $parcel->Width, "height" => $parcel->Height, "weight" => $parcel->Weight);
         $urlPrefix = 'auspost.com.au';
         $postageTypesURL = 'http://' . $urlPrefix . '/api/v3/postage/domestic/service.json?' . http_build_query($queryParams);
         $session = curl_init();
         curl_setopt($session, CURLOPT_URL, $postageTypesURL);
         curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($session, CURLOPT_HTTPHEADER, array('AUTH-KEY: ' . $rate->shipping_params->api_key));
         $rawBody = curl_exec($session);
         if (!$rawBody) {
             $app->enqueueMessage('Error: "' . curl_error($session) . '" - Code: ' . curl_errno($session));
             return false;
         }
         $serviceTypesJSON = json_decode($rawBody);
     } else {
         $queryParams = array("country_code" => $parcel->country_code, "weight" => $parcel->Weight);
         $urlPrefix = 'auspost.com.au';
         $postageTypesURL = 'http://' . $urlPrefix . '/api/postage/parcel/international/service.json?' . http_build_query($queryParams);
         $session = curl_init();
         curl_setopt($session, CURLOPT_URL, $postageTypesURL);
         curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($session, CURLOPT_HTTPHEADER, array('AUTH-KEY: ' . $rate->shipping_params->api_key));
         $rawBody = curl_exec($session);
         if (!$rawBody) {
             $app->enqueueMessage('Error: "' . curl_error($session) . '" - Code: ' . curl_errno($session));
             return false;
         }
         $serviceTypesJSON = json_decode($rawBody);
     }
     if (isset($serviceTypesJSON->services->service) && !empty($serviceTypesJSON->services->service)) {
         $data = array();
         foreach ($serviceTypesJSON->services->service as $key => $service) {
             if (in_array($service->code, $service_types) && isset($service->price)) {
                 if (empty($rates[$service->code])) {
                     $info = new stdClass();
                     $info = !HIKASHOP_PHP5 ? $rate : clone $rate;
                     $shipping_name = JText::_($service->code . '_NAME');
                     if ($shipping_name != $service->code . '_NAME') {
                         $info->shipping_name .= ' ' . $shipping_name;
                     } else {
                         $info->shipping_name .= ' ' . $service->name;
                     }
                     if (!empty($rate->shipping_description)) {
                         $info->shipping_description = $rate->shipping_description . ' ';
                     } else {
                         $shipping_description = JText::_($service->code . '_DESCRIPTION');
                         if ($shipping_description != $service->code . '_DESCRIPTION') {
                             $info->shipping_description .= $shipping_description;
                         }
                     }
                     $info->shipping_id .= '-' . $this->shipping_types[$service->code];
                     $rates[$service->code] = $info;
                 } else {
                     $shipping_description = JText::_($service->code . '_DESCRIPTION');
                     if ($shipping_description == $service->code . '_DESCRIPTION') {
                         $shipping_description = '';
                     }
                     if (empty($shipping_description)) {
                         $shipping_description = $rate->shipping_description;
                     }
                     if (!empty($shipping_description)) {
                         $shipping_description .= '<br/>';
                     }
                     if ($nb_package > 1 && (isset($rate->shipping_params->shipping_group) && $rate->shipping_params->shipping_group)) {
                         $rates[$service->code]->shipping_description = $shipping_description . JText::sprintf('X_PACKAGES', $nb_package);
                     } else {
                         $rates[$service->code]->shipping_description = $shipping_description;
                     }
                 }
                 if (@$rates[$service->code]->shipping_tax_id) {
                     $currencyClass = hikashop_get('class.currency');
                     $service->price = $currencyClass->getUntaxedPrice($service->price, hikashop_getZone(), $rates[$service->code]->shipping_tax_id);
                 }
                 $rates[$service->code]->shipping_price += $service->price;
                 $rates[$service->code]->shipping_currency_id = $currency;
             }
         }
     } else {
         if (isset($serviceTypesJSON->error->errorMessage) && !empty($serviceTypesJSON->error->errorMessage)) {
             $app->enqueueMessage($serviceTypesJSON->error->errorMessage);
             return false;
         }
     }
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:90,代码来源:aupost2.php

示例10: addRate

 function addRate(&$rates, $type, $parcel, &$rate, $currency, $nb_package)
 {
     if (empty($nb_package)) {
         $nb_package = 1;
     }
     $parcel->Service_Type = $type;
     $url = 'http://drc.edeliver.com.au/ratecalc.asp?';
     foreach (get_object_vars($parcel) as $key => $val) {
         $url .= $key . '=' . $val . '&';
     }
     $url = rtrim($url, '&');
     $url = parse_url($url);
     if (!isset($url['query'])) {
         $url['query'] = '';
     }
     if (!isset($url['port'])) {
         if (!empty($url['scheme']) && in_array($url['scheme'], array('https', 'ssl'))) {
             $url['port'] = 443;
         } else {
             $url['port'] = 80;
         }
     }
     if (!empty($url['scheme']) && in_array($url['scheme'], array('https', 'ssl'))) {
         $url['host_socket'] = 'ssl://' . $url['host'];
     } else {
         $url['host_socket'] = $url['host'];
     }
     $fp = fsockopen($url['host_socket'], $url['port'], $errno, $errstr, 30);
     if (!$fp) {
         $app = JFactory::getApplication();
         $app->enqueueMessage('Cannot connect to australia post web service. You hosting company might be blocking outbond connections');
         return false;
     }
     $uri = $url['path'] . ($url['query'] != '' ? '?' . $url['query'] : '');
     $header = "GET {$uri} HTTP/1.0\r\n" . "User-Agent: PHP/" . phpversion() . "\r\n" . "Referer: " . hikashop_currentURL() . "\r\n" . "Server: " . $_SERVER['SERVER_SOFTWARE'] . "\r\n" . "Host: " . $url['host'] . ":" . $url['port'] . "\r\n" . "Accept: */" . "*\r\n\r\n";
     fwrite($fp, $header);
     $response = '';
     while (!feof($fp)) {
         $response .= fgets($fp, 1024);
     }
     fclose($fp);
     $pos = strpos($response, "\r\n\r\n");
     $header = substr($response, 0, $pos);
     $body = substr($response, $pos + 2 * strlen("\r\n\r\n"));
     if (preg_match_all('#([a-z_]+)=([a-z_\\.0-9 ]+?)#Ui', $response, $matches)) {
         $data = array();
         foreach ($matches[1] as $key => $val) {
             $data[$val] = $matches[2][$key];
         }
         if (!empty($data['err_msg'])) {
             if ($data['err_msg'] == 'OK') {
                 if (empty($rates[$type])) {
                     $info = new stdClass();
                     $info = !HIKASHOP_PHP5 ? $rate : clone $rate;
                     $info->shipping_name .= ' ' . JText::_($type);
                     if (!empty($rate->shipping_description)) {
                         $info->shipping_description = $rate->shipping_description . ' ';
                     } else {
                         $shipping_description = JText::_($type . '_DESCRIPTION');
                         if ($shipping_description == $type . '_DESCRIPTION') {
                             $info->shipping_description .= $shipping_description;
                         }
                         $info->shipping_description = $shipping_description;
                     }
                     $types = array('SEA' => 1, 'AIR' => 2, 'EXPRESS' => 3, 'STANDARD' => 4);
                     $info->shipping_id .= '-' . $types[$type];
                     $rates[$type] = $info;
                 } else {
                     $shipping_description = JText::_($type . '_DESCRIPTION');
                     if ($shipping_description == $type . '_DESCRIPTION') {
                         $shipping_description = '';
                     }
                     if (empty($shipping_description)) {
                         $shipping_description = $rate->shipping_description;
                     }
                     if (!empty($shipping_description)) {
                         $shipping_description .= '<br/>';
                     }
                     if ($nb_package > 1 && (isset($rate->shipping_params->shipping_group) && $rate->shipping_params->shipping_group)) {
                         $rates[$type]->shipping_description = $shipping_description . JText::sprintf('X_PACKAGES', $nb_package);
                     } else {
                         $rates[$type]->shipping_description = $shipping_description;
                     }
                 }
                 if (@$rates[$type]->shipping_tax_id) {
                     $currencyClass = hikashop_get('class.currency');
                     $data['charge'] = $currencyClass->getUntaxedPrice($data['charge'], hikashop_getZone(), $rates[$type]->shipping_tax_id);
                 }
                 $rates[$type]->shipping_price += $data['charge'];
             } elseif (!empty($data['err_msg'])) {
                 if (preg_match('#Selected Destination not reached by .*#i', $data['err_msg'])) {
                     return true;
                 }
                 $app = JFactory::getApplication();
                 $app->enqueueMessage('The request to the Australia Post server failed with the message: ' . $data['err_msg']);
             } else {
                 $app = JFactory::getApplication();
                 $app->enqueueMessage('The request to the Australia Post server failed');
             }
         }
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:aupost.php

示例11: listing

 function listing()
 {
     $this->setName();
     $app = JFactory::getApplication();
     $database = JFactory::getDBO();
     $config =& hikashop_config();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.cart_modified', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     $popup = JRequest::getString('tmpl') === 'component';
     $this->assignRef('popup', $popup);
     if (JRequest::getString('cart_type', 'cart') == 'cart') {
         $filters = array('a.cart_type=\'cart\'');
     } else {
         $filters = array('a.cart_type=\'wishlist\'');
     }
     $searchMap = array('a.cart_id', 'a.user_id', 'a.cart_name', 'a.cart_coupon', 'a.cart_type');
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
     }
     $groupBy = 'GROUP BY a.cart_id';
     $order = '';
     if (!empty($pageInfo->filter->order->value)) {
         $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     if (!empty($filters)) {
         $filters = ' WHERE ' . implode(' AND ', $filters);
     } else {
         $filters = '';
     }
     $from = 'FROM ' . hikashop_table('cart') . ' AS a';
     $cartProduct = 'JOIN ' . hikashop_table('cart_product') . ' AS b ON a.cart_id=b.cart_id';
     $query = $from . ' ' . $cartProduct . ' ' . $filters . ' ' . $groupBy . ' ' . $order;
     $database->setQuery('SELECT a.*, b.* ' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     if (!empty($pageInfo->search)) {
         $rows = hikashop_search($pageInfo->search, $rows, 'cart_id');
     }
     $database->setQuery('SELECT COUNT(*) ' . $from . ' ' . $cartProduct . ' ' . $filters . ' ' . $groupBy);
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     $currencyClass = hikashop_get('class.currency');
     $this->assignRef('currencyHelper', $currencyClass);
     $currencyClass = hikashop_get('class.currency');
     $productClass = hikashop_get('class.product');
     $main_currency = (int) $config->get('main_currency', 1);
     $currency_id = hikashop_getCurrency();
     if ($config->get('tax_zone_type', 'shipping') == 'billing') {
         $zone_id = hikashop_getZone('billing');
     } else {
         $zone_id = hikashop_getZone('shipping');
     }
     $discount_before_tax = (int) $config->get('discount_before_tax', 0);
     $cartClass = hikashop_get('class.cart');
     foreach ($rows as $k => $row) {
         if ($row->cart_id != null) {
             $cartClass->cart = new stdClass();
             $cartClass->cart->cart_id = (int) $row->cart_id;
             $cartClass->cart->cart_type = JRequest::getString('cart_type', 'cart');
             $rows[$k]->full_cart = $cartClass->loadFullCart(false, true, true);
             $rows[$k]->price = isset($rows[$k]->full_cart->full_total->prices[0]->price_value) ? $rows[$k]->full_cart->full_total->prices[0]->price_value : 0;
             $rows[$k]->quantity = isset($rows[$k]->full_cart->number_of_items) ? $rows[$k]->full_cart->number_of_items : 0;
             $rows[$k]->currency = isset($rows[$k]->full_cart->full_total->prices[0]->price_currency_id) ? $rows[$k]->full_cart->full_total->prices[0]->price_currency_id : $config->get('main_currency', 1);
         }
     }
     $cart = hikashop_get('helper.cart');
     $this->assignRef('cart', $cart);
     $this->assignRef('carts', $rows);
     $pageInfo->elements->total = count($rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->getPagination();
     $manageUser = hikashop_isAllowed($config->get('acl_user_manage', 'all'));
     $this->assignRef('manageUser', $manageUser);
     $pageInfo->manageUser = $manageUser;
     $manage = hikashop_isAllowed($config->get('acl_wishlist_manage', 'all'));
     $this->assignRef('manage', $manage);
     hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $this->toolbar = array(array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_wishlist_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
 }
开发者ID:q0821,项目名称:esportshop,代码行数:87,代码来源:view.html.php

示例12: generateXML


//.........这里部分代码省略.........
         for ($i = count($mainCat); $i > 0; $i--) {
             $path .= $mainCat[$i - 1]->category_name . ' > ';
         }
         $category_path[$id]['path'] = substr($path, 0, -3);
     }
     $queryImage = 'SELECT * FROM ' . hikashop_table('file') . ' WHERE file_ref_id IN (' . implode(',', $ids) . ') AND file_type=\'product\' ORDER BY file_ordering ASC, file_id ASC';
     $db->setQuery($queryImage);
     $images = $db->loadObjectList();
     $products[$k]->images = array();
     foreach ($products as $k => $row) {
         $i = 0;
         foreach ($images as $image) {
             if ($row->product_id == $image->file_ref_id) {
                 $products[$k]->images[$i] = new stdClass();
                 foreach (get_object_vars($image) as $key => $name) {
                     $products[$k]->images[$i]->{$key} = $name;
                 }
             }
             $i++;
         }
     }
     $db->setQuery('SELECT * FROM ' . hikashop_table('variant') . ' WHERE variant_product_id IN (' . implode(',', $ids) . ')');
     $variants = $db->loadObjectList();
     if (!empty($variants)) {
         foreach ($products as $k => $product) {
             foreach ($variants as $variant) {
                 if ($product->product_id == $variant->variant_product_id) {
                     $products[$k]->has_options = true;
                     break;
                 }
             }
         }
     }
     $zone_id = hikashop_getZone();
     $currencyClass = hikashop_get('class.currency');
     $config =& hikashop_config();
     $main_currency = (int) $config->get('main_currency', 1);
     if (empty($plugin->params['price_displayed'])) {
         $plugin->params['price_displayed'] = 'cheapest';
     }
     if ($plugin->params['price_displayed'] == 'cheapest') {
         $currencyClass->getListingPrices($products, $zone_id, $main_currency, 'cheapest');
     }
     if ($plugin->params['price_displayed'] == 'unit') {
         $currencyClass->getListingPrices($products, $zone_id, $main_currency, 'unit');
     }
     if ($plugin->params['price_displayed'] == 'average') {
         $currencyClass->getListingPrices($products, $zone_id, $main_currency, 'range');
         $tmpPrice = 0;
         $tmpTaxPrice = 0;
         foreach ($products as $product) {
             if (isset($product->prices[0]->price_value)) {
                 if (count($product->prices) > 1) {
                     for ($i = 0; $i < count($product->prices); $i++) {
                         if ($product->prices[$i]->price_value > $tmpPrice) {
                             $tmpPrice += $product->prices[$i]->price_value;
                             $tmpTaxPrice += @$product->prices[$i]->price_value_with_tax;
                         }
                     }
                     $product->prices[0]->price_value = $tmpPrice / count($product->prices);
                     $product->prices[0]->price_value_with_tax = $tmpTaxPrice / count($product->prices);
                     for ($i = 1; $i < count($product->prices); $i++) {
                         unset($product->prices[$i]);
                     }
                 }
             }
开发者ID:q0821,项目名称:esportshop,代码行数:67,代码来源:google_products.php

示例13: onAfterCartShippingLoad

 function onAfterCartShippingLoad(&$cart)
 {
     $app = JFactory::getApplication();
     $opt = $this->readGeneralOptions();
     $no_virtual_coupon = (int) $app->getUserState(HIKASHOP_COMPONENT . '.userpoints_no_virtual_coupon', (int) (@$opt['checkout_step'] && @$opt['default_no_use']));
     if (!empty($no_virtual_coupon)) {
         unset($cart->additional['userpoints']);
         unset($cart->additional['userpoints_points']);
         return;
     }
     $user = JFactory::getUser();
     if (empty($user->id)) {
         return false;
     }
     if (isset($cart->additional['userpoints'])) {
         return;
     }
     $ret = $this->getCartUsedPoints($cart);
     if (empty($ret)) {
         return;
     }
     $pointsToLoose = $ret['points'];
     $coupon = $ret['value'];
     if (isset($cart->order_currency_id)) {
         $currency_id = $cart->order_currency_id;
     } else {
         $currency_id = hikashop_getCurrency();
     }
     $zone_id = hikashop_getZone();
     $tax_id = (int) @$this->payment_params->tax_id;
     $currencyClass = hikashop_get('class.currency');
     $userpoints = new stdClass();
     $userpoints->name = 'USERPOINTS_DISCOUNT';
     $userpoints->value = '';
     $userpoints->price_currency_id = $currency_id;
     $userpoints->price_value = -$coupon;
     $userpoints->price_value_with_tax = $currencyClass->getTaxedPrice($userpoints->price_value, $zone_id, $tax_id);
     $cart->additional['userpoints'] = $userpoints;
     $userpoints_points = new stdClass();
     $userpoints_points->name = 'USERPOINTS_USE_POINTS';
     $userpoints_points->value = $pointsToLoose . ' ' . JText::_('USERPOINTS_POINTS');
     $userpoints_points->price_currency_id = 0;
     $userpoints_points->price_value = 0;
     $userpoints_points->price_value_with_tax = 0;
     $cart->additional['userpoints_points'] = $userpoints_points;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:46,代码来源:userpoints.php

示例14: edit_products

 public function edit_products($tpl = null)
 {
     $config = hikashop_config();
     $this->assignRef('config', $config);
     $productClass = hikashop_get('class.product');
     $fieldsClass = hikashop_get('class.field');
     $this->assignRef('fieldsClass', $fieldsClass);
     $order_id = JRequest::getInt('order_id');
     $order_product_id = JRequest::getInt('order_product_id', 0);
     $orderClass = hikashop_get('class.order');
     $order = $orderClass->loadFullOrder($order_id);
     $originalProduct = new stdClass();
     if (!empty($order_product_id)) {
         $orderProductClass = hikashop_get('class.order_product');
         $orderProduct = $orderProductClass->get($order_product_id);
         if (empty($orderProduct) || $orderProduct->order_id != $order_id) {
             $orderProduct = new stdClass();
             $orderProduct->order_id = $order_id;
         }
         if (!empty($orderProduct->product_id)) {
             $originalProduct = $productClass->get($orderProduct->product_id);
         }
     } else {
         $orderProduct = new stdClass();
         $orderProduct->order_id = $order_id;
         $orderProduct->order_product_quantity = 1;
         $product_id = JRequest::getVar('cid', array(), '', 'array');
         if (!empty($product_id)) {
             $database = JFactory::getDBO();
             $query = 'SELECT product_parent_id FROM ' . hikashop_table('product') . ' WHERE product_id = ' . (int) $product_id[0];
             $database->setQuery($query);
             $product_parent_id = $database->loadResult();
             $isVariant = false;
             if ($product_parent_id != 0) {
                 $product_id[1] = $product_parent_id;
                 $isVariant = true;
             }
             if ($productClass->getProducts($product_id)) {
                 $products = $productClass->products;
                 $allproducts = $productClass->all_products;
                 if (!$isVariant) {
                     $product = $products[(int) $product_id[0]];
                 } else {
                     $product = $allproducts[(int) $product_id[1]]->variants[(int) $product_id[0]];
                 }
                 $product->options = array();
                 $originalProduct = $product;
                 $orderProduct->product_id = $product->product_id;
                 if ($isVariant && empty($product->product_name)) {
                     $product->product_name = $allproducts[(int) $product_id[1]]->product_name;
                 }
                 $orderProduct->order_product_name = strip_tags($product->product_name);
                 $orderProduct->order_product_code = $product->product_code;
                 $currencyClass = hikashop_get('class.currency');
                 $main_currency = (int) $config->get('main_currency', 1);
                 $discount_before_tax = (int) $config->get('discount_before_tax', 0);
                 $currency_id = $order->order_currency_id;
                 if ($config->get('tax_zone_type', 'shipping') == 'billing') {
                     $orderClass->loadAddress($order->order_billing_address_id, $order, 'billing', 'object', 'backend');
                     if (!empty($order->billing_address->address_state->zone_id)) {
                         $zone_id = $order->billing_address->address_state->zone_id;
                     } elseif (!empty($order->billing_address->address_country->zone_id)) {
                         $zone_id = $order->billing_address->address_country->zone_id;
                     } else {
                         $zone_id = hikashop_getZone('billing');
                     }
                 } else {
                     $orderClass->loadAddress($order->order_shipping_address_id, $order, 'shipping', 'object', 'backend');
                     if (!empty($order->shipping_address->address_state->zone_id)) {
                         $zone_id = $order->shipping_address->address_state->zone_id;
                     } elseif (!empty($order->shipping_address->address_country->zone_id)) {
                         $zone_id = $order->shipping_address->address_country->zone_id;
                     } else {
                         $zone_id = hikashop_getZone('shipping');
                     }
                 }
                 $rows = array($product);
                 if ($isVariant) {
                     $rows[] = $allproducts[(int) $product_id[1]];
                 }
                 $currencyClass->getPrices($rows, $product_id, $currency_id, $main_currency, $zone_id, $discount_before_tax, (int) $order->order_user_id);
                 if (empty($rows[0]->prices) && !empty($rows[1]->prices)) {
                     $rows[0]->prices = $rows[1]->prices;
                 }
                 $currencyClass->pricesSelection($rows[0]->prices, 0);
                 if (!empty($rows[0]->prices)) {
                     foreach ($rows[0]->prices as $price) {
                         $orderProduct->order_product_price = $price->price_value;
                         $orderProduct->order_product_tax = @$price->price_value_with_tax - @$price->price_value;
                         $orderProduct->order_product_tax_info = @$price->taxes;
                     }
                 }
             }
         }
     }
     $this->assignRef('orderProduct', $orderProduct);
     $this->assignRef('originalProduct', $originalProduct);
     $ratesType = hikashop_get('type.rates');
     $this->assignRef('ratesType', $ratesType);
     if (hikashop_level(2)) {
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:view.html.php

示例15: _checkData


//.........这里部分代码省略.........
     if (isset($product->product_quantity) && !is_numeric($product->product_quantity)) {
         $product->product_quantity = -1;
     }
     foreach ($this->fields as $field) {
         if (empty($product->{$field}) && !empty($this->template->{$field})) {
             $product->{$field} = $this->template->{$field};
         }
     }
     if (empty($product->product_dimension_unit)) {
         $product->product_dimension_unit = $this->volumeHelper->getSymbol();
     } else {
         $product->product_dimension_unit = strtolower($product->product_dimension_unit);
     }
     if (empty($product->product_weight_unit)) {
         $product->product_weight_unit = $this->weightHelper->getSymbol();
     } else {
         $product->product_weight_unit = strtolower($product->product_weight_unit);
     }
     if (!empty($product->product_published)) {
         $product->product_published = 1;
     }
     if (!isset($product->product_published)) {
         if (!empty($this->template)) {
             $product->product_published = $this->template->product_published;
         }
     }
     if (!empty($product->price_value_with_tax)) {
         $currencyHelper = hikashop_get('class.currency');
         if (empty($product->product_tax_id)) {
             $product->product_tax_id = $currencyHelper->getTaxCategory();
         }
         if ($product->product_tax_id) {
             if (strpos($product->price_value_with_tax, '|') === false) {
                 $product->price_value = $currencyHelper->getUntaxedPrice(hikashop_toFloat($product->price_value_with_tax), hikashop_getZone(), $product->product_tax_id);
             } else {
                 $price_value = explode('|', $product->price_value_with_tax);
                 foreach ($price_value as $k => $price_value_one) {
                     $price_value[$k] = $currencyHelper->getUntaxedPrice($price_value_one, hikashop_getZone(), $product->product_tax_id);
                 }
                 $product->price_value = implode('|', $price_value);
             }
         }
     }
     if (!empty($product->price_value)) {
         $product->prices = array();
         if (strpos($product->price_value, '|') === false) {
             $price = new stdClass();
             $price->price_value = hikashop_toFloat($product->price_value);
             if (!empty($this->price_fee)) {
                 $price->price_value += $price->price_value * hikashop_toFloat($this->price_fee) / 100;
             }
             $price->price_min_quantity = (int) @$product->price_min_quantity;
             if ($price->price_min_quantity == 1) {
                 $price->price_min_quantity = 0;
             }
             if (empty($product->price_access)) {
                 $price->price_access = 'all';
             } else {
                 $price->price_access = $product->price_access;
             }
             if (!empty($product->price_currency_id)) {
                 if (!is_numeric($product->price_currency_id)) {
                     $product->price_currency_id = $this->_getCurrency($product->price_currency_id);
                 }
                 $price->price_currency_id = $product->price_currency_id;
             } else {
开发者ID:q0821,项目名称:esportshop,代码行数:67,代码来源:import.php


注:本文中的hikashop_getZone函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。