• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP hikashop_getZone函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了hikashop_getZone函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 ($produ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP hikashop_import函数代码示例发布时间:2022-05-15
下一篇:
PHP hikashop_getLayout函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap