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


PHP hikashop_loadUser函数代码示例

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


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

示例1: auth

 public function auth($data)
 {
     if (empty($data['username']) || empty($data['password'])) {
         $this->setHeaders(array('error' => 500));
         return false;
     }
     $options = array('remember' => false, 'return' => false);
     $credentials = array('username' => $data['username'], 'password' => $data['password']);
     $app = JFactory::getApplication();
     $error = $app->login($credentials, $options);
     $user = JFactory::getUser();
     if (JError::isError($error)) {
         $this->setHeaders(array('error' => $error));
         return false;
     }
     if ($user->guest) {
         $this->setHeaders(array('error' => 401));
         return false;
     }
     $hkUser = hikashop_loadUser(true);
     $api_salt = $this->getSalt();
     $timestamp = time();
     $timestamp -= $timestamp % 60;
     $token_frame = (int) $this->plugin_params->get('token_frame', 15);
     if ($token_frame < 2) {
         $token_frame = 2;
     }
     $timestamp -= $timestamp % ($token_frame * 60);
     return array('user' => $hkUser->user_email, 'token' => sha1((int) $hkUser->user_id . '#' . (int) $hkUser->user_cms_id . '#' . (int) $hkUser->user_created . '#' . date('dmY:Hi', $timestamp) . '#' . $api_salt));
 }
开发者ID:q0821,项目名称:esportshop,代码行数:30,代码来源:api.php

示例2: onPaymentDisplay

 function onPaymentDisplay(&$order, &$methods, &$usable_methods)
 {
     if (!$this->isShippingValid(@$order->shipping)) {
         return true;
     }
     $this->user = hikashop_loadUser(true);
     return parent::onPaymentDisplay($order, $methods, $usable_methods);
 }
开发者ID:q0821,项目名称:esportshop,代码行数:8,代码来源:bf_rbsbusinessgateway.php

示例3: onAfterOrderConfirm

 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     $method =& $methods[$method_id];
     $tax_total = '';
     $discount_total = '';
     $currencyClass = hikashop_get('class.currency');
     $currencies = null;
     $currencies = $currencyClass->getCurrencies($order->order_currency_id, $currencies);
     $currency = $currencies[$order->order_currency_id];
     $user = hikashop_loadUser(true);
     $app = JFactory::getApplication();
     $cart = hikashop_get('class.cart');
     if (!HIKASHOP_J30) {
         JHTML::_('behavior.mootools');
     } else {
         JHTML::_('behavior.framework');
     }
     $app =& JFactory::getApplication();
     $name = $method->payment_type . '_end.php';
     $path = JPATH_THEMES . DS . $app->getTemplate() . DS . 'hikashoppayment' . DS . $name;
     if (!file_exists($path)) {
         if (version_compare(JVERSION, '1.6', '<')) {
             $path = JPATH_PLUGINS . DS . 'hikashoppayment' . DS . $name;
         } else {
             $path = JPATH_PLUGINS . DS . 'hikashoppayment' . DS . $method->payment_type . DS . $name;
         }
         if (!file_exists($path)) {
             return true;
         }
     }
     //cargo las variables que necesito para CECA
     $vars["Num_operacion"] = $order->order_id;
     $vars["Importe"] = round($order->cart->full_total->prices[0]->price_value_with_tax, (int) $currency->currency_locale['int_frac_digits']) * 100;
     $vars["MerchantID"] = $method->payment_params->merchant_id;
     $vars["AcquirerBIN"] = $method->payment_params->acquirer_bin;
     $vars["TerminalID"] = $method->payment_params->terminal_id;
     $vars["ClaveEncryp"] = $method->payment_params->clave_encryp;
     $lang = JFactory::getLanguage();
     $locale = strtoupper(substr($lang->get('tag'), 0, 2));
     if (!in_array($locale, array('EN', 'DE', 'ES', 'FR', 'IT', 'NL', 'PT'))) {
         $locale = 'ES';
     }
     $vars["Idioma"] = $locale;
     global $Itemid;
     $vars["URL_OK"] = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=ceca&done=ok&order_id=' . $order->order_id . '&lang=' . strtolower($locale) . '&Itemid=' . $Itemid;
     $vars["URL_NOK"] = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=ceca&done=nok&order_id=' . $order->order_id . '&lang=' . strtolower($locale) . '&Itemid=' . $Itemid;
     require $path;
     $this->removeCart = true;
     return true;
 }
开发者ID:HikaShop,项目名称:hikashoppayment-ceca,代码行数:50,代码来源:ceca.php

