本文整理汇总了PHP中hikashop_import函数的典型用法代码示例。如果您正苦于以下问题:PHP hikashop_import函数的具体用法?PHP hikashop_import怎么用?PHP hikashop_import使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hikashop_import函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
function update()
{
$currency = JRequest::getInt('hikashopcurrency', 0);
if (!empty($currency)) {
$app = JFactory::getApplication();
$app->setUserState(HIKASHOP_COMPONENT . '.currency_id', $currency);
$url = JRequest::getString('return_url', '');
if (!empty($url)) {
if (hikashop_disallowUrlRedirect($url)) {
return false;
}
$app->redirect(urldecode($url));
}
return true;
}
$ratePlugin = hikashop_import('hikashop', 'rates');
if ($ratePlugin) {
$ratePlugin->updateRates();
} else {
if (!HIKASHOP_PHP5) {
$app =& JFactory::getApplication();
} else {
$app = JFactory::getApplication();
}
$app->enqueueMessage('Currencies rates auto update plugin not found !', 'error');
}
$this->listing();
}
示例2: show
function show()
{
$user = hikashop_loadUser(true);
$userClass = hikashop_get('class.user');
$userClass->loadPartnerData($user);
$config =& hikashop_config();
if (empty($user->user_params->user_custom_fee)) {
$user->user_params->user_partner_click_fee = $config->get('partner_click_fee', 0);
$user->user_params->user_partner_lead_fee = $config->get('partner_lead_fee', 0);
$user->user_params->user_partner_percent_fee = $config->get('partner_percent_fee', 0);
$user->user_params->user_partner_flat_fee = $config->get('partner_flat_fee', 0);
}
$query = 'SELECT * FROM ' . hikashop_table('banner') . ' WHERE banner_published=1 ORDER BY banner_ordering ASC;';
$database = JFactory::getDBO();
$database->setQuery($query);
$banners = $database->loadObjectList();
$this->assignRef('banners', $banners);
$advanced_stats = $config->get('affiliate_advanced_stats', 1);
$this->assignRef('advanced_stats', $advanced_stats);
$this->assignRef('user', $user);
$currencyType = hikashop_get('type.currency');
$this->assignRef('currencyType', $currencyType);
$currencyHelper = hikashop_get('class.currency');
$this->assignRef('currencyHelper', $currencyHelper);
$popup = hikashop_get('helper.popup');
$this->assignRef('popup', $popup);
JHTML::_('behavior.tooltip');
$affiliate_plugin = hikashop_import('system', 'hikashopaffiliate');
$partner_id = (int) @$user->user_id;
$this->assignRef('partner_id', $partner_id);
$partner_info = $affiliate_plugin->params->get('partner_key_name', 'partner_id') . '=' . $partner_id;
$this->assignRef('partner_info', $partner_info);
$allow_currency_selection = $config->get('allow_currency_selection');
$this->assignRef('allow_currency_selection', $allow_currency_selection);
if (empty($this->user->user_id)) {
$app = JFactory::getApplication();
global $Itemid;
$url = '';
if (!empty($Itemid)) {
$url = '&Itemid=' . $Itemid;
}
if (!HIKASHOP_J16) {
$url = 'index.php?option=com_user&view=login' . $url;
} else {
$url = 'index.php?option=com_users&view=login' . $url;
}
$url = JRoute::_($url . '&return=' . urlencode(base64_encode(hikashop_currentUrl('', false))));
$app->enqueueMessage('<a href="' . $url . '">' . JText::_('PLEASE_LOGIN_FIRST') . '</a>');
}
$config =& hikashop_config();
$affiliate_terms = $config->get('affiliate_terms', 0);
$this->assignRef('affiliate_terms', $affiliate_terms);
hikashop_setPageTitle('AFFILIATE');
}
示例3: loadCurrentPlugin
function loadCurrentPlugin($id, $name)
{
static $plugins = array();
if (!isset($plugins[$id])) {
$plugins[$id] = hikashop_import('payment', $name);
$plugins[$id]->params =& $this;
JPluginHelper::importPlugin('payment');
$plugin = JPluginHelper::getPlugin('payment', $name);
if (is_object($plugin)) {
$plugin->params = json_encode($this->payment_params);
}
}
return $plugins[$id];
}
示例4: trigger
function trigger()
{
$cid = JRequest::getInt('cid', 0);
$function = 'productDisplay';
if (empty($cid) || empty($function)) {
return false;
}
$pluginsClass = hikashop_get('class.plugins');
$plugin = $pluginsClass->get($cid);
if (empty($plugin)) {
return false;
}
$plugin = hikashop_import($plugin->folder, $plugin->element);
if (method_exists($plugin, $function)) {
return $plugin->{$function}();
}
return false;
}
示例5: processPaymentNotification
protected function processPaymentNotification()
{
if (!(include_once rtrim(JPATH_ADMINISTRATOR, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_hikashop' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'helper.php')) {
return;
}
JRequest::setVar('hikashop_payment_notification_plugin', true);
ob_start();
$payment = JRequest::getCmd('notif_payment', @$_REQUEST['notif_payment']);
$data = hikashop_import('hikashoppayment', $payment);
if (!empty($data)) {
$trans = hikashop_get('helper.translation');
$cleaned_statuses = $trans->getStatusTrans();
$data = $data->onPaymentNotification($cleaned_statuses);
}
$dbg = ob_get_clean();
if (!empty($dbg)) {
$config =& hikashop_config();
jimport('joomla.filesystem.file');
$file = $config->get('payment_log_file', '');
$file = rtrim(JPath::clean(html_entity_decode($file)), DIRECTORY_SEPARATOR . ' ');
if (!preg_match('#^([A-Z]:)?/.*#', $file) && (!$file[0] == '/' || !file_exists($file))) {
$file = JPath::clean(HIKASHOP_ROOT . DIRECTORY_SEPARATOR . trim($file, DIRECTORY_SEPARATOR . ' '));
}
if (!empty($file) && defined('FILE_APPEND')) {
if (!file_exists(dirname($file))) {
jimport('joomla.filesystem.folder');
JFolder::create(dirname($file));
}
file_put_contents($file, $dbg, FILE_APPEND);
}
}
if (is_string($data) && !empty($data)) {
echo $data;
}
exit;
}
示例6: address
function address()
{
$app = JFactory::getApplication();
$addresses = array();
$fields = null;
$user_id = hikashop_loadUser();
if ($user_id) {
$class = hikashop_get('class.address');
$addresses = $class->loadUserAddresses($user_id);
if (!empty($addresses)) {
$addressClass = hikashop_get('class.address');
$addressClass->loadZone($addresses);
$fields =& $addressClass->fields;
}
}
$cart = $this->initCart();
if (!$this->has_shipping) {
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_method', null);
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_id', null);
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_data', null);
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_address', null);
}
$this->assignRef('fields', $fields);
$this->assignRef('addresses', $addresses);
$fieldsClass = hikashop_get('class.field');
$this->assignRef('fieldsClass', $fieldsClass);
$identified = (bool) $user_id;
$this->assignRef('identified', $identified);
JHTML::_('behavior.modal');
$billing_address = $app->getUserState(HIKASHOP_COMPONENT . '.billing_address');
if (empty($billing_address) && count($addresses)) {
$address = reset($addresses);
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_address', $address->address_id);
$app->setUserState(HIKASHOP_COMPONENT . '.billing_address', $address->address_id);
$class = hikashop_get('class.cart');
$class->loadAddress($cart, $address->address_id);
$cart->billing_address =& $cart->shipping_address;
}
$shipping_address = $app->getUserState(HIKASHOP_COMPONENT . '.shipping_address');
$billing_address = $app->getUserState(HIKASHOP_COMPONENT . '.billing_address');
$this->assignRef('shipping_address', $shipping_address);
$this->assignRef('billing_address', $billing_address);
$shipping_method = $app->getUserState(HIKASHOP_COMPONENT . '.shipping_method');
if (empty($shipping_method)) {
$shipping_method = array();
}
if (!is_array($shipping_method)) {
$shipping_method = array($shipping_method);
}
$currentShipping = array();
if (count($shipping_method) == 1) {
foreach ($shipping_method as $method) {
$method = explode('@', $method);
$method = $method[0];
$currentShipping[] = hikashop_import('hikashopshipping', $method);
}
}
$this->assignRef('currentShipping', $currentShipping);
$js = "\nfunction hikashopEditAddress(obj,val,new_address){\n\tvar same_address = document.getElementById('same_address');\n\tif(val && same_address && (new_address && same_address.checked || !new_address && !same_address.checked)){\n\t\tvar nextChar = '?';\n\t\tif(obj.href.indexOf('?')!='-1'){ nextChar='&'; }\n\t\tobj.href+=nextChar+'makenew=1';\n\t}\n\twindow.hikashop.openBox(obj,obj.href);\n\treturn false;\n}\nfunction hikashopSameAddress(value){\n\tvar shipdiv = document.getElementById('hikashop_checkout_shipping_div');\n\tif(shipdiv){\n\t\tif(!value){\n\t\t\tshipdiv.style.display='';\n\t\t}else{\n\t\t\tshipdiv.style.display='none';\n\t\t}\n\t}\n\treturn true;\n}";
if (!HIKASHOP_PHP5) {
$doc =& JFactory::getDocument();
} else {
$doc = JFactory::getDocument();
}
$doc->addScriptDeclaration("\n<!--\n" . $js . "\n//-->\n");
}
示例7: pluginsEnabled
function pluginsEnabled($elementPkey, &$value, $task = 'enabled')
{
$plugins = hikashop_get('class.plugins');
$obj = new stdClass();
if (!HIKASHOP_J16) {
$obj->id = $elementPkey;
} else {
$obj->extension_id = $elementPkey;
}
$obj->{$task} = $value;
$plugins->save($obj);
$result = $plugins->get($elementPkey);
if ($result) {
if ($result->{$task} != $value) {
$value = $result->{$task};
}
if ($result->folder != 'hikashop') {
$type = str_replace('hikashop', '', $result->folder);
$db = JFactory::getDBO();
$type_name = $type . '_type';
if ($type == 'payment' || $type == 'shipping') {
$db->setQuery('SELECT * FROM ' . hikashop_table($type) . ' WHERE ' . $type_name . '=\'' . $result->element . '\'');
$data = $db->loadObject();
}
if (empty($data)) {
$plugin = hikashop_import($result->folder, $result->element);
if ($plugin && method_exists($plugin, 'onPaymentConfiguration')) {
$obj = null;
$plugin->onPaymentConfiguration($obj);
if (!empty($obj) && is_array($obj) && count($obj) > 0) {
$obj = reset($obj);
$params_name = $type . '_params';
if (!empty($obj->{$params_name}) && !is_string($obj->{$params_name})) {
$obj->{$params_name} = serialize($obj->{$params_name});
}
$class = hikashop_get('class.' . $type);
$class->save($obj);
$pluginsClass = hikashop_get('class.plugins');
$pluginsClass->cleanPluginCache();
}
}
}
}
}
}
示例8: pay_process
function pay_process()
{
$order_id = hikashop_getCID('order_id');
if (empty($order_id)) {
return false;
}
$orderClass = hikashop_get('class.order');
$order = $orderClass->get($order_id);
$userClass = hikashop_get('class.user');
$user = $userClass->get($order->order_user_id);
$orderClass->loadProducts($order);
$order->cart->products =& $order->products;
$pluginClass = hikashop_get('class.plugins');
$methods = $pluginClass->getMethods('payment');
$methods[$order->order_payment_id]->payment_params->address_type = '';
$methods[$order->order_payment_id]->payment_params->cancel_url = HIKASHOP_LIVE . 'administrator/index.php?option=com_hikashop&ctrl=user&task=edit&user_id=' . $user->user_id;
$methods[$order->order_payment_id]->payment_params->return_url = HIKASHOP_LIVE . 'administrator/index.php?option=com_hikashop&ctrl=user&task=edit&user_id=' . $user->user_id;
$methods[$order->order_payment_id]->payment_params->email = $user->user_partner_email;
$data = hikashop_import('hikashoppayment', $order->order_payment_method);
$data->onAfterOrderConfirm($order, $methods, $order->order_payment_id);
}
示例9: 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;
}
示例10: getShippingName
function getShippingName($shipping_method, $shipping_id)
{
$shipping_name = $shipping_method . ' ' . $shipping_id;
if (strpos($shipping_id, '-') !== false) {
$shipping_ids = explode('-', $shipping_id, 2);
$shipping = $this->shippingClass->get($shipping_ids[0]);
if (!empty($shipping->shipping_params) && is_string($shipping->shipping_params)) {
$shipping->shipping_params = unserialize($shipping->shipping_params);
}
$shippingMethod = hikashop_import('hikashopshipping', $shipping_method);
$methods = $shippingMethod->shippingMethods($shipping);
if (isset($methods[$shipping_id])) {
$shipping_name = $shipping->shipping_name . ' - ' . $methods[$shipping_id];
} else {
$shipping_name = $shipping_id;
}
}
return $shipping_name;
}
示例11: loadFullOrder
function loadFullOrder($order_id, $additionalData = false, $checkUser = true)
{
$order = $this->get($order_id);
$app = JFactory::getApplication();
$type = 'frontcomp';
if (empty($order)) {
return null;
}
$userClass = hikashop_get('class.user');
$order->customer = $userClass->get($order->order_user_id);
if ($app->isAdmin()) {
if (hikashop_level(1)) {
$query = 'SELECT * FROM ' . hikashop_table('geolocation') . ' WHERE geolocation_type=\'order\' AND geolocation_ref_id=' . $order_id;
$this->database->setQuery($query);
$order->geolocation = $this->database->loadObject();
}
$query = 'SELECT * FROM ' . hikashop_table('history') . ' WHERE history_order_id=' . $order_id . ' ORDER BY history_created DESC';
$this->database->setQuery($query);
$order->history = $this->database->loadObjectList();
if (!empty($order->order_partner_id)) {
$order->partner = $userClass->get($order->order_partner_id);
}
$type = 'backend';
} elseif ($checkUser && hikashop_loadUser() != $order->order_user_id) {
return null;
}
$this->orderNumber($order);
$order->order_subtotal = $order->order_full_price + $order->order_discount_price - $order->order_shipping_price - $order->order_payment_price;
$this->loadAddress($order->order_shipping_address_id, $order, 'shipping', 'name', $type);
$this->loadAddress($order->order_billing_address_id, $order, 'billing', 'name', $type);
if (empty($order->fields)) {
$fieldClass = hikashop_get('class.field');
$order->fields = $fieldClass->getData($type, 'address');
}
if (!empty($order->order_payment_params) && is_string($order->order_payment_params)) {
$order->order_payment_params = unserialize($order->order_payment_params);
}
if (!empty($order->order_shipping_params) && is_string($order->order_shipping_params)) {
$order->order_shipping_params = unserialize($order->order_shipping_params);
}
if (!empty($order->order_shipping_id)) {
$order->shippings = array();
if (strpos($order->order_shipping_id, ';') !== false) {
$shipping_ids = explode(';', $order->order_shipping_id);
} else {
$shipping_ids = array($order->order_shipping_id);
}
JArrayHelper::toInteger($shipping_ids);
$query = 'SELECT * FROM ' . hikashop_table('shipping') . ' WHERE shipping_id IN (' . implode(',', $shipping_ids) . ')';
$this->database->setQuery($query);
$order->shippings = $this->database->loadObjectList('shipping_id');
}
if (!empty($order->order_shipping_method)) {
$currentShipping = hikashop_import('hikashopshipping', $order->order_shipping_method);
if (method_exists($currentShipping, 'getShippingAddress')) {
$override = $currentShipping->getShippingAddress($order->order_shipping_id);
if ($override !== false) {
$order->override_shipping_address = $override;
}
}
}
$this->loadProducts($order);
if (!empty($order->additional)) {
foreach ($order->additional as $additional) {
$order->order_subtotal -= $additional->order_product_price - $additional->order_product_tax;
}
}
$order->order_subtotal_no_vat = 0;
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
foreach ($order->products as $k => $product) {
$dispatcher->trigger('onBeforeCalculateProductPriceForQuantityInOrder', array(&$order->products[$k]));
if (function_exists('hikashop_product_price_for_quantity_in_order')) {
hikashop_product_price_for_quantity_in_order($order->products[$k]);
} else {
$order->products[$k]->order_product_total_price_no_vat = $product->order_product_price * $product->order_product_quantity;
$order->products[$k]->order_product_total_price = ($product->order_product_price + $product->order_product_tax) * $product->order_product_quantity;
}
$dispatcher->trigger('onAfterCalculateProductPriceForQuantityInOrder', array(&$order->products[$k]));
$order->order_subtotal_no_vat += $order->products[$k]->order_product_total_price_no_vat;
if (!empty($product->order_product_options)) {
$order->products[$k]->order_product_options = unserialize($product->order_product_options);
}
}
if ($additionalData) {
$this->getOrderAdditionalInfo($order);
}
return $order;
}
示例12: import
function import()
{
JRequest::checkToken('request') || die('Invalid Token');
$function = JRequest::getCmd('importfrom');
$this->helper->addTemplate(JRequest::getInt('template_product', 0));
switch ($function) {
case 'file':
$this->_file();
break;
case 'textarea':
$this->_textarea();
break;
case 'folder':
if (hikashop_level(2)) {
$this->_folder();
} else {
$app =& JFactory::getApplication();
$app->enqueueMessage(Text::_('ONLY_FROM_HIKASHOP_BUSINESS'), 'error');
}
break;
case 'vm':
$query = 'SHOW TABLES LIKE ' . $this->db->Quote($this->db->getPrefix() . substr(hikashop_table('virtuemart_products', false), 3));
$this->db->setQuery($query);
$table = $this->db->loadResult();
if (empty($table)) {
$query = 'SHOW TABLES LIKE ' . $this->db->Quote($this->db->getPrefix() . substr(hikashop_table('vm_product', false), 3));
$this->db->setQuery($query);
$table = $this->db->loadResult();
if (empty($table)) {
$app =& JFactory::getApplication();
$app->enqueueMessage('VirtueMart has not been found in the database', 'error');
} else {
$this->helperImport = hikashop_get('helper.import-vm1', $this);
$this->_vm();
}
} else {
$this->helperImport = hikashop_get('helper.import-vm2', $this);
$this->_vm();
}
break;
case 'mijo':
$this->helperImport = hikashop_get('helper.import-mijo', $this);
$query = 'SHOW TABLES LIKE ' . $this->db->Quote($this->db->getPrefix() . substr(hikashop_table('mijoshop_product', false), 3));
$this->db->setQuery($query);
$table = $this->db->loadResult();
if (empty($table)) {
$app =& JFactory::getApplication();
$app->enqueueMessage('Mijoshop has not been found in the database', 'error');
} else {
$this->_mijo();
}
break;
case 'redshop':
$this->helperImport = hikashop_get('helper.import-reds', $this);
$query = 'SHOW TABLES LIKE ' . $this->db->Quote($this->db->getPrefix() . substr(hikashop_table('redshop_product', false), 3));
$this->db->setQuery($query);
$table = $this->db->loadResult();
if (empty($table)) {
$app =& JFactory::getApplication();
$app->enqueueMessage('Redshop has not been found in the database', 'error');
} else {
$this->_redshop();
}
break;
case 'openc':
$this->helperImport = hikashop_get('helper.import-openc', $this);
$this->_opencart();
break;
default:
$plugin = hikashop_import('hikashop', $function);
if ($plugin) {
$plugin->onImportRun();
}
break;
}
return $this->show();
}
示例13: after_confirm
//.........这里部分代码省略.........
$order->{$key} = $val;
}
}
}
if (!empty($shippings)) {
if (count($shippings) == 1) {
$s = reset($shippings);
$order->order_shipping_id = $s['id'];
$order->order_shipping_method = $s['name'];
} else {
$ids = array();
foreach ($shippings as $key => $ship) {
$ids[] = $ship['id'] . '@' . $key;
}
$order->order_shipping_id = implode(';', $ids);
$order->order_shipping_method = '';
}
}
$paymentClass = hikashop_get('class.payment');
$paymentClass->checkPaymentOptions($order);
$orderClass = hikashop_get('class.order');
$order->order_id = $orderClass->save($order);
$removeCart = false;
if (empty($order->order_id)) {
return false;
}
$app->setUserState(HIKASHOP_COMPONENT . '.checkout_fields_ok', 0);
$entriesData = $app->getUserState(HIKASHOP_COMPONENT . '.entries_fields');
if (!empty($entriesData)) {
$entryClass = hikashop_get('class.entry');
foreach ($entriesData as $entryData) {
$entryData->order_id = $order->order_id;
$entryClass->save($entryData);
}
$app->setUserState(HIKASHOP_COMPONENT . '.entries_fields', null);
}
if (!empty($payment)) {
$query = 'SELECT * FROM ' . hikashop_table('payment') . ' WHERE payment_type=' . $db->Quote($payment);
$db->setQuery($query);
$paymentData = $db->loadObjectList('payment_id');
$pluginsClass->params($paymentData, 'payment');
} else {
$paymentData = null;
}
if (!empty($shipping)) {
$shippings_quoted = array();
foreach ($shippings as $ship) {
$shippings_quoted[] = $db->Quote($ship['name']);
}
$query = 'SELECT * FROM ' . hikashop_table('shipping') . ' WHERE shipping_type IN (' . implode(',', $shippings_quoted) . ')';
$db->setQuery($query);
$shippingData = $db->loadObjectList('shipping_id');
$pluginsClass->params($shippingData, 'shipping');
} else {
$shippingData = null;
}
ob_start();
if (!empty($shippingData)) {
foreach ($shippings as $ship) {
$data = hikashop_import('hikashopshipping', $ship['name']);
$data->onAfterOrderConfirm($order, $shippingData, $ship['id']);
if (!empty($data->removeCart)) {
$removeCart = true;
}
}
}
if (!empty($paymentData)) {
$data = hikashop_import('hikashoppayment', $payment);
$data->onAfterOrderConfirm($order, $paymentData, $payment_id);
if (!empty($data->removeCart)) {
$removeCart = true;
}
}
JRequest::setVar('hikashop_plugins_html', ob_get_clean());
$app->setUserState(HIKASHOP_COMPONENT . '.order_id', $order->order_id);
if ($config->get('clean_cart', 'order_created') == 'order_created' || $removeCart) {
$cart_id = $app->getUserState(HIKASHOP_COMPONENT . '.cart_id');
if ($cart_id) {
$class = hikashop_get('class.cart');
$class->delete($cart_id);
$app->setUserState(HIKASHOP_COMPONENT . '.cart_id', 0);
}
$app->setUserState(HIKASHOP_COMPONENT . '.coupon_code', '');
$app->setUserState(HIKASHOP_COMPONENT . '.cc_number', '');
$app->setUserState(HIKASHOP_COMPONENT . '.cc_month', '');
$app->setUserState(HIKASHOP_COMPONENT . '.cc_year', '');
$app->setUserState(HIKASHOP_COMPONENT . '.cc_CCV', '');
$app->setUserState(HIKASHOP_COMPONENT . '.cc_type', '');
$app->setUserState(HIKASHOP_COMPONENT . '.cc_owner', '');
$app->setUserState(HIKASHOP_COMPONENT . '.cc_valid', 0);
$app->setUserState(HIKASHOP_COMPONENT . '.checkout_terms', 0);
$app->setUserState(HIKASHOP_COMPONENT . '.checkout_fields_ok', 0);
$app->setUserState(HIKASHOP_COMPONENT . '.checkout_fields', null);
$user = JFactory::getUser();
if ($user->guest) {
$app->setUserState(HIKASHOP_COMPONENT . '.user_id', 0);
}
}
return true;
}
示例14: form
function form()
{
JHTML::_('behavior.modal');
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$task = JRequest::getVar('task');
$config = hikashop_config();
$this->assignRef('config', $config);
$toggle = hikashop_get('helper.toggle');
$this->assignRef('toggle', $toggle);
$popup = hikashop_get('helper.popup');
$this->assignRef('popup', $popup);
$this->content = '';
$this->plugin_name = JRequest::getCmd('name', '');
if (empty($this->plugin_name)) {
hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
return false;
}
$this->plugin_type = '';
$type = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.plugin_type', 'plugin_type', 'shipping');
if (in_array($type, array('shipping', 'payment', 'plugin'))) {
if ($type == 'plugin') {
$plugin = hikashop_import('hikashop', $this->plugin_name);
if (!is_subclass_of($plugin, 'hikashopPlugin')) {
if (!HIKASHOP_J16) {
$url = 'index.php?option=com_plugins&view=plugin&client=site&task=edit&cid[]=';
$db->setQuery("SELECT id FROM `#__plugins` WHERE `folder` = 'hikashop' and element=" . $db->Quote($this->plugin_name));
$plugin_id = $db->loadResult();
} else {
$url = 'index.php?option=com_plugins&task=plugin.edit&extension_id=';
$db->setQuery("SELECT extension_id as id FROM `#__extensions` WHERE `folder` = 'hikashop' AND `type`='plugin' AND element=" . $db->Quote($this->plugin_name));
$plugin_id = $db->loadResult();
}
$app->redirect($url . $plugin_id);
}
} else {
$plugin = hikashop_import('hikashop' . $type, $this->plugin_name);
}
if (!$plugin) {
hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
return false;
}
$this->plugin_type = $type;
} else {
hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
return false;
}
$multiple_plugin = false;
$multiple_interface = false;
if (method_exists($plugin, 'isMultiple')) {
$multiple_interface = true;
$multiple_plugin = $plugin->isMultiple();
}
$subtask = JRequest::getCmd('subtask', '');
if ($multiple_plugin && empty($subtask)) {
$querySelect = array();
$queryFrom = array();
$queryWhere = array();
$filters = array();
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onHikaPluginListing', array($type, &$querySelect, &$queryFrom, &$queryWhere, &$filters));
if (!empty($querySelect)) {
$querySelect = ', ' . implode(',', $querySelect);
} else {
$querySelect = '';
}
if (!empty($queryFrom)) {
$queryFrom = ', ' . implode(',', $queryFrom);
} else {
$queryFrom = '';
}
if (!empty($queryWhere)) {
$queryWhere = ' AND (' . implode(') AND (', $queryWhere) . ') ';
} else {
$queryWhere = '';
}
$this->assignRef('filters', $filters);
} else {
$querySelect = '';
$queryFrom = '';
$queryWhere = '';
}
$query = 'SELECT plugin.* ' . $querySelect . ' FROM ' . hikashop_table($this->plugin_type) . ' as plugin ' . $queryFrom . ' WHERE (plugin.' . $this->plugin_type . '_type = ' . $db->Quote($this->plugin_name) . ') ' . $queryWhere . ' ORDER BY plugin.' . $this->plugin_type . '_ordering ASC';
$db->setQuery($query);
$elements = $db->loadObjectList($this->plugin_type . '_id');
if (!empty($elements)) {
$params_name = $this->plugin_type . '_params';
foreach ($elements as $k => $el) {
if (!empty($el->{$params_name})) {
$elements[$k]->{$params_name} = unserialize($el->{$params_name});
}
}
}
$function = 'pluginConfiguration';
$ctrl = '&plugin_type=' . $this->plugin_type . '&task=' . $task . '&name=' . $this->plugin_name;
if ($multiple_plugin === true) {
$subtask = JRequest::getCmd('subtask', '');
$ctrl .= '&subtask=' . $subtask;
if (empty($subtask)) {
//.........这里部分代码省略.........
示例15: pay
function pay()
{
if (!$this->_check()) {
return false;
}
$order_id = hikashop_getCID('order_id');
if (empty($order_id)) {
parent::listing();
return false;
}
$class = hikashop_get('class.order');
$order = $class->loadFullOrder($order_id, true);
if (empty($order->order_id)) {
$app =& JFactory::getApplication();
$app->enqueueMessage('The order ' . $order_id . ' could not be found');
parent::listing();
return false;
}
$config =& hikashop_config();
$unpaid_statuses = explode(',', $config->get('order_unpaid_statuses', 'created'));
if (!in_array($order->order_status, $unpaid_statuses)) {
$app =& JFactory::getApplication();
$app->enqueueMessage('The order ' . $order->order_number . ' cannot be paid anymore.');
parent::listing();
return false;
}
if (empty($order->order_currency_id)) {
$null = new stdClass();
$null->order_currency_id = hikashop_getCurrency();
$null->order_id = $order->order_id;
$order->order_currency_id = $null->order_currency_id;
$class->save($null);
}
$new_payment_method = JRequest::getVar('new_payment_method', '');
$config =& hikashop_config();
if ($config->get('allow_payment_change', 1) && !empty($new_payment_method)) {
$new_payment_method = explode('_', $new_payment_method);
$payment_id = array_pop($new_payment_method);
$payment_method = implode('_', $new_payment_method);
if ($payment_id != $order->order_payment_id || $payment_method != $order->order_payment_method) {
$updateOrder = new stdClass();
$updateOrder->order_id = $order->order_id;
$updateOrder->order_payment_id = $payment_id;
$updateOrder->order_payment_method = $payment_method;
$paymentClass = hikashop_get('class.payment');
$payment = $paymentClass->get($payment_id);
if (!empty($payment->payment_params) && is_string($payment->payment_params)) {
$payment->payment_params = unserialize($payment->payment_params);
}
$full_price_without_payment = $order->order_full_price - $order->order_payment_price;
$new_payment = $payment;
$new_payment_price = $paymentClass->computePrice($order, $new_payment, $full_price_without_payment, @$payment->payment_price, hikashop_getCurrency());
$new_payment_tax = @$new_payment->payment_tax;
$updateOrder->order_payment_price = $new_payment_price;
$updateOrder->order_full_price = $full_price_without_payment + $new_payment_price + $new_payment_tax;
$updateOrder->history = new stdClass();
$updateOrder->history->history_payment_id = $payment_id;
$updateOrder->history->history_payment_method = $payment_method;
$class->save($updateOrder);
$order->order_payment_id = $payment_id;
$order->order_payment_method = $payment_method;
$order->order_payment_price = $updateOrder->order_payment_price;
$order->order_full_price = $updateOrder->order_full_price;
}
}
$userClass = hikashop_get('class.user');
$order->customer = $userClass->get($order->order_user_id);
$db = JFactory::getDBO();
$query = 'SELECT * FROM ' . hikashop_table('payment') . ' WHERE payment_type=' . $db->Quote($order->order_payment_method);
$db->setQuery($query);
$paymentData = $db->loadObjectList('payment_id');
$pluginsClass = hikashop_get('class.plugins');
$pluginsClass->params($paymentData, 'payment');
if (empty($paymentData)) {
$app =& JFactory::getApplication();
$app->enqueueMessage('The payment method ' . $order->order_payment_method . ' could not be found');
parent::listing();
return false;
}
$order->cart =& $order;
$order->cart->coupon = new stdClass();
$price = new stdClass();
$price->price_value_with_tax = $order->order_full_price;
$order->cart->full_total = new stdClass();
$order->cart->full_total->prices = array($price);
$price2 = new stdClass();
$total = 0;
$class = hikashop_get('class.currency');
$order->cart->total = new stdClass();
$price2 = $class->calculateTotal($order->products, $order->cart->total, $order->order_currency_id);
$order->cart->coupon->discount_value =& $order->order_discount_price;
$shippingClass = hikashop_get('class.shipping');
$methods = $shippingClass->getMethods($order->cart);
$data = hikashop_import('hikashopshipping', $order->order_shipping_method);
if (!empty($data)) {
$order->cart->shipping = $data->onShippingSave($order->cart, $methods, $order->order_shipping_id);
}
$app = JFactory::getApplication();
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_address', $order->order_shipping_address_id);
$app->setUserState(HIKASHOP_COMPONENT . '.billing_address', $order->order_billing_address_id);
//.........这里部分代码省略.........