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


PHP hikashop_getCurrency函数代码示例

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


在下文中一共展示了hikashop_getCurrency函数的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: onShippingDisplay

 function onShippingDisplay(&$order, &$dbrates, &$usable_rates, &$messages)
 {
     if (!hikashop_loadUser()) {
         return false;
     }
     if ($this->loadShippingCache($order, $usable_rates, $messages)) {
         return true;
     }
     $local_usable_rates = array();
     $local_messages = array();
     $currencyClass = hikashop_get('class.currency');
     $ret = parent::onShippingDisplay($order, $dbrates, $local_usable_rates, $local_messages);
     if ($ret === false) {
         return false;
     }
     $cache_usable_rates = array();
     $cache_messages = array();
     $currentCurrencyId = null;
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $iAmSuperAdmin = false;
     if (!HIKASHOP_J16) {
         $iAmSuperAdmin = $user->get('gid') == 25;
     } else {
         $iAmSuperAdmin = $user->authorise('core.admin');
     }
     if ($iAmSuperAdmin) {
         $app->enqueueMessage('That Australia Post shipping version is deprecated and is using the old Australia post API, Please start using the new Australia Post v2 shipping method');
     }
     foreach ($local_usable_rates as $rate) {
         if (!empty($rate->shipping_zone_namekey)) {
             if (empty($rate->shipping_params->SEA) && empty($rate->shipping_params->AIR) && !empty($order->shipping_address->address_country)) {
                 $db = JFactory::getDBO();
                 if (is_array($order->shipping_address->address_country)) {
                     $address_country = reset($order->shipping_address->address_country);
                 } else {
                     $address_country = $order->shipping_address->address_country;
                 }
                 $db->setQuery('SELECT * FROM ' . hikashop_table('zone') . ' WHERE zone_namekey=' . $db->Quote($address_country));
                 $currentShippingZone = $db->loadObject();
                 if ($currentShippingZone->zone_code_3 != 'AUS') {
                     $messages['no_shipping_to_your_zone'] = JText::_('NO_SHIPPING_TO_YOUR_ZONE');
                     continue;
                 }
             }
         }
         $check = false;
         if (empty($order->shipping_address->address_post_code)) {
             $check = true;
             $message = 'The Australia Post shipping plugin requires the user to enter a postal code when goods are shipped within Australia. Please go to "Display->Custom fields" and set the post code field to required.';
         } elseif (!preg_match('#[0-9]{4}#', $order->shipping_address->address_post_code)) {
             $check = true;
             $message = 'The post code entered is not valid';
             $order->shipping_address->address_post_code = preg_replace('#[^0-9A-Z]#', '', $order->shipping_address->address_post_code);
         }
         if ($check) {
             $zoneClass = hikashop_get('class.zone');
             $zones = $zoneClass->getOrderZones($order);
             $db = JFactory::getDBO();
             $db->setQuery('SELECT zone_namekey FROM ' . hikashop_table('zone') . ' WHERE zone_code_3=' . $db->Quote('AUS'));
             $australia_zone = $db->loadResult();
             if (in_array($australia_zone, $zones)) {
                 $cache_messages['post_code_missing'] = $message;
                 continue;
             }
         }
         if (empty($order->shipping_address_full)) {
             $cart = hikashop_get('class.cart');
             $address = $app->getUserState(HIKASHOP_COMPONENT . '.shipping_address');
             $cart->loadAddress($order->shipping_address_full, $address, 'object', 'shipping');
         }
         $rates = array();
         $this->getRates($rate, $order, $rates);
         if (!empty($rate->shipping_params->reverse_order)) {
             $rates = array_reverse($rates, true);
         }
         foreach ($rates as $finalRate) {
             if (hikashop_getCurrency() != 6) {
                 $finalRate->shipping_price = $currencyClass->convertUniquePrice($finalRate->shipping_price, 6, hikashop_getCurrency());
             }
             $usable_rates[$finalRate->shipping_id] = $finalRate;
             $cache_usable_rates[$finalRate->shipping_id] = $finalRate;
         }
     }
     $this->setShippingCache($order, $cache_usable_rates, $cache_messages);
     if (!empty($cache_messages)) {
         foreach ($cache_messages as $k => $msg) {
             $messages[$k] = $msg;
         }
     }
     return true;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:92,代码来源:aupost.php

示例3: getShippingProductsData


//.........这里部分代码省略.........
     $order->shipping_prices[$key]->products = array();
     $order->shipping_prices[$key]->volume = 0.0;
     $order->shipping_prices[$key]->weight = 0.0;
     $order->shipping_prices[$key]->total_quantity = 0;
     if (!empty($order->products)) {
         $all_products = new stdClass();
         $all_products->products = array();
         $real_products = new stdClass();
         $real_products->products = array();
         $volumeClass = hikashop_get('helper.volume');
         $weightClass = hikashop_get('helper.weight');
         foreach ($order->products as $k => $row) {
             if (!empty($products) && !isset($products[$k])) {
                 continue;
             }
             if (empty($order->shipping_prices[$key]->products[$row->product_id])) {
                 $order->shipping_prices[$key]->products[$row->product_id] = 0;
             }
             $order->shipping_prices[$key]->products[$row->product_id] += @$row->cart_product_quantity;
             if (!empty($row->product_parent_id)) {
                 if (!isset($order->shipping_prices[$key]->products[$row->product_parent_id])) {
                     $order->shipping_prices[$key]->products[$row->product_parent_id] = 0;
                 }
                 $order->shipping_prices[$key]->products[$row->product_parent_id] += @$row->cart_product_quantity;
             }
             if (@$row->product_weight > 0) {
                 $real_products->products[] = $row;
             }
             if ($key !== 0) {
                 $all_products->products[] = $row;
             }
             if ($key !== 0 && !empty($row->cart_product_quantity)) {
                 if (!empty($row->cart_product_parent_id)) {
                     if (!bccomp($row->product_length, 0, 5) || !bccomp($row->product_width, 0, 5) || !bccomp($row->product_height, 0, 5)) {
                         foreach ($order->products as $l => $elem) {
                             if ($elem->cart_product_id == $row->cart_product_parent_id) {
                                 $row->product_length = $elem->product_length;
                                 $row->product_width = $elem->product_width;
                                 $row->product_height = $elem->product_height;
                                 $row->product_dimension_unit = $elem->product_dimension_unit;
                                 break;
                             }
                         }
                     }
                     if (!bccomp($row->product_weight, 0, 5)) {
                         foreach ($order->products as $l => $elem) {
                             if ($elem->cart_product_id == $row->cart_product_parent_id) {
                                 $row->product_weight = $elem->product_weight;
                                 $row->product_weight_unit = $elem->product_weight_unit;
                                 break;
                             }
                         }
                     }
                 }
                 if (bccomp($row->product_length, 0, 5) && bccomp($row->product_width, 0, 5) && bccomp($row->product_height, 0, 5)) {
                     if (!isset($row->product_total_volume)) {
                         $row->product_volume = $row->product_length * $row->product_width * $row->product_height;
                         $row->product_total_volume = $row->product_volume * $row->cart_product_quantity;
                         $row->product_total_volume_orig = $row->product_total_volume;
                         $row->product_dimension_unit_orig = $row->product_dimension_unit;
                         $row->product_total_volume = $volumeClass->convert($row->product_total_volume, $row->product_dimension_unit);
                         $row->product_dimension_unit = $order->volume_unit;
                     }
                     $order->shipping_prices[$key]->volume += $row->product_total_volume;
                 }
                 if (bccomp($row->product_weight, 0, 5)) {
                     if ($row->product_weight_unit != $order->weight_unit) {
                         $row->product_weight_orig = $row->product_weight;
                         $row->product_weight_unit_orig = $row->product_weight_unit;
                         $row->product_weight = $weightClass->convert($row->product_weight, $row->product_weight_unit);
                         $row->product_weight_unit = $order->weight_unit;
                     }
                     $order->shipping_prices[$key]->weight += $row->product_weight * $row->cart_product_quantity;
                 }
                 $order->shipping_prices[$key]->total_quantity += $row->cart_product_quantity;
             }
         }
         $currencyClass = hikashop_get('class.currency');
         $currencyClass->calculateTotal($real_products->products, $real_products->total, hikashop_getCurrency());
         $order->shipping_prices[$key]->real_with_tax = $real_products->total->prices[0]->price_value_with_tax;
         $order->shipping_prices[$key]->real_without_tax = $real_products->total->prices[0]->price_value;
         if ($key !== 0) {
             $currencyClass->calculateTotal($all_products->products, $all_products->total, hikashop_getCurrency());
             $order->shipping_prices[$key]->all_with_tax = $all_products->total->prices[0]->price_value_with_tax;
             $order->shipping_prices[$key]->all_without_tax = $all_products->total->prices[0]->price_value;
             if (!empty($order->coupon)) {
                 if ($order->coupon->discount_flat_amount != 0) {
                     $order->shipping_prices[$key]->all_with_tax -= $order->coupon->discount_flat_amount;
                     $order->shipping_prices[$key]->all_without_tax -= $order->coupon->discount_flat_amount;
                 } elseif ($order->coupon->discount_percent_amount != 0) {
                     $order->shipping_prices[$key]->all_with_tax -= $order->shipping_prices[$key]->all_with_tax * ($order->coupon->discount_percent_amount / 100);
                     $order->shipping_prices[$key]->all_without_tax -= $order->shipping_prices[$key]->all_without_tax * ($order->coupon->discount_percent_amount / 100);
                 }
             }
         }
         unset($real_products->products);
         unset($real_products);
     }
     return $key;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:shipping.php

示例4: onHikashopAfterDisplayView

 function onHikashopAfterDisplayView(&$view)
 {
     $option = JRequest::getString('option');
     $ctrl = JRequest::getString('ctrl');
     $task = JRequest::getString('task');
     if ($option != 'com_hikashop' || $ctrl != 'product' || $task != 'show') {
         return;
     }
     $config =& hikashop_config();
     $default_params = $config->get('default_params');
     $product_page = ob_get_clean();
     $product_page_parts = explode('class="hikashop_product_page ', $product_page);
     if (!empty($product_page_parts[1])) {
         $product_page_parts[1] = 'itemscope itemtype="http://schema.org/Product" class="hikashop_product_page ' . $product_page_parts[1];
         $pattern = '/id="hikashop_product_name_main"/';
         $replacement = 'id="hikashop_product_name_main" itemprop="name"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
         $pattern = '/id="hikashop_product_code_main"/';
         $replacement = 'id="hikashop_product_code_main" itemprop="sku"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
         if ($default_params['show_price'] == 1) {
             $currency_id = hikashop_getCurrency();
             $null = null;
             $currencyClass = hikashop_get('class.currency');
             $currencies = $currencyClass->getCurrencies($currency_id, $null);
             $data = $currencies[$currency_id];
             $pattern = '/<span id="hikashop_product_price_main" class="hikashop_product_price_main">/';
             $replacement = '<div itemprop="offers" itemscope itemtype="http://schema.org/Offer"><span id="hikashop_product_price_main" class="hikashop_product_price_main"><meta itemprop="priceCurrency" content="' . $data->currency_code . '" />';
             $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
             $pattern = '/<(span|div) id="(hikashop_product_weight_main|hikashop_product_width_main|hikashop_product_length_main|hikashop_product_height_main|hikashop_product_characteristics|hikashop_product_options|hikashop_product_custom_item_info|hikashop_product_price_with_options_main|hikashop_product_quantity_main)"/';
             $replacement = '</div> <$1 id="$2"';
             $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
             $pattern = '/class="hikashop_product_price_main"(.*)class="hikashop_product_price hikashop_product_price_0/msU';
             $replacement = 'class="hikashop_product_price_main" $1 itemprop="price" class="hikashop_product_price hikashop_product_price_0';
             $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
             $pattern = '/class="hikashop_product_price_per_unit"/';
             $replacement = 'class="hikashop_product_price_per_unit" itemprop="eligibleQuantity"';
             $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
         }
         $pattern = '/id="hikashop_product_vote_listing"/';
         $replacement = 'id="hikashop_product_vote_listing" itemscope itemtype="http://schema.org/Review"';
         if (strpos($product_page_parts[1], 'class="hika_comment_listing_empty"') == false) {
             $pattern = '/class="ui-corner-all hika_comment_listing"/';
             $replacement = 'class="ui-corner-all hika_comment_listing" itemprop="review" itemscope itemtype="http://schema.org/Review"';
             $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1]);
         }
         $pattern = '/class="hikashop_vote_listing_comment"/';
         $replacement = 'class="hikashop_vote_listing_comment" itemprop="description"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1]);
         $pattern = '/class="hika_comment_listing_content"/';
         $replacement = 'class="hika_comment_listing_content" itemprop="description"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1]);
         $pattern = '/class="hika_comment_listing_name"/';
         $replacement = 'class="hika_comment_listing_name" itemprop="author" itemscope itemtype="http://schema.org/Person"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1]);
         $pattern = '/class="hikashop_vote_listing_username"/';
         $replacement = 'class="hikashop_vote_listing_username" itemprop="name"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1]);
         $pattern = '/class="hika_vote_listing_username"/';
         $replacement = 'class="hika_vote_listing_username" itemprop="name"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1]);
         $pattern = '/class="hikashop_product_description_main"/';
         $replacement = 'class="hikashop_product_description_main" itemprop="description"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
         $pattern = '/class="hikashop_vote_stars"/';
         $replacement = 'class="hikashop_vote_stars" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
         $pattern = '/id="hikashop_main_image"/';
         $replacement = 'id="hikashop_main_image" itemprop="image"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1]);
         $pattern = '/class="hikashop_product_width_main"/';
         $replacement = 'class="hikashop_product_width_main" itemprop="width"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
         $pattern = '/class="hikashop_product_height_main"/';
         $replacement = 'class="hikashop_product_height_main" itemprop="height"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
         $pattern = '/class="hikashop_product_length_main"/';
         $replacement = 'class="hikashop_product_length_main" itemprop="length"';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
         $ratemax = JRequest::getVar("nb_max_star");
         //nbmax
         $pattern = '/(<span\\s+class="hikashop_total_vote")/iUs';
         preg_match('/<input type="hidden" class="hikashop_vote_rating".*data-rate="(.*)"/U', $product_page_parts[1], $matches);
         if (isset($matches[1])) {
             $replacement = '<span style="display:none" itemprop="ratingValue">' . $matches[1] . '</span><span style="display:none" itemprop="bestRating">' . $ratemax . '</span><span style="display:none" itemprop="worstRating">1</span>$1';
             $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
         }
         preg_match('/<span class="hikashop_total_vote">.*>(.*)</U', $product_page_parts[1], $matches);
         if (isset($matches[1])) {
             $replacement = '<span style="display:none" itemprop="reviewCount">' . trim($matches[1]) . '</span>$1';
             $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
         }
         $pattern = '/itemprop="keywords"/';
         $replacement = '';
         $product_page_parts[1] = preg_replace($pattern, $replacement, $product_page_parts[1], 1);
     }
     foreach ($product_page_parts as $parts) {
         echo $parts;
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:100,代码来源:hikashopproducttag.php

示例5: 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

示例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: onShippingDisplay

 function onShippingDisplay(&$order, &$dbrates, &$usable_rates, &$messages)
 {
     if (!hikashop_loadUser()) {
         return false;
     }
     $local_usable_rates = array();
     $local_messages = array();
     $ret = parent::onShippingDisplay($order, $dbrates, $local_usable_rates, $local_messages);
     if ($ret === false) {
         return false;
     }
     $currentShippingZone = null;
     $currentCurrencyId = null;
     $found = true;
     $usableWarehouses = array();
     $zoneClass = hikashop_get('class.zone');
     $zones = $zoneClass->getOrderZones($order);
     foreach ($local_usable_rates as $k => $rate) {
         if (!empty($rate->shipping_params->warehousesList)) {
             $rate->shipping_params->warehouses = unserialize($rate->shipping_params->warehousesList);
         } else {
             $messages['no_warehouse_configured'] = 'No warehouse configured in the CANPAR shipping plugin options';
             continue;
         }
         foreach ($rate->shipping_params->warehouses as $warehouse) {
             if (empty($warehouse->zone) || $warehouse->zone == '-' || in_array($warehouse->zone, $zones)) {
                 $usableWarehouses[] = $warehouse;
             }
         }
         if (empty($usableWarehouses)) {
             $messages['no_warehouse_configured'] = 'No available warehouse found for your location';
             continue;
         }
         if (!empty($rate->shipping_params->methodsList)) {
             $rate->shipping_params->methods = unserialize($rate->shipping_params->methodsList);
         } else {
             $messages['no_shipping_methods_configured'] = 'No shipping methods configured in the CANPAR shipping plugin options';
             continue;
         }
         if ($order->weight <= 0 || $order->volume <= 0) {
             return true;
         }
         $data = null;
         if (empty($order->shipping_address)) {
             $messages['no_shipping_address_found'] = 'No shipping address entered';
             continue;
         }
         $this->shipping_currency_id = hikashop_getCurrency();
         $db = JFactory::getDBO();
         $query = 'SELECT currency_code FROM ' . hikashop_table('currency') . ' WHERE currency_id IN (' . $this->shipping_currency_id . ')';
         $db->setQuery($query);
         $this->shipping_currency_code = $db->loadResult();
         $cart = hikashop_get('class.cart');
         $null = null;
         $cart->loadAddress($null, $order->shipping_address->address_id, 'object', 'shipping');
         $currency = hikashop_get('class.currency');
         $receivedMethods = $this->_getBestMethods($rate, $order, $usableWarehouses, $null);
         if (empty($receivedMethods)) {
             $messages['no_rates'] = JText::_('NO_SHIPPING_METHOD_FOUND');
             continue;
         }
         $i = 0;
         $local_usable_rates = array();
         foreach ($receivedMethods as $method) {
             $local_usable_rates[$i] = !HIKASHOP_PHP5 ? $rate : clone $rate;
             $local_usable_rates[$i]->shipping_price += $method['value'];
             $selected_method = '';
             $name = '';
             foreach ($this->canpar_methods as $canpar_method) {
                 if ($canpar_method['name'] == $method['name']) {
                     $name = $canpar_method['name'];
                     $selected_method = $canpar_method['key'];
                 }
             }
             $local_usable_rates[$i]->shipping_name = $name;
             if (!empty($selected_method)) {
                 $local_usable_rates[$i]->shipping_id .= '-' . $selected_method;
             }
             if ($method['deliveryDate'] != 'www.canpar.ca') {
                 if (is_numeric($method['deliveryDate'])) {
                     $timestamp = strtotime($method['deliveryDate']);
                     $time = parent::displayDelaySECtoDAY($timestamp - strtotime('now'), 2);
                     $local_usable_rates[$i]->shipping_description .= 'Estimated delivery date:  ' . $time;
                 } else {
                     $time = $method['deliveryDate'];
                     $local_usable_rates[$i]->shipping_description .= 'Estimated delivery date:  ' . $time;
                 }
             } else {
                 $local_usable_rates[$i]->shipping_description .= ' ' . JText::_('NO_ESTIMATED_TIME_AFTER_SEND');
             }
             if ($rate->shipping_params->group_package == 1 && $this->nbpackage > 1) {
                 $local_usable_rates[$i]->shipping_description .= '<br/>' . JText::sprintf('X_PACKAGES', $this->nbpackage);
             }
             $i++;
         }
         foreach ($local_usable_rates as $i => $rate) {
             $usable_rates[$rate->shipping_id] = $rate;
         }
     }
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:100,代码来源:canpar.php

示例8: array

 function &getPayments(&$order, $reset = false)
 {
     static $usable_methods = null;
     static $errors = array();
     if ($reset) {
         $usable_methods = null;
         $errors = array();
     }
     if (!is_null($usable_methods)) {
         $this->errors = $errors;
         return $usable_methods;
     }
     JPluginHelper::importPlugin('hikashoppayment');
     $dispatcher = JDispatcher::getInstance();
     $max = 0;
     $payment = '';
     if (!empty($order->payment->payment_type) && !empty($order->payment->payment_id)) {
         $payment = $order->payment->payment_type . '_' . $order->payment->payment_id;
     }
     $currency = @$order->total->prices[0]->price_currency_id;
     if (empty($currency)) {
         $currency = hikashop_getCurrency();
     }
     $methods = $this->getMethods($order, $currency);
     if (empty($methods)) {
         $errors[] = JText::_('CONFIGURE_YOUR_PAYMENT_METHODS');
         $this->errors = $errors;
         $usable_methods = false;
         return $usable_methods;
     }
     $already = array();
     $price_all = @$order->full_total->prices[0]->price_value_with_tax;
     if (isset($order->full_total->prices[0]->price_value_without_payment_with_tax)) {
         $price_all = $order->full_total->prices[0]->price_value_without_payment_with_tax;
     }
     $zoneClass = hikashop_get('class.zone');
     $zones = $zoneClass->getOrderZones($order);
     foreach ($methods as $k => $method) {
         if (!empty($method->payment_zone_namekey) && !in_array($method->payment_zone_namekey, $zones)) {
             unset($methods[$k]);
             continue;
         }
         if (!empty($method->payment_params->payment_zip_prefix) || !empty($method->payment_params->payment_min_zip) || !empty($method->payment_params->payment_max_zip) || !empty($method->payment_params->payment_zip_suffix)) {
             $checkDone = false;
             if (!empty($order->shipping_address) && !empty($order->shipping_address->address_post_code)) {
                 if (preg_match('#([a-z]*)([0-9]+)(.*)#i', preg_replace('#[^a-z0-9]#i', '', $order->shipping_address->address_post_code), $match)) {
                     $checkDone = true;
                     $prefix = $match[1];
                     $main = $match[2];
                     $suffix = $match[3];
                     if (!empty($method->payment_params->payment_zip_prefix) && $method->payment_params->payment_zip_prefix != $prefix) {
                         unset($methods[$k]);
                         continue;
                     }
                     if (!empty($method->payment_params->payment_min_zip) && $method->payment_params->payment_min_zip > $main) {
                         unset($methods[$k]);
                         continue;
                     }
                     if (!empty($method->payment_params->payment_max_zip) && $method->payment_params->payment_max_zip < $main) {
                         unset($methods[$k]);
                         continue;
                     }
                     if (!empty($method->payment_params->payment_zip_suffix) && $method->payment_params->payment_zip_suffix != $suffix) {
                         unset($methods[$k]);
                         continue;
                     }
                 }
             }
             if (!$checkDone) {
                 unset($methods[$k]);
                 continue;
             }
         }
         $currencyClass = hikashop_get('class.currency');
         $methods[$k]->payment_price = $currencyClass->round($price_all * (double) @$method->payment_params->payment_percentage / 100 + @$method->payment_price, $currencyClass->getRounding($currency, true));
         $methods[$k]->ordering = $method->payment_ordering;
         if (!empty($method->ordering) && $max < $method->ordering) {
             $max = $method->ordering;
         }
     }
     foreach ($methods as $k => $method) {
         if (empty($method->ordering)) {
             $max++;
             $methods[$k]->ordering = $max;
         }
         while (isset($already[$methods[$k]->ordering])) {
             $max++;
             $methods[$k]->ordering = $max;
         }
         $already[$methods[$k]->ordering] = true;
     }
     $cartClass = hikashop_get('class.cart');
     $paymentRecurringType = $cartClass->checkSubscription($order);
     $order->paymentOptions = array('recurring' => $paymentRecurringType == 'recurring', 'term' => false, 'recurring' => false);
     $this->checkPaymentOptions($order);
     $usable_methods = array();
     $dispatcher->trigger('onPaymentDisplay', array(&$order, &$methods, &$usable_methods));
     if (is_array($usable_methods) && !empty($usable_methods)) {
         foreach ($usable_methods as $k => $usable_method) {
             if ($paymentRecurringType == 'noRecurring' && (!empty($usable_method->features['recurring']) || isset($usable_method->recurring) && $usable_method->recurring == 1)) {
//.........这里部分代码省略.........
开发者ID:rodhoff,项目名称:MNW,代码行数:101,代码来源:payment.php

示例9: listing

 function listing()
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $config =& hikashop_config();
     $this->assignRef('config', $config);
     $toggle = hikashop_get('helper.toggle');
     $this->assignRef('toggleClass', $toggle);
     $manage = hikashop_isAllowed($config->get('acl_user_manage', 'all'));
     $this->assignRef('manage', $manage);
     hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $cfg = array('table' => 'user', 'main_key' => 'user_id', 'order_sql_value' => 'huser.user_id', 'order_sql_accept' => array('huser.', 'juser.'));
     $searchMap = array('huser.user_id', 'huser.user_email', 'juser.username', 'juser.email', 'juser.name');
     $pageInfo = $this->getPageInfo($cfg['order_sql_value']);
     $pageInfo->filter->filter_partner = $app->getUserStateFromRequest($this->paramBase . '.filter_partner', 'filter_partner', '', 'int');
     $filters = array();
     $order = '';
     if (!empty($pageInfo->filter->filter_partner)) {
         if ($pageInfo->filter->filter_partner == 1) {
             $filters[] = 'huser.user_partner_activated = 1';
             $db->setQuery('DROP TABLE IF EXISTS ' . hikashop_table('click_view') . ', ' . hikashop_table('sale_view') . ', ' . hikashop_table('lead_view'));
             $db->query();
             $query = 'CREATE OR REPLACE VIEW ' . hikashop_table('click_view') . ' AS SELECT a.user_id, SUM(b.click_partner_price) AS click_price FROM ' . hikashop_table('user') . ' AS a LEFT JOIN ' . hikashop_table('click') . ' AS b ON a.user_id=b.click_partner_id AND (CASE WHEN a.user_currency_id=0 THEN ' . hikashop_getCurrency() . ' ELSE a.user_currency_id END)=b.click_partner_currency_id WHERE a.user_partner_activated=1 AND b.click_partner_paid=0 GROUP BY b.click_partner_id;';
             $db->setQuery($query);
             $db->query();
             $partner_valid_status_list = explode(',', $config->get('partner_valid_status', 'confirmed,shipped'));
             foreach ($partner_valid_status_list as $k => $partner_valid_status) {
                 $partner_valid_status_list[$k] = $db->Quote($partner_valid_status);
             }
             $query = 'CREATE OR REPLACE VIEW ' . hikashop_table('sale_view') . ' AS SELECT a.user_id, SUM(b.order_partner_price) AS sale_price FROM ' . hikashop_table('user') . ' AS a LEFT JOIN ' . hikashop_table('order') . ' AS b ON a.user_id=b.order_partner_id AND (CASE WHEN a.user_currency_id=0 THEN ' . hikashop_getCurrency() . ' ELSE a.user_currency_id END)=b.order_partner_currency_id WHERE a.user_partner_activated=1 AND b.order_partner_paid=0 AND b.order_type=\'sale\' AND b.order_status IN (' . implode(',', $partner_valid_status_list) . ') GROUP BY b.order_partner_id;';
             $db->setQuery($query);
             $db->query();
             $query = 'CREATE OR REPLACE VIEW ' . hikashop_table('lead_view') . ' AS SELECT a.user_id, SUM(b.user_partner_price) AS lead_price FROM ' . hikashop_table('user') . ' AS a LEFT JOIN ' . hikashop_table('user') . ' AS b ON a.user_id=b.user_partner_id AND (CASE WHEN a.user_currency_id=0 THEN ' . hikashop_getCurrency() . ' ELSE a.user_currency_id END)=b.user_partner_currency_id WHERE a.user_partner_activated=1 AND b.user_partner_paid=0 GROUP BY b.user_partner_id;';
             $db->setQuery($query);
             $db->query();
             $db->setQuery('UPDATE ' . hikashop_table('user') . ' SET user_unpaid_amount=0');
             $db->query();
             $query = 'UPDATE ' . hikashop_table('user') . ' AS a JOIN ' . hikashop_table('click_view') . ' AS b ON a.user_id=b.user_id SET a.user_unpaid_amount=b.click_price WHERE a.user_partner_activated=1';
             $db->setQuery($query);
             $db->query();
             $query = 'UPDATE ' . hikashop_table('user') . ' AS a JOIN ' . hikashop_table('sale_view') . ' AS b ON a.user_id=b.user_id SET a.user_unpaid_amount=a.user_unpaid_amount+b.sale_price WHERE a.user_partner_activated=1';
             $db->setQuery($query);
             $db->query();
             $query = 'UPDATE ' . hikashop_table('user') . ' AS a JOIN ' . hikashop_table('lead_view') . ' AS b ON a.user_id=b.user_id SET a.user_unpaid_amount=a.user_unpaid_amount+b.lead_price WHERE a.user_partner_activated=1';
             $db->setQuery($query);
             $db->query();
             $db->setQuery('DROP VIEW IF EXISTS ' . hikashop_table('click_view') . ', ' . hikashop_table('sale_view') . ', ' . hikashop_table('lead_view'));
             $db->query();
             $currencyClass = hikashop_get('class.currency');
             $this->assignRef('currencyHelper', $currencyClass);
         } else {
             $filters[] = 'huser.user_partner_activated=0';
         }
     }
     $fieldsClass = hikashop_get('class.field');
     $this->assignRef('fieldsClass', $fieldsClass);
     $fields = $fieldsClass->getData('backend_listing', 'user', false);
     $this->assignRef('fields', $fields);
     foreach ($fields as $field) {
         $searchMap[] = 'huser.' . $field->field_namekey;
     }
     $this->processFilters($filters, $order, $searchMap, $cfg['order_sql_accept']);
     $query = ' FROM ' . hikashop_table($cfg['table']) . ' AS huser LEFT JOIN ' . hikashop_table('users', false) . ' AS juser ON huser.user_cms_id = juser.id ' . $filters . $order;
     $db->setQuery('SELECT huser.*, juser.* ' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value);
     $rows = $db->loadObjectList();
     $fieldsClass->handleZoneListing($fields, $rows);
     foreach ($rows as $k => $row) {
         if (!empty($row->user_params)) {
             $rows[$k]->user_params = unserialize($row->user_params);
         }
     }
     if (!empty($pageInfo->search)) {
         $rows = hikashop_search($pageInfo->search, $rows, $cfg['main_key']);
     }
     $this->assignRef('rows', $rows);
     $db->setQuery('SELECT COUNT(*) ' . $query);
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = $db->loadResult();
     $pageInfo->elements->page = count($rows);
     $this->getPagination();
     $this->getOrdering('huser.user_id', true);
     $partner = hikashop_get('type.user_partner');
     $this->assignRef('partner', $partner);
     $affiliate_plugin = JPluginHelper::getPlugin('system', 'hikashopaffiliate');
     $affiliate_active = !empty($affiliate_plugin);
     $this->assignRef('affiliate_active', $affiliate_active);
     if ($pageInfo->filter->filter_partner == 1) {
         $acl = 'acl_affiliates_delete';
     } else {
         $acl = 'acl_user_delete';
     }
     $this->toolbar = array(array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'check' => JText::_('HIKA_VALIDDELETEITEMS'), 'display' => hikashop_isAllowed($config->get($acl, 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
     return true;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:94,代码来源:view.html.php

示例10: generateCoupon

    function generateCoupon(&$allresults, $i, &$user)
    {
        list($minimum_order, $quota, $start, $end, $percent_amount, $flat_amount, $currency_id, $code, $product_id) = explode('|', $allresults[1][$i]);
        jimport('joomla.user.helper');
        $key = JUserHelper::genrandompassword(5);
        if (!hikashop_level(1)) {
            $minimum_order = 0;
            $quota = '';
            $product_id = '';
        }
        if ($percent_amount > 0) {
            $value = $percent_amount;
        } else {
            $value = $flat_amount;
        }
        $value = str_replace(',', '.', $value);
        if ($start) {
            $start = hikashop_getTime($start);
        }
        if ($end) {
            $end = hikashop_getTime($end);
        }
        $clean_name = strtoupper($user->name);
        $space = strpos($clean_name, ' ');
        if (!empty($space)) {
            $clean_name = substr($clean_name, 0, $space);
        }
        $code = str_replace(array('[name]', '[clean_name]', '[subid]', '[email]', '[key]', '[flat]', '[percent]', '[value]', '[prodid]'), array($user->name, $clean_name, $user->subid, $user->email, $key, $flat_amount, $percent_amount, $value, $product_id), $code);
        $this->db->setQuery('INSERT IGNORE INTO ' . acymailing_table('hikashop_discount', false) . '(
		`discount_code`,
		`discount_percent_amount`,
		`discount_flat_amount`,
		`discount_type`,
		`discount_start`,
		`discount_end`,
		`discount_minimum_order`,
		`discount_quota`,
		`discount_currency_id`,
		`discount_product_id`,
		`discount_published`
		) VALUES (' . $this->db->Quote($code) . ',' . $this->db->Quote($percent_amount) . ',' . $this->db->Quote($flat_amount) . ',\'coupon\',' . $this->db->Quote($start) . ',' . $this->db->Quote($end) . ',' . $this->db->Quote($minimum_order) . ',' . $this->db->Quote($quota) . ',' . $this->db->Quote(hikashop_getCurrency()) . ',' . $this->db->Quote($product_id) . ',
		1)');
        $this->db->query();
        return $code;
    }
开发者ID:q0821,项目名称:esportshop,代码行数:45,代码来源:hikashop.php

示例11: _readPayment

 function _readPayment()
 {
     $payment = JRequest::getString('hikashop_payment', '');
     if (empty($payment)) {
         return false;
     }
     $payment = explode('_', $payment);
     if (count($payment) > 1) {
         $payment_id = array_pop($payment);
         $payment = implode('_', $payment);
         if (empty($payment)) {
             return false;
         }
         $cart = $this->initCart();
         $pluginsClass = hikashop_get('class.plugins');
         $rates = $pluginsClass->getMethods('payment');
         $data = hikashop_import('hikashoppayment', $payment);
         $paymentData = $data->onPaymentSave($cart, $rates, $payment_id);
         if ($paymentData === false) {
             return false;
         }
         $app = JFactory::getApplication();
         $old_payment_method = $app->getUserState(HIKASHOP_COMPONENT . '.payment_method');
         $old_payment_data = $app->getUserState(HIKASHOP_COMPONENT . '.payment_data');
         $old_payment_id = $app->getUserState(HIKASHOP_COMPONENT . '.payment_id');
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_method', $payment);
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_id', $payment_id);
         $price_all = @$cart->full_total->prices[0]->price_value_with_tax;
         if (isset($cart->full_total->prices[0]->price_value_without_payment_with_tax)) {
             $price_all = @$cart->full_total->prices[0]->price_value_without_payment_with_tax;
         }
         $currencyClass = hikashop_get('class.currency');
         $currencyClass->convertPayments($rates);
         $paymentClass = hikashop_get('class.payment');
         $paymentClass->computePrice($cart, $paymentData, $price_all, $paymentData->payment_price, hikashop_getCurrency());
         $cart->full_total->prices[0]->payment_tax = @$paymentData->payment_tax;
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_data', $paymentData);
         if (!empty($paymentData->ask_cc)) {
             $paymentClass = hikashop_get('class.payment');
             if (!$paymentClass->readCC()) {
                 return false;
             }
         }
         if ($old_payment_id != $payment_id || $old_payment_method != $payment || @$old_payment_data->payment_price != $paymentData->payment_price && ($this->_getStep('cart', (int) $this->previous) === (int) $this->previous || $this->_getStep('confirm', (int) $this->previous) === (int) $this->previous)) {
             return false;
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:51,代码来源:checkout.php

示例12: onAfterRender


//.........这里部分代码省略.........
             foreach ($options as $option) {
                 if ($product->product_id == $option->product_id) {
                     $products[$k]->has_options = true;
                     break;
                 }
             }
         }
     }
     foreach ($products as $k => $product) {
         $this->classbadge->loadBadges($products[$k]);
     }
     $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();
     $productClass = hikashop_get('class.product');
     foreach ($products as $k => $row) {
         $productClass->addAlias($products[$k]);
         foreach ($images as $j => $image) {
             if ($row->product_id != $image->file_ref_id) {
                 continue;
             }
             foreach (get_object_vars($image) as $key => $name) {
                 if (!isset($products[$k]->images)) {
                     $products[$k]->images = array();
                 }
                 if (!isset($products[$k]->images[$j])) {
                     $products[$k]->images[$j] = new stdClass();
                 }
                 $products[$k]->images[$j]->{$key} = $name;
             }
         }
     }
     $zone_id = hikashop_getZone();
     $currencyClass = hikashop_get('class.currency');
     $config = hikashop_config();
     $defaultParams = $config->get('default_params');
     $currencyClass->getListingPrices($products, $zone_id, hikashop_getCurrency(), $defaultParams['price_display_type']);
     $fields = array('name' => 'name', 'pricedis1' => 'pricedis', 'pricedis2' => array('pricedis', 2), 'pricedis3' => array('pricedis', 3), 'pricetax1' => 'pricetax', 'pricetax2' => array('pricetax', 2), 'price' => 'price', 'cart' => 'cart', 'quantityfield' => 'quantityfield', 'description' => 'description', 'picture' => 'picture', 'link' => 'link', 'border' => 'border', 'badge' => 'badge');
     for ($i = 0; $i < $nbtag; $i++) {
         $nbprodtag = count($para[$i]);
         foreach ($fields as $k => $v) {
             if (is_string($v)) {
                 $this->{$v} = 0;
             }
             if (in_array($k, $para[$i])) {
                 if (is_array($v)) {
                     $this->{$v[0]} = $v[1];
                 } else {
                     $this->{$v} = 1;
                 }
                 $nbprodtag--;
             }
         }
         $this->menuid = 0;
         foreach ($para[$i] as $key => $value) {
             if (substr($value, 0, 6) == "menuid") {
                 $explode = explode(':', $value);
                 $this->menuid = $explode[1];
             }
         }
         $id = array();
         for ($j = 0; $j < $nbprodtag; $j++) {
             $id[$j] = $para[$i][$j];
         }
         $name = 'hikashopproductinsert_view.php';
         $path = JPATH_THEMES . DS . $app->getTemplate() . DS . 'system' . DS . $name;
         if (!file_exists($path)) {
             if (version_compare(JVERSION, '1.6', '<')) {
                 $path = JPATH_PLUGINS . DS . 'system' . DS . $name;
             } else {
                 $path = JPATH_PLUGINS . DS . 'system' . DS . 'hikashopproductinsert' . DS . $name;
             }
             if (!file_exists($path)) {
                 return true;
             }
         }
         ob_start();
         require $path;
         $product_view = ob_get_clean();
         $pattern = '#\\{product\\}(.*)\\{\\/product\\}#Uis';
         $replacement = '';
         $body = JResponse::getBody();
         $alternate_body = false;
         if (empty($body)) {
             $body = $app->getBody();
             $alternate_body = true;
         }
         $search_space = substr($body, strpos($body, '<body'));
         $new_search_space = preg_replace($pattern, str_replace('$', '\\$', $product_view), $search_space, 1);
         $pattern = '#\\{product (.*)\\}#Uis';
         $replacement = '';
         $new_search_space = preg_replace($pattern, str_replace('$', '\\$', $product_view), $new_search_space, 1);
         $body = str_replace($search_space, $new_search_space, $body);
         if ($alternate_body) {
             $app->setBody($body);
         } else {
             JResponse::setBody($body);
         }
     }
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:101,代码来源:hikashopproductinsert.php

示例13: onCheckoutStepDisplay

 function onCheckoutStepDisplay($layoutName, &$html, &$view)
 {
     if ($layoutName != 'plg.shop.userpoints') {
         return;
     }
     $this->_readOptions();
     if (empty($this->plugin_options['checkout_step'])) {
         return;
     }
     switch ($this->plugin_options['show_points']) {
         case 'aup':
             $points = $this->getUserPoints(null, 'aup');
             break;
         case 'hk':
         default:
             $points = $this->getUserPoints(null, 'hk');
             break;
     }
     if ($points === false) {
         return;
     }
     if (!empty($this->plugin_options['hide_when_no_points']) && empty($points)) {
         return;
     }
     $app = JFactory::getApplication();
     $currencyClass = hikashop_get('class.currency');
     $consume = null;
     $discount = '';
     $earn_points = false;
     $use_coupon = 1 - (int) $app->getUserState(HIKASHOP_COMPONENT . '.userpoints_no_virtual_coupon', (int) (@$this->plugin_options['checkout_step'] && @$this->plugin_options['default_no_use']));
     $paymentUserPoints = hikashop_import('hikashoppayment', 'userpoints');
     if (!empty($paymentUserPoints)) {
         $cart = $view->initCart();
         $consume = $paymentUserPoints->getCartUsedPoints($cart);
         if (!empty($consume) && $consume['mode'] != $this->plugin_options['show_points']) {
             $consume = null;
         }
         if (!empty($this->plugin_options['show_earn_points'])) {
             $earn_points = 0;
             $this->onGetUserPointsEarned($cart, $earn_points, $this->plugin_options['show_points']);
         }
         if (!empty($consume)) {
             if (isset($cart->order_currency_id)) {
                 $currency_id = $cart->order_currency_id;
             } else {
                 $currency_id = hikashop_getCurrency();
             }
             $discount = $currencyClass->format($consume['value'], $currency_id);
         }
     }
     $app = JFactory::getApplication();
     $path = JPATH_THEMES . DS . $app->getTemplate() . DS . 'plg_hikashop_userpoints' . DS . 'checkout.php';
     if (!file_exists($path)) {
         if (version_compare(JVERSION, '1.6', '<')) {
             $path = JPATH_PLUGINS . DS . 'hikashop' . DS . 'userpoints_checkout.php';
         } else {
             $path = JPATH_PLUGINS . DS . 'hikashop' . DS . 'userpoints' . DS . 'userpoints_checkout.php';
         }
     }
     if (!file_exists($path)) {
         return false;
     }
     require $path;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:64,代码来源:userpoints.php

示例14: showcarts


//.........这里部分代码省略.........
         $user->session = '';
     }
     if (hikashop_loadUser() == null) {
         $filters = array('a.session_id=' . $database->Quote($user->session) . ' AND a.cart_type =' . $database->quote($cart_type));
     } else {
         $filters = array('(a.user_id=' . (int) $user->id . ' OR a.session_id=' . $database->Quote($user->session) . ') AND a.cart_type =' . $database->quote($cart_type));
     }
     $groupBy = 'GROUP BY a.cart_id';
     $order = '';
     if (!empty($pageInfo->filter->order->value)) {
         $order = 'ORDER BY a.cart_id ASC';
     }
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\'';
         $filter = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
         $filters[] = $filter;
     }
     $from = 'FROM ' . hikashop_table('cart') . ' AS a';
     $cartProduct = 'LEFT JOIN ' . hikashop_table('cart_product') . ' AS b ON a.cart_id=b.cart_id';
     $where = 'WHERE (' . implode(') AND (', $filters) . ') AND a.cart_type =' . $database->quote($cart_type);
     $query = $from . ' ' . $where . ' ' . $groupBy . ' ' . $order;
     //'.$cartProduct.'
     $database->setQuery('SELECT a.* ' . $query);
     $rows = $database->loadObjectList();
     $database->setQuery('SELECT COUNT(*) ' . $from . ' ' . $where);
     $currencyClass = hikashop_get('class.currency');
     $this->assignRef('currencyHelper', $currencyClass);
     $module = hikashop_get('helper.module');
     $module->initialize($this);
     $currencyClass = hikashop_get('class.currency');
     $class = hikashop_get('class.cart');
     $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);
     $cids = array();
     foreach ($rows as $row) {
         if ($row->cart_id != null) {
             $cids[] = $row->cart_id;
         }
     }
     $filters = '';
     $filters = array('a.cart_id IN(' . implode(",", $cids) . ')');
     $order = '';
     if (!empty($pageInfo->filter->order->value)) {
         $order = ' ORDER BY cart_id ASC';
     }
     $product = ' LEFT JOIN ' . hikashop_table('product') . ' AS b ON a.product_id=b.product_id';
     $query = 'FROM ' . hikashop_table('cart_product') . ' AS a ' . $product . ' WHERE (' . implode(') AND (', $filters) . ') ' . $order;
     $database->setQuery('SELECT a.*,b.* ' . $query);
     if (!empty($cids)) {
         $products = $database->loadObjectList();
         $ids = array();
         foreach ($products as $row) {
             $ids[] = $row->product_id;
         }
         $row_1 = 0;
         foreach ($products as $k => $row) {
             $currencyClass->getPrices($row, $ids, $currency_id, $main_currency, $zone_id, $discount_before_tax);
             if (!isset($row->prices[0]->price_value)) {
                 if (isset($row_1->prices[0])) {
开发者ID:q0821,项目名称:esportshop,代码行数:67,代码来源:view.html.php

示例15: onShippingDisplay

 /**
  *
  */
 function onShippingDisplay(&$order, &$dbrates, &$usable_rates, &$messages)
 {
     if (!hikashop_loadUser()) {
         return false;
     }
     if (empty($order->shipping_address)) {
         return true;
     }
     if ($this->loadShippingCache($order, $usable_rates, $messages)) {
         return true;
     }
     $local_usable_rates = array();
     $local_messages = array();
     $ret = parent::onShippingDisplay($order, $dbrates, $local_usable_rates, $local_messages);
     if ($ret === false) {
         return false;
     }
     $currentShippingZone = null;
     $currentCurrencyId = null;
     $cache_usable_rates = array();
     $cache_messages = array();
     $found = true;
     $usableWarehouses = array();
     $zoneClass = hikashop_get('class.zone');
     $zones = $zoneClass->getOrderZones($order);
     if (!function_exists('curl_init')) {
         $app = JFactory::getApplication();
         $app->enqueueMessage('The Envoimoinscher shipping plugin needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.', 'error');
         return false;
     }
     $app = JFactory::getApplication();
     $order_clone = new stdClass();
     $variables = array('products', 'cart_id', 'coupon', 'shipping_address', 'volume', 'weight', 'volume_unit', 'weight_unit');
     foreach ($variables as $var) {
         if (isset($order->{$var})) {
             $order_clone->{$var} = $order->{$var};
         }
     }
     $shipping_key = sha1(serialize($order_clone) . serialize($local_usable_rates));
     $result = $app->getUserState(HIKASHOP_COMPONENT . '.shipping.envoimoinscher_result', $this->result);
     // when cache doesn't work we generate a key in order not to redo everything at each step
     if (isset($result['shipping_key']) && $result['shipping_key'] == $shipping_key) {
         return;
     }
     if (empty($order->shipping_address)) {
         return true;
     }
     foreach ($local_usable_rates as $k => $rate) {
         if (!empty($rate->shipping_params->methodsList)) {
             $rate->shipping_params->methods = unserialize($rate->shipping_params->methodsList);
         } else {
             $cache_messages['no_shipping_methods_configured'] = 'No shipping methods selected in the Envoimoinscher shipping plugin options';
             continue;
         }
         if ($order->weight <= 0 || $order->volume <= 0 && @$rate->shipping_params->exclude_dimensions != 1) {
             continue;
         }
         $currencyClass = hikashop_get('class.currency');
         $this->shipping_currency_id = hikashop_getCurrency();
         $currency = $currencyClass->get($this->shipping_currency_id);
         $this->shipping_currency_code = $currency->currency_code;
         $cart = hikashop_get('class.cart');
         $null = null;
         $cart->loadAddress($null, $order->shipping_address->address_id, 'object', 'shipping');
         $sending_type = strtolower($rate->shipping_params->sending_type);
         // Get all data for send requests to envoimoinscher
         $this->getData($null, $rate, $order, $sending_type, false);
         if (empty($this->result)) {
             $cache_messages['no_rates'] = JText::_('NO_SHIPPING_METHOD_FOUND');
             continue;
         }
         $new_usable_rates = array();
         foreach ($this->result as $key => $method) {
             if ($key === "shipping_key") {
                 continue;
             }
             $o = !HIKASHOP_PHP5 ? $rate : clone $rate;
             $o->shipping_price = $method["Prix"];
             $selected_method = '';
             $name = '';
             $selected_method = $method['Transporteur'];
             $name = $method['Service'];
             $o->shipping_name = $selected_method . " / " . $name;
             if (!empty($selected_method)) {
                 $o->shipping_id .= '-' . $selected_method . " / " . $name;
             }
             $new_usable_rates[] = $o;
         }
         foreach ($new_usable_rates as $i => $rate) {
             $usable_rates[$rate->shipping_id] = $rate;
             $cache_usable_rates[$rate->shipping_id] = $rate;
         }
         $this->result = array();
     }
     $this->setShippingCache($order, $cache_usable_rates, $cache_messages);
     if (!empty($cache_messages)) {
         foreach ($cache_messages as $k => $msg) {
//.........这里部分代码省略.........
开发者ID:HikaShop,项目名称:hikashop-envoimoinscher,代码行数:101,代码来源:envoimoinscher.php


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