示例4: save

 function save()
 {
     $voteClass = hikashop_get('class.vote');
     if (!count($_POST)) {
         $app = JFactory::getApplication();
         $app->redirect(preg_replace('#ctrl=vote&task=save&[0-9a-z=]+#', '', preg_replace('#/vote/save/[0-9a-z-]+#', '', hikashop_currentURL())), '', 'message', true);
     }
     $hikashop_vote_type = JRequest::getVar('hikashop_vote_type', 'update', 'default', 'string', 0);
     $element = new stdClass();
     $element->vote_type = JRequest::getVar('vote_type', '', 'default', 'string', 0);
     if ($hikashop_vote_type == 'useful') {
         $element->vote_id = JRequest::getVar('hikashop_vote_id', 0, 'default', 'int');
         $element->value = JRequest::getVar('value', 0, 'default', 'int');
         $voteClass->saveUseful($element);
     } else {
         $element->vote_ref_id = JRequest::getVar('hikashop_vote_ref_id', 0, 'default', 'int');
         if (empty($element->vote_ref_id) || $element->vote_ref_id == '0') {
             $element->vote_ref_id = JRequest::getVar('hikashop_vote_product_id', 0, 'default', 'int');
         }
         $element->vote_user_id = JRequest::getVar('hikashop_vote_user_id', 0, 'default', 'int');
         if ($element->vote_user_id == '0') {
             $element->vote_user_id = hikashop_loadUser();
         }
         $element->vote_pseudo = JRequest::getVar('pseudo_comment', 0, 'default', 'string', 0);
         $element->vote_email = JRequest::getVar('email_comment', 0, 'default', 'string', 0);
         $element->vote_type = JRequest::getVar('vote_type', '', 'default', 'string', 0);
         $element->vote_rating = JRequest::getVar('hikashop_vote', 0, 'default', 'int');
         $element->vote_comment = JRequest::getVar('hikashop_vote_comment', '', '', 'string', JREQUEST_ALLOWRAW);
         // JRequest::getVar('hikashop_vote_comment', 0, 'default', 'string', 0);
         $element->vote_comment = urldecode($element->vote_comment);
         $voteClass->save($element);
     }
     $return = array();
     if (!isset($voteClass->error) || empty($voteClass->error['code'])) {
         $return['error'] = array('code' => '500001', 'message' => JText::_('VOTE_ERROR'));
     } elseif ((int) $voteClass->error['code'] > 500000) {
         $return['error'] = array('code' => $voteClass->error['code'], 'message' => $voteClass->error['message']);
     } else {
         $return['success'] = array('code' => $voteClass->error['code'], 'message' => $voteClass->error['message']);
         if (!empty($voteClass->values)) {
             $return['values'] = array('average' => round($voteClass->values['average'], 2), 'rounded' => round($voteClass->values['average']), 'total' => $voteClass->values['total']);
             $return['tooltip'] = JText::sprintf('HIKA_VOTE_TOOLTIP', round($voteClass->values['average'], 2), $voteClass->values['total'], $element->vote_rating);
         }
     }
     ob_get_clean();
     echo json_encode($return);
     exit;
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:48,代码来源:vote.php

示例5: test

 function test()
 {
     $this->store();
     $config =& hikashop_config();
     $user = hikashop_loadUser(true);
     $mailClass = hikashop_get('class.mail');
     $addedName = $config->get('add_names', true) ? $mailClass->cleanText(@$user->name) : '';
     $mail = new stdClass();
     $mail->from_name = $config->get('from_name');
     $mail->from_email = $config->get('from_email');
     $mail->reply_name = $config->get('reply_name');
     $mail->reply_email = $config->get('reply_email');
     $mail->html = 0;
     $mailClass->AddAddress($user->user_email, $addedName);
     $mailClass->Subject = 'Test e-mail from ' . HIKASHOP_LIVE;
     $mailClass->Body = 'This test email confirms that your configuration enables HikaShop to send emails normally.';
     $mail->debug = 1;
     $result = $mailClass->sendMail($mail);
     return $this->edit();
 }
开发者ID:q0821,项目名称:esportshop,代码行数:20,代码来源:email.php

示例6: onAfterOrderUpdate

 function onAfterOrderUpdate(&$order, &$send_email)
 {
     if (!empty($order->order_id)) {
         $history = new stdClass();
         $history->history_order_id = $order->order_id;
         $history->history_created = time();
         $history->history_ip = hikashop_getIP();
         $history->history_user_id = hikashop_loadUser();
         if (empty($order->order_status)) {
             $class = hikashop_get('class.order');
             $old = $class->get($order->order_id);
             $order->order_status = $old->order_status;
         }
         $history->history_new_status = $order->order_status;
         if (!empty($order->history)) {
             foreach (get_object_vars($order->history) as $k => $v) {
                 $history->{$k} = $v;
             }
         }
         $historyClass = hikashop_get('class.history');
         $historyClass->save($history);
     }
     return true;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:24,代码来源:history.php

示例7: frontSaveForm

 function frontSaveForm($task = '')
 {
     $fieldsClass = hikashop_get('class.field');
     $data = JRequest::getVar('data', array(), '', 'array');
     $ret = array();
     $user_id = hikashop_loadUser(false);
     $currentTask = 'billing_address';
     if ((empty($task) || $task == $currentTask) && !empty($data[$currentTask])) {
         $oldAddress = null;
         $billing_address = $fieldsClass->getInput(array($currentTask, 'address'), $oldAddress);
         if (!empty($billing_address)) {
             $billing_address->address_user_id = $user_id;
             $id = (int) @$billing_address->address_id;
             $result = $this->save($billing_address, 0, 'billing');
             if ($result) {
                 $r = new stdClass();
                 $r->id = $result;
                 $r->previous_id = $id;
                 $ret[$currentTask] = $r;
             } else {
                 return false;
             }
         }
     }
     $same_address = JRequest::getString('same_address');
     $currentTask = 'shipping_address';
     if ((empty($task) || $task == $currentTask) && !empty($data[$currentTask]) && $same_address != 'yes') {
         $oldAddress = null;
         $shipping_address = $fieldsClass->getInput(array($currentTask, 'address'), $oldAddress);
         if (!empty($shipping_address)) {
             $shipping_address->address_user_id = $user_id;
             $id = (int) @$shipping_address->address_id;
             $result = $this->save($shipping_address, 0, 'shipping');
             if ($result) {
                 $r = new stdClass();
                 $r->id = $result;
                 $r->previous_id = $id;
                 $ret[$currentTask] = $r;
             } else {
                 return false;
             }
         }
     }
     return $ret;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:45,代码来源:address.php

示例8: send

 function send()
 {
     JRequest::checkToken() || die('Invalid Token');
     $bodyEmail = JRequest::getString('mailbody');
     $code = JRequest::getString('code');
     JRequest::setVar('code', $code);
     if (empty($code)) {
         return;
     }
     $config =& hikashop_config();
     $user = hikashop_loadUser(true);
     $mailClass = hikashop_get('class.mail');
     $addedName = $config->get('add_names', true) ? $mailClass->cleanText(@$user->name) : '';
     $true = true;
     $mail = $mailClass->get('language', $true);
     $mailClass->mailer->AddAddress($user->user_email, $addedName);
     $mailClass->mailer->AddAddress('translate@hikashop.com', 'Hikashop Translation Team');
     $mail->subject = '[HIKASHOP LANGUAGE FILE] ' . $code;
     $mail->altbody = 'The website ' . HIKASHOP_LIVE . ' using HikaShop ' . $config->get('level') . $config->get('version') . ' sent a language file : ' . $code;
     $mail->altbody .= "\n" . "\n" . "\n" . $bodyEmail;
     $mail->html = 0;
     jimport('joomla.filesystem.file');
     $path = JPath::clean(JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_hikashop.ini');
     $mailClass->mailer->AddAttachment($path);
     $result = $mailClass->sendMail($mail);
     if ($result) {
         hikashop_display(JText::_('THANK_YOU_SHARING'), 'success');
     } else {
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:30,代码来源:config.php

示例9: check

 function check(&$coupon, &$total, $zones, &$products, $display_error = true)
 {
     JPluginHelper::importPlugin('hikashop');
     $dispatcher = JDispatcher::getInstance();
     $error_message = '';
     $do = true;
     if (isset($coupon->discount_value)) {
         $coupon = $this->get($coupon->discount_id);
     }
     $dispatcher->trigger('onBeforeCouponCheck', array(&$coupon, &$total, &$zones, &$products, &$display_error, &$error_message, &$do));
     if ($do) {
         $user = hikashop_get('class.user');
         $currency = hikashop_get('class.currency');
         if (empty($coupon)) {
             $error_message = JText::_('COUPON_NOT_VALID');
         } elseif ($coupon->discount_start > time()) {
             $error_message = JText::_('COUPON_NOT_YET_USABLE');
         } elseif ($coupon->discount_end && $coupon->discount_end < time()) {
             $error_message = JText::_('COUPON_EXPIRED');
         } elseif (hikashop_level(2) && !empty($coupon->discount_access) && $coupon->discount_access != 'all' && ($coupon->discount_access == 'none' || !hikashop_isAllowed($coupon->discount_access))) {
             $error_message = JText::_('COUPON_NOT_FOR_YOU');
         } elseif (empty($error_message) && hikashop_level(1) && !empty($coupon->discount_quota) && $coupon->discount_quota <= $coupon->discount_used_times) {
             $error_message = JText::_('QUOTA_REACHED_FOR_COUPON');
         } elseif (empty($error_message) && hikashop_level(1)) {
             if (!empty($coupon->discount_quota_per_user)) {
                 $user_id = hikashop_loadUser();
                 if ($user_id) {
                     $db = JFactory::getDBO();
                     $config =& hikashop_config();
                     $cancelled_order_status = explode(',', $config->get('cancelled_order_status'));
                     $cancelled_order_status = "'" . implode("','", $cancelled_order_status) . "'";
                     $query = 'SELECT COUNT(order_id) AS already_used FROM ' . hikashop_table('order') . ' WHERE order_user_id=' . (int) $user_id . ' AND order_status NOT IN (' . $cancelled_order_status . ') AND order_discount_code=' . $db->Quote($coupon->discount_code) . ' GROUP BY order_id';
                     $db->setQuery($query);
                     $already_used = $db->loadResult();
                     if ($coupon->discount_quota_per_user <= $already_used) {
                         $error_message = JText::_('QUOTA_REACHED_FOR_COUPON');
                     }
                 }
             }
             if (empty($error_message) && $coupon->discount_zone_id) {
                 if (!is_array($coupon->discount_zone_id)) {
                     $coupon->discount_zone_id = explode(',', $coupon->discount_zone_id);
                 }
                 $class = hikashop_get('class.zone');
                 $zone = $class->getZones($coupon->discount_zone_id, 'zone_namekey', 'zone_namekey', true);
                 if ($zone && !count(array_intersect($zone, $zones))) {
                     $error_message = JText::_('COUPON_NOT_AVAILABLE_IN_YOUR_ZONE');
                 }
             }
             $ids = array();
             $qty = 0;
             foreach ($products as $prod) {
                 $qty += $prod->cart_product_quantity;
                 if (!empty($prod->product_parent_id)) {
                     $ids[$prod->product_parent_id] = (int) $prod->product_parent_id;
                 } else {
                     $ids[$prod->product_id] = (int) $prod->product_id;
                 }
             }
             if (empty($ids)) {
                 $error_message = JText::_('COUPON_NOT_FOR_EMPTY_CART');
             }
             if (!empty($coupon->discount_product_id) && is_string($coupon->discount_product_id)) {
                 $coupon->discount_product_id = explode(',', $coupon->discount_product_id);
             }
             if (empty($error_message) && !empty($coupon->discount_product_id) && count(array_intersect($ids, $coupon->discount_product_id)) == 0) {
                 $error_message = JText::_('COUPON_NOT_FOR_THOSE_PRODUCTS');
             }
             if (empty($error_message) && $coupon->discount_category_id) {
                 $db = JFactory::getDBO();
                 if (!is_array($coupon->discount_category_id)) {
                     $coupon->discount_category_id = explode(',', trim($coupon->discount_category_id, ','));
                 }
                 if ($coupon->discount_category_childs) {
                     $filters = array('b.category_type=\'product\'', 'a.product_id IN (' . implode(',', $ids) . ')');
                     $categoryClass = hikashop_get('class.category');
                     $categories = $categoryClass->getCategories($coupon->discount_category_id, 'category_left, category_right');
                     if (!empty($categories)) {
                         $categoriesFilters = array();
                         foreach ($categories as $category) {
                             $categoriesFilters[] = 'b.category_left >= ' . $category->category_left . ' AND b.category_right <= ' . $category->category_right;
                         }
                         if (count($categoriesFilters)) {
                             $filters[] = '((' . implode(') OR (', $categoriesFilters) . '))';
                             hikashop_addACLFilters($filters, 'category_access', 'b');
                             $select = 'SELECT a.product_id FROM ' . hikashop_table('category') . ' AS b LEFT JOIN ' . hikashop_table('product_category') . ' AS a ON b.category_id=a.category_id WHERE ' . implode(' AND ', $filters);
                             $db->setQuery($select);
                             $id = $db->loadRowList();
                             if (empty($id)) {
                                 $error_message = JText::_('COUPON_NOT_FOR_PRODUCTS_IN_THOSE_CATEGORIES');
                             }
                         }
                     }
                 } else {
                     JArrayHelper::toInteger($coupon->discount_category_id);
                     $filters = array('b.category_id IN (' . implode(',', $coupon->discount_category_id) . ')', 'a.product_id IN (' . implode(',', $ids) . ')');
                     hikashop_addACLFilters($filters, 'category_access', 'b');
                     $select = 'SELECT a.product_id FROM ' . hikashop_table('category') . ' AS b LEFT JOIN ' . hikashop_table('product_category') . ' AS a ON b.category_id=a.category_id WHERE ' . implode(' AND ', $filters);
                     $db->setQuery($select);
                     $id = $db->loadRowList();
//.........这里部分代码省略.........
开发者ID:rodhoff,项目名称:MNW,代码行数:101,代码来源:discount.php

示例10: setTimeout

$app = JFactory::getApplication();
$wishlist_id = $app->getUserState(HIKASHOP_COMPONENT . '.wishlist_id', '0');
$cart_type = JRequest::getVar('cart_type', '');
if (empty($cart_type)) {
    $cart_type = $app->getUserState(HIKASHOP_COMPONENT . '.popup_cart_type', 'cart');
}
$app->setUserState(HIKASHOP_COMPONENT . '.popup_cart_type', 'cart');
?>
<script type="text/javascript">
setTimeout( 'window.parent.hikashop.closeBox()', <?php 
echo (int) $this->config->get('popup_display_time', 2000);
?>
 );
</script>
<?php 
if ($cart_type == 'cart' || hikashop_loadUser() != null) {
    ?>
<div id="hikashop_notice_box_content" class="hikashop_notice_box_content" >
	<div id="hikashop_notice_box_message" >
		<?php 
    if ($cart_type == 'wishlist') {
        echo hikashop_display(JText::_('PRODUCT_SUCCESSFULLY_ADDED_TO_WISHLIST'), 'success', true);
    } else {
        echo hikashop_display(JText::_('PRODUCT_SUCCESSFULLY_ADDED_TO_CART'), 'success', true);
    }
    ?>
	</div>
	<br />
	<div id="hikashop_add_to_cart_continue_div">
		<?php 
    echo $this->cartClass->displayButton(JText::_('CONTINUE_SHOPPING'), 'continue_shopping', $this->params, '', 'window.parent.hikashop.closeBox(); return false;', 'id="hikashop_add_to_cart_continue_button"');
开发者ID:rodhoff,项目名称:MNW,代码行数:31,代码来源:notice.php

示例11: lookup

 protected function lookup(&$cart)
 {
     if (!$this->initSoap()) {
         return false;
     }
     if (!$this->loadOptions()) {
         return false;
     }
     $address = $this->loadAddress();
     if (empty($address)) {
         return false;
     }
     if ($address->address_country->zone_code_3 != 'USA') {
         return true;
     }
     $app = JFactory::getApplication();
     $user_id = hikashop_loadUser(false);
     if (empty($user_id)) {
         return false;
     }
     $usps_address = $app->getUserState(HIKASHOP_COMPONENT . '.taxcloud.full_address', null);
     if (empty($usps_address)) {
         $usps_address = array('Address1' => $address->address_street, 'Address2' => $address->address_street2, 'City' => $address->address_city, 'State' => $address->address_state->zone_code_3, 'Zip5' => $address->address_post_code, 'Zip4' => '');
     }
     $cart_items = array();
     $tics = array();
     $i = 0;
     foreach ($cart->products as $product) {
         $i++;
         $tic = (int) $this->plugin_options['default_tic'];
         if (!empty($product->product_taxability_code)) {
             if ($product->product_taxability_code != '-1' && $product->product_taxability_code !== '') {
                 $tic = (int) $product->product_taxability_code;
             }
         }
         if (!isset($tics[$tic])) {
             $cart_items[] = array('Index' => -$i, 'ItemID' => 'tic_rate_' . $tic, 'TIC' => $tic, 'Price' => 1, 'Qty' => 1);
             $tics[$tic] = $i;
         }
     }
     $i = 0;
     foreach ($cart->products as $k => $product) {
         $i++;
         $tic = (int) $this->plugin_options['default_tic'];
         if (!empty($product->product_taxability_code)) {
             if ($product->product_taxability_code != '-1' && $product->product_taxability_code !== '') {
                 $tic = (int) $product->product_taxability_code;
             }
         }
         $cart->products[$k]->taxcloud_id = $i;
         if (isset($product->prices[0]->unit_price->price_value)) {
             $price = $product->prices[0]->unit_price->price_value;
         } else {
             if (isset($product->prices[0]->price_value)) {
                 $price = $product->prices[0]->price_value;
             } else {
                 $price = 0;
             }
         }
         $cart_items[] = array('Index' => $i, 'ItemID' => $product->product_code, 'TIC' => $tic, 'Price' => $price, 'Qty' => $product->cart_product_quantity);
     }
     $parameters = array('apiLoginID' => $this->plugin_options['api_id'], 'apiKey' => $this->plugin_options['api_key'], 'customerID' => $user_id, 'cartID' => $cart->cart_id, 'cartItems' => $cart_items, 'origin' => array('Address1' => $this->plugin_options['origin_address1'], 'Address2' => $this->plugin_options['origin_address2'], 'City' => $this->plugin_options['origin_city'], 'State' => $this->plugin_options['origin_state'], 'Zip5' => $this->plugin_options['origin_zip5'], 'Zip4' => $this->plugin_options['origin_zip4']), 'destination' => $usps_address, 'deliveredBySeller' => false, 'exemptCert' => null);
     static $soapCache = array();
     $hash = md5(serialize($parameters));
     $session_hash = $app->getUserState(HIKASHOP_COMPONENT . '.taxcloud.cache_hash', '');
     if ($hash == $session_hash) {
         $ret = $app->getUserState(HIKASHOP_COMPONENT . '.taxcloud.cache', '');
         if (!empty($ret) && !empty($ret->ResponseType)) {
             $useCache = true;
             if (!isset($soapCache[$hash])) {
                 $soapCache[$hash] = $ret;
             }
         } else {
             unset($ret);
         }
     } else {
         $app->setUserState(HIKASHOP_COMPONENT . '.taxcloud.cache_hash', '');
         $app->setUserState(HIKASHOP_COMPONENT . '.taxcloud.cache', null);
     }
     if (!isset($soapCache[$hash])) {
         try {
             $soapRet = $this->soap->__soapCall('Lookup', array($parameters));
             //, array('uri' => 'http://taxcloud.net','soapaction' => ''));
             $soapCache[$hash] = $soapRet->LookupResult;
             $ret = $soapRet->LookupResult;
         } catch (Exception $e) {
             $ret = false;
         }
         if ($ret !== false && @$ret->ResponseType == 'OK') {
             $app->setUserState(HIKASHOP_COMPONENT . '.taxcloud.cache_hash', $hash);
             $app->setUserState(HIKASHOP_COMPONENT . '.taxcloud.cache', $ret);
         }
         if ($this->debug) {
             var_dump($ret->ResponseType);
             if ($ret->ResponseType == 'OK') {
                 var_dump($ret->CartItemsResponse->CartItemResponse);
             } else {
                 var_dump($ret);
             }
         }
//.........这里部分代码省略.........
开发者ID:rodhoff,项目名称:MNW,代码行数:101,代码来源:taxcloud.php

示例12: array

 function &getShippings(&$order, $reset = false)
 {
     static $usable_methods = null;
     static $shipping_groups = null;
     static $errors = array();
     if ($reset) {
         $usable_methods = null;
         $errors = array();
         $shipping_groups = null;
     }
     if (!is_null($usable_methods)) {
         $this->errors = $errors;
         $order->shipping_groups =& $shipping_groups;
         return $usable_methods;
     }
     $this->getShippingProductsData($order);
     $zoneClass = hikashop_get('class.zone');
     $zones = $zoneClass->getOrderZones($order);
     $currency = @$order->total->prices[0]->price_currency_id;
     if (empty($currency)) {
         $currency = hikashop_getCurrency();
     }
     $rates = $this->getMethods($order, $currency);
     $usable_methods = array();
     $config =& hikashop_config();
     if (!$config->get('force_shipping') && bccomp(@$order->weight, 0, 5) <= 0) {
         return $usable_methods;
     }
     if (empty($rates)) {
         $errors['no_rates'] = JText::_('NO_SHIPPING_METHOD_FOUND');
         $this->errors = $errors;
         return $usable_methods;
     }
     $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};
         }
     }
     $use_cache = $config->get('use_shipping_cache', true);
     $shipping_key = sha1(serialize($order_clone) . serialize($rates));
     if (!isset($order->cache)) {
         $order->cache = new stdClass();
     }
     $order->cache->shipping_key = $shipping_key;
     $order->cache->shipping = null;
     if ($use_cache) {
         $order->cache->shipping = $app->getUserState(HIKASHOP_COMPONENT . '.shipping_cache.usable_methods', null);
     }
     foreach ($rates as $k => $rate) {
         if (!empty($rate->shipping_zone_namekey) && !in_array($rate->shipping_zone_namekey, $zones)) {
             unset($rates[$k]);
             continue;
         }
         if (!empty($rate->shipping_params->shipping_zip_prefix) || !empty($rate->shipping_params->shipping_min_zip) || !empty($rate->shipping_params->shipping_max_zip) || !empty($rate->shipping_params->shipping_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($rate->shipping_params->shipping_zip_prefix) && $rate->shipping_params->shipping_zip_prefix != $prefix) {
                         unset($rates[$k]);
                         continue;
                     }
                     if (!empty($rate->shipping_params->shipping_min_zip) && $rate->shipping_params->shipping_min_zip > $main) {
                         unset($rates[$k]);
                         continue;
                     }
                     if (!empty($rate->shipping_params->shipping_max_zip) && $rate->shipping_params->shipping_max_zip < $main) {
                         unset($rates[$k]);
                         continue;
                     }
                     if (!empty($rate->shipping_params->shipping_zip_suffix) && $rate->shipping_params->shipping_zip_suffix != $suffix) {
                         unset($rates[$k]);
                         continue;
                     }
                 }
             }
             if (!$checkDone) {
                 unset($rates[$k]);
                 continue;
             }
         }
     }
     if (empty($rates)) {
         if (hikashop_loadUser()) {
             $errors['no_shipping_to_your_zone'] = JText::_('NO_SHIPPING_TO_YOUR_ZONE');
         }
         $this->errors = $errors;
         return $usable_methods;
     }
     $shipping_groups = $this->getShippingGroups($order, $rates);
     JPluginHelper::importPlugin('hikashopshipping');
     $dispatcher = JDispatcher::getInstance();
     if (!empty($shipping_groups) && count($shipping_groups) > 1) {
         $order_backup = new stdClass();
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:shipping.php

示例13: onAfterRender

 function onAfterRender()
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         return;
     }
     $option = JRequest::getCmd('option', '');
     $view = JRequest::getCmd('view', '');
     $task = JRequest::getCmd('task', '');
     $layout = JRequest::getCmd('layout', '');
     if (($option != 'com_user' || $view != 'user' || $task != 'edit') && ($option != 'com_users' || $view != 'profile' || $layout != 'edit')) {
         return;
     }
     $display = $this->params->get('fields_on_user_profile');
     if (is_null($display)) {
         $display = 1;
     }
     if (empty($display) || $display == '0') {
         return;
     }
     $body = JResponse::getBody();
     $alternate_body = false;
     if (empty($body)) {
         $app = JFactory::getApplication();
         $body = $app->getBody();
         $alternate_body = true;
     }
     if (strpos($body, 'class="form-validate') === false) {
         return;
     }
     if (!defined('DS')) {
         define('DS', DIRECTORY_SEPARATOR);
     }
     if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) {
         return true;
     }
     $user = hikashop_loadUser(true);
     $fieldsClass = hikashop_get('class.field');
     $extraFields = array('user' => $fieldsClass->getFields('frontcomp', $user, 'user'));
     if (empty($extraFields['user'])) {
         return;
     }
     $null = array();
     $fieldsClass->addJS($null, $null, $null);
     $fieldsClass->jsToggle($extraFields['user'], $user, 0);
     $requiredFields = array();
     $validMessages = array();
     $values = array('user' => $user);
     $fieldsClass->checkFieldsForJS($extraFields, $requiredFields, $validMessages, $values);
     $fieldsClass->addJS($requiredFields, $validMessages, array('user'));
     $data = '';
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $data .= '<style type="text/css">' . "\r\n" . 'fieldset.hikashop_user_edit { border: 1px solid rgb(204, 204, 204); margin: 10px 0 15px; padding: 0px 10px 0px 10px; }' . "\r\n" . '.hikashop_user_edit legend { font-size: 1em; font-weight: bold; }' . "\r\n" . '.hikashop_user_edit dt { padding: 5px 5px 5px 0px; width: 13em; clear:left; float:left; }' . "\r\n" . '.hikashop_user_edit dd { margin-left: 14em; }' . "\r\n" . '</style>';
     }
     if (HIKASHOP_J30) {
         $data .= '<fieldset class="hikashop_user_edit"><legend>' . JText::_('HIKASHOP_USER_DETAILS') . '</legend><dl>';
     } else {
         $data .= '<fieldset class="hikashop_user_edit"><legend>' . JText::_('HIKASHOP_USER_DETAILS') . '</legend>';
     }
     foreach ($extraFields['user'] as $fieldName => $oneExtraField) {
         if (HIKASHOP_J30) {
             $data .= '<div class="control-group hikashop_registration_' . $fieldName . '_line" id="hikashop_user_' . $fieldName . '"><div class="control-label"><label>' . $fieldsClass->getFieldName($oneExtraField) . '</label></div><div class="controls">';
         } else {
             $data .= '<dt><label>' . $fieldsClass->getFieldName($oneExtraField) . '</label></dt><dd class="hikashop_registration_' . $fieldName . '_line" id="hikashop_user_' . $fieldName . '">';
         }
         $onWhat = 'onchange';
         if ($oneExtraField->field_type == 'radio') {
             $onWhat = 'onclick';
         }
         $data .= $fieldsClass->display($oneExtraField, @$user->{$fieldName}, 'data[user][' . $fieldName . ']', false, ' ' . $onWhat . '="hikashopToggleFields(this.value,\'' . $fieldName . '\',\'user\',0);"', false, $extraFields['user'], $user);
         if (HIKASHOP_J30) {
             $data .= '</div></div>';
         } else {
             $data .= '</dd>';
         }
     }
     if (HIKASHOP_J30) {
         $data .= '</dl></fieldset>';
     } else {
         $data .= '</fieldset>';
     }
     $body = preg_replace('#(<form[^>]*class="form-validate.*"[^>]*>.*</(fieldset|table)>)#Uis', '$1' . $data, $body, 1);
     if ($alternate_body) {
         $app->setBody($body);
     } else {
         JResponse::setBody($body);
     }
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:88,代码来源:hikashopuser.php

示例14: defined

 */
defined('_JEXEC') or die('Restricted access');
global $Itemid;
$url_itemid = '';
if (!empty($this->itemid)) {
    $url_itemid = $this->itemid;
} elseif (!empty($Itemid)) {
    $url_itemid = '&Itemid=' . $Itemid;
}
if ($this->config->get('show_quantity_field') == -2) {
    $this->params->set('show_quantity_field', $this->row->product_display_quantity_field);
}
$config =& hikashop_config();
$wishlistEnabled = $config->get('enable_wishlist', 1);
$hideForGuest = 1;
if ($config->get('hide_wishlist_guest', 1) && hikashop_loadUser() != null || !$config->get('hide_wishlist_guest', 1)) {
    $hideForGuest = 0;
}
if (!isset($this->cart)) {
    $this->cart = hikashop_get('helper.cart');
}
$this->cart = hikashop_get('helper.cart');
$url = '';
$module_id = $this->params->get('from_module', 0);
if (empty($this->ajax)) {
    $this->ajax = 'return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1,0,\'cart\',' . $module_id . ')';
}
if (@$this->row->product_sale_start || empty($this->element->main)) {
    $start_date = @$this->row->product_sale_start;
} else {
    $start_date = $this->element->main->product_sale_start;
开发者ID:jhener79,项目名称:vlakc,代码行数:31,代码来源:quantity.php

示例15: 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;
     $currencyClass = hikashop_get('class.currency');
     foreach ($local_usable_rates as $k => $rate) {
         if (empty($rate->shipping_params->methodsList)) {
             $messages['no_shipping_methods_configured'] = 'No shipping methods configured in the FedEx shipping plugin options';
             continue;
         }
         $rate->shipping_params->methods = unserialize($rate->shipping_params->methodsList);
         if ($order->weight <= 0 || $order->volume <= 0 && @$rate->shipping_params->use_dimensions == 1) {
             continue;
         }
         $this->freight = false;
         $this->classicMethod = false;
         $heavyProduct = false;
         $weightTotal = 0;
         if (!empty($rate->shipping_params->methods)) {
             foreach ($rate->shipping_params->methods as $method) {
                 if ($method == 'TDCB' || $method == 'TDA' || $method == 'TDO' || $method == '308' || $method == '309' || $method == '310') {
                     $this->freight = true;
                 } else {
                     $this->classicMethod = true;
                 }
             }
         }
         $data = null;
         if (empty($order->shipping_address)) {
             $messages['no_shipping_methods_configured'] = 'No shipping address is configured.';
             return true;
         }
         $this->shipping_currency_id = $currency = 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->_getRates($rate, $order, $heavyProduct, $null);
         if (empty($receivedMethods)) {
             $messages['no_rates'] = JText::_('NO_SHIPPING_METHOD_FOUND');
             continue;
         }
         $i = 0;
         $local_usable_rates = array();
         foreach ($receivedMethods as $method) {
             $usableMethods[] = $method;
             $local_usable_rates[$i] = !HIKASHOP_PHP5 ? $rate : clone $rate;
             $local_usable_rates[$i]->shipping_price += round($method['value'], 2);
             $selected_method = '';
             $name = '';
             foreach ($this->fedex_methods as $fedex_method) {
                 if ($fedex_method['code'] == $method['code'] && ($method['old_currency_code'] == 'CAD' || !isset($fedex_method['double']))) {
                     $name = $fedex_method['name'];
                     $selected_method = $fedex_method['key'];
                     break;
                 }
             }
             $local_usable_rates[$i]->shipping_name = $name;
             if (!empty($selected_method)) {
                 $local_usable_rates[$i]->shipping_id .= '-' . $selected_method;
             }
             $sep = '';
             if (@$rate->shipping_params->show_eta) {
                 if (@$rate->shipping_params->show_eta_delay) {
                     if ($method['delivery_delay'] != -1 && $method['day'] > 0) {
                         $local_usable_rates[$i]->shipping_description .= $sep . JText::sprintf('ESTIMATED_TIME_AFTER_SEND', $method['delivery_delay']);
                     } else {
                         $local_usable_rates[$i]->shipping_description .= $sep . JText::_('NO_ESTIMATED_TIME_AFTER_SEND');
                     }
                 } else {
                     if ($method['delivery_day'] != -1 && $method['day'] > 0) {
                         $local_usable_rates[$i]->shipping_description .= $sep . JText::sprintf('ESTIMATED_TIME_AFTER_SEND', $method['delivery_day']);
                     } else {
                         $local_usable_rates[$i]->shipping_description .= $sep . JText::_('NO_ESTIMATED_TIME_AFTER_SEND');
                     }
                 }
                 $sep = '<br/>';
                 if ($method['delivery_time'] != -1 && $method['day'] > 0) {
                     if (@$rate->shipping_params->show_eta_format == '12') {
                         $local_usable_rates[$i]->shipping_description .= $sep . JText::sprintf('DELIVERY_HOUR', date('h:i:s a', strtotime($method['delivery_time'])));
                     } else {
                         $local_usable_rates[$i]->shipping_description .= $sep . JText::sprintf('DELIVERY_HOUR', $method['delivery_time']);
                     }
                 } else {
                     $local_usable_rates[$i]->shipping_description .= $sep . JText::_('NO_DELIVERY_HOUR');
                 }
             }
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:fedex.php


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