コード例 #1
0
ファイル: address.php プロジェクト: q0821/esportshop
 function edit()
 {
     $tmpl = JRequest::getCmd('tmpl', '');
     $subtask = JRequest::getCmd('subtask', '');
     $addrtype = JRequest::getCmd('address_type', '');
     $config = hikashop_config();
     if ($tmpl == 'component' && ($addrtype != '' || $subtask != '') && $config->get('checkout_address_selector', 0)) {
         JRequest::setVar('hidemainmenu', 1);
         JRequest::setVar('layout', 'show');
         JRequest::setVar('edition', true);
         ob_end_clean();
         if (HIKASHOP_J25) {
             $app = JFactory::getApplication();
             $messages = $app->getMessageQueue();
             if (!empty($messages)) {
                 foreach ($messages as $message) {
                     hikashop_display($message['message'], 'error');
                 }
             }
         }
         parent::display();
         exit;
     }
     parent::edit();
 }
コード例 #2
0
ファイル: cron.php プロジェクト: q0821/esportshop
 function cron()
 {
     $config =& hikashop_config();
     if ($config->get('cron') == 'no') {
         hikashop_display(JText::_('CRON_DISABLED'), 'info');
         return false;
     }
     $cronHelper = hikashop_get('helper.cron');
     $cronHelper->report = true;
     $launched = $cronHelper->cron();
     if ($launched) {
         $cronHelper->report();
     }
 }
コード例 #3
0
 /**
  *  To include the library envoimoinscher
  */
 function init()
 {
     static $init = null;
     if ($init !== null) {
         return $init;
     }
     try {
         include_once dirname(__FILE__) . DS . 'lib' . DS . 'envoimoinscher.php';
         $init = true;
     } catch (Exception $e) {
         $app = JFactory::getApplication();
         if ($app->isAdmin()) {
             hikashop_display($e->getMessage());
         }
         $init = false;
     }
     return $init;
 }
コード例 #4
0
ファイル: stripe.php プロジェクト: rodhoff/MNW
 function init()
 {
     static $init = null;
     if ($init !== null) {
         return $init;
     }
     try {
         include_once HIKASHOP_ROOT . 'plugins/hikashoppayment/stripe/lib/Stripe.php';
         $init = true;
     } catch (Exception $e) {
         $app = JFactory::getApplication();
         if ($app->isAdmin()) {
             hikashop_display($e->getMessage());
         }
         $init = false;
     }
     return $init;
 }
コード例 #5
0
ファイル: vat.php プロジェクト: q0821/esportshop
 function onlineCheck($vat)
 {
     JPluginHelper::importPlugin('hikashop');
     $dispatcher = JDispatcher::getInstance();
     $processed = false;
     $rc = $dispatcher->trigger('onBeforeVATOnlineCheck', array(&$this, &$processed, &$vat));
     if ($processed) {
         return $rc;
     }
     if (extension_loaded('soap')) {
         try {
             $client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
             $countryCode = substr($vat, 0, 2);
             $result = $client->checkVat(array('countryCode' => $countryCode, 'vatNumber' => substr($vat, 2)));
             if (empty($result) || !$result->valid) {
                 $this->message = JText::_('VAT_NUMBER_NOT_VALID');
             }
         } catch (SoapFault $e) {
             $this->message = $e->__toString();
             return true;
         } catch (Exception $e) {
             $this->message = $e->__toString();
             return true;
         }
         if ($result === false || empty($result) || !$result->valid) {
             $app = JFactory::getApplication();
             if ($_REQUEST['tmpl'] == 'component') {
                 hikashop_display($this->message, 'error');
             } else {
                 $app->enqueueMessage($this->message);
             }
             return false;
         }
     } else {
         $app = JFactory::getApplication();
         $this->message = JText::_('SOAP_EXTENSION_NOT_FOUND');
         if ($_REQUEST['tmpl'] == 'component') {
             hikashop_display($this->message, 'error');
         } else {
             $app->enqueueMessage($this->message);
         }
         return false;
     }
     return true;
 }
コード例 #6
0
ファイル: form.php プロジェクト: q0821/esportshop
	</div>
	<?php 
    echo implode('', $table->actions_html);
    ?>
</div>
<?php 
}
?>
<form action="index.php?option=<?php 
echo HIKASHOP_COMPONENT;
?>
&ctrl=massaction" method="post" autocomplete="off" enctype="multipart/form-data" name="adminForm" id="adminForm">
<?php 
if (JRequest::getCmd('tmpl') == 'component') {
    if (empty($this->data_id)) {
        hikashop_display(JText::_('PLEASE_SELECT_' . strtoupper($this->data_table)), 'warning');
        return;
    }
    ?>
	<input type="hidden" name="data_id" value="<?php 
    echo $this->data_id;
    ?>
" />
	<input type="hidden" name="tmpl" value="component" />
	<fieldset>
		<div class="hikaheader icon-48-hikaaction" style="float: left;"><?php 
    echo JText::_('ACTIONS');
    ?>
</div>
		<div class="toolbar" id="toolbar" style="float: right;">
			<table><tr>
コード例 #7
0
ファイル: share.php プロジェクト: rodhoff/MNW
" method="post"  name="adminForm" id="adminForm" >
	<fieldset>
		<div class="hikashop_header" style="float: left;"><?php 
echo JText::_('SHARE') . ' : ' . $this->file->name;
?>
</div>
		<div class="toolbar" id="toolbar" style="float: right;">
			<button class="btn" type="button" onclick="javascript:submitbutton('send')"><?php 
echo JText::_('SHARE');
?>
</button>
		</div>
	</fieldset>
	<fieldset class="adminform">
		<?php 
hikashop_display(JText::_('SHARE_HIKASHOP_CONFIRMATION_1') . '<br/>' . JText::_('SHARE_HIKASHOP_CONFIRMATION_2') . '<br/>' . JText::_('SHARE_CONFIRMATION_3'), 'info');
?>
<br/>
		<textarea cols="100" rows="8" name="mailbody">Hi Hikari Software team,
Here is a new version of the language file, I translated few more strings...</textarea>
	</fieldset>
	<div class="clr"></div>
	<input type="hidden" name="code" value="<?php 
echo $this->file->name;
?>
" />
	<input type="hidden" name="option" value="<?php 
echo HIKASHOP_COMPONENT;
?>
" />
	<input type="hidden" name="task" value="" />
コード例 #8
0
ファイル: kashflow.php プロジェクト: rodhoff/MNW
 private function initConnection()
 {
     $app = JFactory::getApplication();
     if (!class_exists('SoapClient')) {
         hikashop_display('Please Activate the SOAP PHP extension on your web server in order to use the Kashflow plugin. Please ask your hosting company if you don\'t know how to change your php.ini in order to do that.', 'error');
         return false;
     }
     include_once dirname(__FILE__) . DS . 'library' . DS . 'kashflow.inc.php';
     if (empty($this->params['password']) || empty($this->params['username'])) {
         $app->enqueueMessage('Please configure your KashFlow plugin via the Joomla plugins manager');
         return false;
     }
     try {
         $this->kashflow = new Kashflow($this->params['username'], $this->params['password']);
     } catch (Exception $e) {
         hikashop_display('KashFlow error: ' . $e->getMessage(), 'error');
         return false;
     }
     return true;
 }
コード例 #9
0
ファイル: cron.php プロジェクト: q0821/esportshop
 function cron()
 {
     $time = time();
     $config =& hikashop_config();
     $firstMessage = JText::sprintf('CRON_TRIGGERED', hikashop_getDate(time()));
     $this->messages[] = $firstMessage;
     if ($this->report) {
         hikashop_display($firstMessage, 'info');
     }
     if ($config->get('cron_next') > $time) {
         if ($config->get('cron_next') > $time + $config->get('cron_frequency')) {
             $newConfig = new stdClass();
             $newConfig->cron_next = $time + $config->get('cron_frequency');
             $config->save($newConfig);
         }
         $nottime = JText::sprintf('CRON_NEXT', hikashop_getDate($config->get('cron_next')));
         $this->messages[] = $nottime;
         if ($this->report) {
             hikashop_display($nottime, 'info');
         }
         $sendreport = $config->get('cron_sendreport');
         if ($sendreport == 1) {
             $mailer = hikashop_get('class.mail');
             $data = new stdClass();
             $data->report = implode('<br/>', $this->messages);
             $data->detailreport = '';
             $mail = $mailer->get('cron_report', $data);
             $mail->subject = JText::_($mail->subject);
             $receiverString = $config->get('cron_sendto');
             $receivers = explode(',', $receiverString);
             if (!empty($receivers)) {
                 foreach ($receivers as $oneReceiver) {
                     $mail->dst_email = $oneReceiver;
                     $mailer->sendMail($mail);
                 }
             }
         }
         return false;
     }
     $newConfig = new stdClass();
     $newConfig->cron_next = $config->get('cron_next') + $config->get('cron_frequency');
     if ($newConfig->cron_next <= $time || $newConfig->cron_next > $time + $config->get('cron_frequency')) {
         $newConfig->cron_next = $time + $config->get('cron_frequency');
     }
     $newConfig->cron_last = $time;
     $newConfig->cron_fromip = hikashop_getIP();
     $config->save($newConfig);
     JPluginHelper::importPlugin('hikashoppayment');
     JPluginHelper::importPlugin('hikashopshipping');
     JPluginHelper::importPlugin('hikashop');
     $dispatcher = JDispatcher::getInstance();
     $resultsTrigger = array();
     $dispatcher->trigger('onHikashopCronTrigger', array(&$resultsTrigger));
     if ($this->report) {
         foreach ($resultsTrigger as $message) {
             hikashop_display($message, 'info');
         }
     }
     $this->detailMessages = $resultsTrigger;
     return true;
 }
コード例 #10
0
ファイル: fedex.php プロジェクト: ASDAFF/hikashop-fedex
    function onShippingConfiguration(&$element)
    {
        $config =& hikashop_config();
        $this->main_currency = $config->get('main_currency', 1);
        $currencyClass = hikashop_get('class.currency');
        $currency = hikashop_get('class.currency');
        $this->currencyCode = $currency->get($this->main_currency)->currency_code;
        $this->currencySymbol = $currency->get($this->main_currency)->currency_symbol;
        $this->fedex = JRequest::getCmd('name', 'fedex');
        $this->categoryType = hikashop_get('type.categorysub');
        $this->categoryType->type = 'tax';
        $this->categoryType->field = 'category_id';
        parent::onShippingConfiguration($element);
        $elements = array($element);
        $key = key($elements);
        if (empty($elements[$key]->shipping_params->lang_file_override)) {
            jimport('joomla.filesystem.file');
            jimport('joomla.filesystem.folder');
            $folder = JLanguage::getLanguagePath(JPATH_ROOT) . DS . 'overrides';
            $path = $folder . DS . 'en-GB.override.ini';
            $content_override = '';
            if (JFile::exists($path)) {
                $content_override = JFile::read($path);
            }
            $content_override .= '
FEDEX_METER_ID="Meter #"' . '
FEDEX_ACCOUNT_NUMBER="Account #"' . '
FEDEX_API_KEY="API Key"' . '
FEDEX_API_PASSWORD="******"' . '
FEDEX_SHOW_ETA="Show ETA?"' . '
FEDEX_SHOW_ETA_FORMAT="ETA Format"' . '
PACKAGING_TYPE="Packaging Type"' . '
BOX_DIMENSIONS="Box Dimensions"' . '
ORIGINATION_POSTCODE="Ship From Postcode"' . '
SENDER_COMPANY="Sender Company"' . '
SENDER_PHONE="Sender Phone"' . '
SENDER_ADDRESS="Sender Address"' . '
SENDER_CITY="Sender City"' . '
SENDER_STATE="Sender State"' . '
SENDER_POSTCODE="Sender Zip"';
            if (!JFolder::exists($folder)) {
                JFolder::create($folder);
            }
            if (JFolder::exists($folder)) {
                $path = $folder . DS . 'en-GB.override.ini';
                $result = JFile::write($path, $content_override);
                if (!$result) {
                    hikashop_display(JText::sprintf('FAIL_SAVE', $path), 'error');
                } else {
                    $elements[$key]->shipping_params->lang_file_override = 1;
                }
            }
        }
        $js = "\r\n\t\t\tfunction checkAllBox(id, type){\r\n\t\t\t\tvar toCheck = document.getElementById(id).getElementsByTagName('input');\r\n\t\t\t\tfor (i = 0 ; i < toCheck.length ; i++) {\r\n\t\t\t\t\tif (toCheck[i].type == 'checkbox') {\r\n\t\t\t\t\t\tif(type == 'check'){\r\n\t\t\t\t\t\t\ttoCheck[i].checked = true;\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\ttoCheck[i].checked = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}";
        if (!HIKASHOP_PHP5) {
            $doc =& JFactory::getDocument();
        } else {
            $doc = JFactory::getDocument();
        }
        $doc->addScriptDeclaration("<!--\n" . $js . "\n//-->\n");
    }
コード例 #11
0
<?php

try {
    include_once dirname(__FILE__) . DS . 'lib' . DS . 'envoimoinscher.php';
} catch (Exception $e) {
    hikashop_display($e->getMessage());
}
?>
<input type="hidden" name="lang_file_override" value="<?php 
echo @$this->element->shipping_params->lang_file_override;
?>
" />
	<tr>
		<td class="key">
			<label for="data[shipping][shipping_params][emc_login]">
				<?php 
echo JText::_('HIKA_LOGIN');
?>
			</label>
		</td>
		<td>
			<input type="text" name="data[shipping][shipping_params][emc_login]" value="<?php 
echo @$this->element->shipping_params->emc_login;
?>
" />
		</td>
	</tr>
	<tr>
		<td class="key">
			<label for="data[shipping][shipping_params][emc_password]">
				<?php 
コード例 #12
0
<?php

/**
 * @package	HikaShop for Joomla!
 * @version	2.6.0
 * @author	hikashop.com
 * @copyright	(C) 2010-2015 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<html>
	<head>
<?php 
$doc = JFactory::getDocument();
$head = $doc->loadRenderer('head');
if (HIKASHOP_J30) {
    echo $head->render('');
} else {
    echo $head->render();
}
?>
	</head>
	<body>
		<?php 
echo hikashop_display(JText::_('RESSOURCE_NOT_ALLOWED'), 'error');
?>
	</body>
</html>
<?php 
exit;
コード例 #13
0
ファイル: view.html.php プロジェクト: q0821/esportshop
 function css()
 {
     $file = JRequest::getCmd('file');
     if (!preg_match('#^([-_A-Za-z0-9]*)_([-_A-Za-z0-9]*)$#i', $file, $result)) {
         hikashop_display('Could not load the file ' . $file . ' properly');
         exit;
     }
     $type = $result[1];
     $fileName = $result[2];
     $content = JRequest::getString('csscontent');
     if (empty($content)) {
         $content = file_get_contents(HIKASHOP_MEDIA . 'css' . DS . $type . '_' . $fileName . '.css');
     }
     if (in_array($fileName, array('default', 'old'))) {
         $fileName = 'custom';
         $i = 1;
         while (file_exists(HIKASHOP_MEDIA . 'css' . DS . $type . '_' . $fileName . '.css')) {
             $fileName = 'custom' . $i;
             $i++;
         }
     }
     $this->assignRef('content', $content);
     $this->assignRef('fileName', $fileName);
     $this->assignRef('type', $type);
     $editor = hikashop_get('helper.editor');
     $this->assignRef('editor', $editor);
 }
コード例 #14
0
ファイル: massaction.php プロジェクト: q0821/esportshop
 function process()
 {
     if (!empty($_POST)) {
         $this->store();
     }
     $massactionClass = hikashop_get('class.massaction');
     $massaction = $massactionClass->get(JRequest::getInt('cid'));
     $elements = array();
     ob_start();
     $massactionClass->process($massaction, $elements);
     $html = ob_get_clean();
     $_POST['html_results'] = $html;
     if (!empty($massactionClass->report)) {
         if (JRequest::getCmd('tmpl') == 'component') {
             echo hikashop_display($massactionClass->report, 'info');
             $js = "setTimeout('redirect()',2000); function redirect(){window.top.location.href = 'index.php?option=com_hikashop&ctrl=massaction'; }";
             $doc = JFactory::getDocument();
             $doc->addScriptDeclaration($js);
             return;
         } else {
             $app = JFactory::getApplication();
             foreach ($massactionClass->report as $oneReport) {
                 $app->enqueueMessage($oneReport);
             }
         }
     }
     return $this->edit();
 }
コード例 #15
0
ファイル: update.php プロジェクト: rodhoff/MNW
 function installMenu($code = '')
 {
     if (empty($code)) {
         $lang = JFactory::getLanguage();
         $code = $lang->getTag();
     }
     $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_hikashop.ini';
     if (!file_exists($path)) {
         return;
     }
     $content = file_get_contents($path);
     if (empty($content)) {
         return;
     }
     $menuFileContent = 'COM_HIKASHOP="HikaShop"' . "\r\n" . 'HIKASHOP="HikaShop"' . "\r\n";
     $menuStrings = array('PRODUCTS', 'CATEGORIES', 'USERS', 'ORDERS', 'CONFIGURATION', 'DISCOUNTS', 'HELP', 'UPDATE_ABOUT');
     foreach ($menuStrings as $oneString) {
         preg_match('#(\\n|\\r)(HIKA_)?' . $oneString . '="(.*)"#i', $content, $matches);
         if (empty($matches[3])) {
             continue;
         }
         if (version_compare(JVERSION, '1.6.0', '<')) {
             $menuFileContent .= 'COM_HIKASHOP.' . $oneString . '="' . $matches[3] . '"' . "\r\n";
         } else {
             $menuFileContent .= $oneString . '="' . $matches[3] . '"' . "\r\n";
         }
     }
     preg_match_all('#(\\n|\\r)(COM_HIKASHOP_.*)="(.*)"#iU', $content, $matches);
     if (!empty($matches)) {
         $menuFileContent .= implode('', $matches[0]);
     }
     $menuFileContent .= "\r\n" . 'COM_HIKASHOP_CONFIGURATION="HikaShop"';
     if (version_compare(JVERSION, '1.6.0', '<')) {
         $menuPath = HIKASHOP_ROOT . 'administrator' . DS . 'language' . DS . $code . DS . $code . '.com_hikashop.menu.ini';
         if (!JFile::write($menuPath, $menuFileContent)) {
             hikashop_display(JText::sprintf('FAIL_SAVE', $menuPath), 'error');
         }
         $menuPath = HIKASHOP_ROOT . 'administrator' . DS . 'language' . DS . $code . DS . $code . '.com_hikashop.ini';
     } else {
         $menuPath = HIKASHOP_ROOT . 'administrator' . DS . 'language' . DS . $code . DS . $code . '.com_hikashop.sys.ini';
     }
     if (!JFile::write($menuPath, $menuFileContent)) {
         hikashop_display(JText::sprintf('FAIL_SAVE', $menuPath), 'error');
     }
 }
コード例 #16
0
ファイル: notice.php プロジェクト: rodhoff/MNW
<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"');
    ?>
	</div>
	<?php 
    if ($cart_type == 'wishlist') {
        ?>
	<div id="hikashop_add_to_cart_checkout_div">
		<?php 
        if ($wishlist_id != 0) {
コード例 #17
0
ファイル: hikashoppayment.php プロジェクト: q0821/esportshop
 protected function processCronNotification()
 {
     if (!(include_once rtrim(JPATH_ADMINISTRATOR, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_hikashop' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'helper.php')) {
         return;
     }
     $config =& hikashop_config();
     if ($config->get('cron') == 'no') {
         hikashop_display(JText::_('CRON_DISABLED'), 'info');
         return false;
     }
     $cronHelper = hikashop_get('helper.cron');
     $cronHelper->report = true;
     $launched = $cronHelper->cron();
     if ($launched) {
         $cronHelper->report();
     }
     exit;
 }
コード例 #18
0
ファイル: config.php プロジェクト: q0821/esportshop
 function _savelanguage()
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $code = JRequest::getString('code');
     JRequest::setVar('code', $code);
     $content = JRequest::getVar('content', '', '', 'string', JREQUEST_ALLOWRAW);
     if (empty($code)) {
         return;
     }
     $content_override = JRequest::getVar('content_override', '', '', 'string', JREQUEST_ALLOWRAW);
     $folder = JLanguage::getLanguagePath(JPATH_ROOT) . DS . 'overrides';
     jimport('joomla.filesystem.folder');
     if (!JFolder::exists($folder)) {
         JFolder::create($folder);
     }
     if (JFolder::exists($folder)) {
         $path = $folder . DS . $code . '.override.ini';
         if (!JPath::check($path)) {
             hikashop_display(JText::sprintf('FAIL_SAVE', 'invalid filename'), 'error');
             return false;
         }
         $result = JFile::write($path, $content_override);
         if (!$result) {
             hikashop_display(JText::sprintf('FAIL_SAVE', $path), 'error');
         }
     }
     if (empty($content)) {
         return;
     }
     $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_hikashop.ini';
     if (!JPath::check($path)) {
         hikashop_display(JText::sprintf('FAIL_SAVE', 'invalid filename'), 'error');
         return false;
     }
     $result = JFile::write($path, $content);
     if ($result) {
         hikashop_display(JText::_('HIKASHOP_SUCC_SAVED'), 'success');
         $updateHelper = hikashop_get('helper.update');
         $updateHelper->installMenu($code);
         $js = "window.top.document.getElementById('image{$code}').src = '" . HIKASHOP_IMAGES . "icons/icon-16-edit.png'";
         $doc = JFactory::getDocument();
         $doc->addScriptDeclaration($js);
     } else {
         hikashop_display(JText::sprintf('FAIL_SAVE', $path), 'error');
     }
     return $result;
 }
コード例 #19
0
ファイル: update.php プロジェクト: q0821/esportshop
 function wizard_save()
 {
     $layoutType = JRequest::getVar('layout_type');
     $currency = JRequest::getVar('currency');
     $taxName = JRequest::getVar('tax_name');
     $taxRate = JRequest::getVar('tax_rate');
     $addressCountry = JRequest::getVar('address_country');
     $data = JRequest::getVar('data', array(), '', 'array');
     $addressState = !empty($data['address']['address_state']) ? $data['address']['address_state'] : '';
     $shopAddress = JRequest::getVar('shop_address');
     $paypalEmail = JRequest::getVar('paypal_email');
     $productType = JRequest::getVar('product_type');
     $dataExample = JRequest::getVar('data_sample');
     $ratePlugin = hikashop_import('hikashop', 'rates');
     if ($ratePlugin) {
         $ratePlugin->updateRates();
     }
     $db = JFactory::getDBO();
     foreach ($_POST as $key => $data) {
         if ($data == '0') {
             continue;
         }
         if (preg_match('#menu#', $key)) {
             // menu
             if (preg_match('#categories#', $key)) {
                 $alias = 'hikashop-menu-for-categories-listing';
             } else {
                 $alias = 'hikashop-menu-for-products-listing';
             }
             $db->setQuery('SELECT * FROM ' . hikashop_table('menu', false) . ' WHERE `alias` = ' . $db->Quote($alias));
             $data = $db->loadAssoc();
             $db->setQuery('SELECT `menutype` FROM ' . hikashop_table('menu', false) . ' WHERE `home` = 1');
             $menutype = $db->loadResult();
             $data['menutype'] = $menutype;
             $menuTable = JTable::getInstance('Menu', 'JTable', array());
             if (is_object($menuTable)) {
                 $menuTable->save($data);
                 if (method_exists($menuTable, 'rebuild')) {
                     $menuTable->rebuild();
                 }
             }
         } elseif (preg_match('#module#', $key)) {
             // module
             if (preg_match('#categories#', $key)) {
                 $db->setQuery('UPDATE ' . hikashop_table('modules', false) . ' SET `published` = 1 WHERE `title` = ' . $db->Quote('Categories on 2 levels'));
                 $db->query();
             }
         }
     }
     $db->setQuery('SELECT `config_value` FROM ' . hikashop_table('config') . ' WHERE `config_namekey` = "default_params"');
     $oldDefaultParams = $db->loadResult();
     $oldDefaultParams = unserialize(base64_decode($oldDefaultParams));
     $oldDefaultParams['layout_type'] = preg_replace('#listing_#', '', $layoutType);
     $defaultParams = base64_encode(serialize($oldDefaultParams));
     if ($addressCountry == 'country_United_States_of_America_223') {
         $main_zone = $addressState;
     } else {
         $main_zone = $addressCountry;
     }
     $zoneClass = hikashop_get('class.zone');
     $zone = $zoneClass->get($main_zone);
     $db->setQuery('REPLACE INTO ' . hikashop_table('config') . ' (config_namekey, config_value) VALUES ("main_tax_zone", ' . $db->Quote($zone->zone_id) . '), ("store_address", ' . $db->Quote($shopAddress) . '), ("main_currency", ' . $db->Quote($currency) . '), ("default_params", ' . $db->Quote($defaultParams) . ')');
     $db->query();
     $db->setQuery('UPDATE ' . hikashop_table('field') . ' SET `field_default` = ' . $db->Quote($addressState) . ' WHERE field_namekey = "address_state"');
     $db->query();
     $db->setQuery('UPDATE ' . hikashop_table('field') . ' SET `field_default` = ' . $db->Quote($addressCountry) . ' WHERE field_namekey = "address_country"');
     $db->query();
     $import_language = JRequest::getVar('import_language');
     if ($import_language != '0') {
         if (preg_match('#_#', $import_language)) {
             $languages = explode('_', $import_language);
         } else {
             $languages = array($import_language);
         }
         $updateHelper = hikashop_get('helper.update');
         foreach ($languages as $code) {
             $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_hikashop.ini';
             jimport('joomla.filesystem.file');
             if (!JFile::exists($path)) {
                 $url = str_replace('https://', 'http://', HIKASHOP_UPDATEURL . 'languageload&raw=1&code=' . $code);
                 $data = '';
                 if (function_exists('curl_version')) {
                     $ch = curl_init();
                     $timeout = 5;
                     curl_setopt($ch, CURLOPT_URL, $url);
                     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
                     $data = curl_exec($ch);
                     curl_close($ch);
                 } else {
                     $data = file_get_contents($url);
                 }
                 if (!empty($data)) {
                     $result = JFile::write($path, $data);
                     if ($result) {
                         $updateHelper->installMenu($code);
                         hikashop_display(JText::_('HIKASHOP_SUCC_SAVED'), 'success');
                     } else {
                         hikashop_display(JText::sprintf('FAIL_SAVE', $path), 'error');
                     }
                 } else {
                     hikashop_display(JText::sprintf('CANT_GET_LANGUAGE_FILE_CONTENT', $path), 'error');
                 }
             }
         }
     }
     if (isset($taxRate) && (!empty($taxRate) || $taxRate != '0')) {
         $taxRate = (double) $taxRate / 100;
         $db->setQuery('REPLACE INTO ' . hikashop_table('tax') . ' (tax_namekey,tax_rate) VALUES (' . $db->Quote($taxName) . ',' . (double) $taxRate . ')');
         $db->query();
         $db->setQuery('SELECT `taxation_id` FROM ' . hikashop_table('taxation') . ' ORDER BY `taxation_id` DESC LIMIT 0,1');
         $maxId = $db->loadResult();
         if (is_null($maxId)) {
             $maxId = 1;
         } else {
             $maxId = (int) $maxId + 1;
         }
         $tax = array();
         $tax['taxation_id'] = (int) $maxId;
         if ($addressCountry == 'country_United_States_of_America_223') {
             $tax['zone_namekey'] = $db->Quote($addressState);
         } else {
             $tax['zone_namekey'] = $db->Quote($addressCountry);
         }
         $tax['category_namekey'] = $db->Quote('default_tax');
         $tax['tax_namekey'] = $db->Quote($taxName);
         $tax['taxation_published'] = 1;
         $tax['taxation_type'] = $db->Quote('');
         $tax['taxation_access'] = $db->Quote('all');
         $tax['taxation_cumulative'] = 0;
         $tax['taxation_post_code'] = $db->Quote('');
         $tax['taxation_date_start'] = 0;
         $tax['taxation_date_end'] = 0;
         $tax['taxation_internal_code'] = 0;
         $tax['taxation_note'] = $db->Quote('');
         $query = 'INSERT INTO ' . hikashop_table('taxation') . ' (' . implode(',', array_keys($tax)) . ') VALUES (' . implode(',', $tax) . ')';
         $db->setQuery($query);
         $db->query();
     }
     if (isset($paypalEmail) && !empty($paypalEmail)) {
         $pluginData = array('payment' => array('payment_name' => 'PayPal', 'payment_published' => '1', 'payment_images' => 'MasterCard,VISA,Credit_card,PayPal', 'payment_price' => '', 'payment_params' => array('url' => 'https://www.paypal.com/cgi-bin/webscr', 'email' => $paypalEmail), 'payment_zone_namekey' => '', 'payment_access' => 'all', 'payment_id' => '0', 'payment_type' => 'paypal'));
         JRequest::setVar('name', 'paypal');
         JRequest::setVar('plugin_type', 'payment');
         JRequest::setVar('data', $pluginData);
         $pluginsController = hikashop_get('controller.plugins');
         $pluginsController->store(true);
     }
     if (isset($productType) && !empty($productType)) {
         if ($productType == 'real') {
             $forceShipping = 1;
         } else {
             $forceShipping = 0;
         }
         $db->setQuery('REPLACE INTO ' . hikashop_table('config') . ' (config_namekey, config_value) VALUES ("force_shipping", ' . (int) $forceShipping . ')');
         $db->query();
         if ($productType == 'virtual') {
             $product_type = 'virtual';
         } else {
             $product_type = 'shippable';
         }
         $db->setQuery('REPLACE INTO ' . hikashop_table('config') . ' (config_namekey, config_value) VALUES ("default_product_type", ' . (int) $product_type . ')');
         $db->query();
     }
     if ($dataExample == 1) {
         $app = JFactory::getApplication();
         $app->setUserState('WIZARD_DATA_SAMPLE_PAYPAL', $paypalEmail);
         $app->redirect('index.php?option=com_hikashop&ctrl=update&task=process_data_save&step=1&' . hikashop_getFormToken() . '=1');
     }
     $url = 'index.php?option=com_hikashop&ctrl=product&task=add';
     $this->setRedirect($url);
 }
コード例 #20
0
ファイル: taxcloud.php プロジェクト: rodhoff/MNW
 protected function lookupAfterOrderCreate(&$order)
 {
     if (!$this->initSoap()) {
         return false;
     }
     $cart = $order->cart;
     $address = $this->loadAddress();
     if (empty($address)) {
         $address = $order->cart->shipping_address;
     }
     $app = JFactory::getApplication();
     if (!$this->loadOptions()) {
         return false;
     }
     $parameters = array('uspsUserID' => $this->plugin_options['usps_id'], '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' => '');
     $ret = $this->soap->__soapCall('verifyAddress', array($parameters));
     try {
         $ret = $this->soap->__soapCall('verifyAddress', array($parameters));
     } catch (Exception $e) {
         $ret = false;
     }
     if (!empty($ret) && !empty($ret->VerifyAddressResult)) {
         $errNumber = $ret->VerifyAddressResult->ErrNumber;
         if ($errNumber === '0') {
             $usps_address = array('Address1' => $ret->VerifyAddressResult->Address1, 'Address2' => @$ret->VerifyAddressResult->Address2, 'City' => $ret->VerifyAddressResult->City, 'State' => $ret->VerifyAddressResult->State, 'Zip5' => $ret->VerifyAddressResult->Zip5, 'Zip4' => $ret->VerifyAddressResult->Zip4);
         } else {
             if ($errNumber === '97') {
                 //if the address is incorrect, use the original address anyway
                 $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' => '');
             } else {
                 $option = JRequest::getCmd('option', '');
                 $ctrl = JRequest::getCmd('ctrl', '');
                 if ($option == 'com_hikashop' && $ctrl == 'checkout') {
                     $app->enqueueMessage(JText::_('WRONG_SHIPPING_ADDRESS'), 'error');
                 }
             }
         }
     }
     $user_id = $order->order_user_id;
     $cart_items = array();
     $ids = array();
     //getting the ids of the products to get their tics
     foreach ($cart->products as $product) {
         //getting the id of the product to get its tic
         $ids[$product->order_product_id] = (int) $product->product_id;
     }
     $db = JFactory::getDBO();
     if (!empty($ids)) {
         $product_query = 'SELECT product_id, product_taxability_code FROM ' . hikashop_table('product') . ' WHERE product_id IN (' . implode(',', $ids) . ') AND product_access=\'all\' AND product_published=1 AND product_type=\'main\'';
         $db->setQuery($product_query);
         $products = $db->loadObjectList();
     }
     $tics = array();
     if (!empty($products)) {
         foreach ($products as $product) {
             //associating the tics with the right productIDs
             $tics[$product->product_id] = $product->product_taxability_code;
         }
     }
     $i = 0;
     foreach ($cart->products as $product) {
         $tic = (int) $this->plugin_options['default_tic'];
         if ((int) $tics[$ids[$product->order_product_id]] != '-1' && (int) $tics[$ids[$product->order_product_id]] !== '') {
             $tic = (int) $tics[$ids[$product->order_product_id]];
         }
         $cart_items[] = array('Index' => $product->cart_product_id, 'ItemID' => $product->order_product_code, 'TIC' => $tic, 'Price' => $product->order_product_price, 'Qty' => $product->order_product_quantity);
         $id = $product->cart_product_id;
         $i++;
     }
     $j = 0;
     $db = JFactory::getDBO();
     if (!empty($order->order_shipping_params->prices)) {
         foreach ($order->order_shipping_params->prices as $key => $shipping) {
             $id++;
             $order->order_shipping_params->prices[$key]->taxcloud_index = $id;
             $order->order_shipping_params->prices[$key]->taxcloud_itemId = "Shipping" . $j;
             $order->order_shipping_params->prices[$key]->taxcloud_tic = $this->plugin_options['shipping_tic'];
             $order->order_shipping_params->prices[$key]->taxcloud_price = (int) ($shipping->price_with_tax - $shipping->tax);
             $cart_items[] = array('Index' => $id, 'ItemID' => "Shipping" . $j, 'TIC' => $this->plugin_options['shipping_tic'], 'Price' => (int) ($shipping->price_with_tax - $shipping->tax), 'Qty' => '1');
             $j++;
         }
         $product_query = 'UPDATE ' . hikashop_table('order') . ' SET order_shipping_params = ' . $db->Quote(serialize($order->order_shipping_params)) . '  WHERE order_id = ' . (int) $order->order_id;
         $db->setQuery($product_query);
         $db->query();
     }
     $parameters = array('apiLoginID' => $this->plugin_options['api_id'], 'apiKey' => $this->plugin_options['api_key'], 'customerID' => $user_id, 'cartID' => $order->order_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();
     try {
         $soapRet = $this->soap->__soapCall('Lookup', array($parameters));
         $ret = $soapRet->LookupResult;
     } catch (Exception $e) {
         $ret = false;
     }
     if ($this->debug) {
         hikashop_display($ret->ResponseType);
         if ($ret->ResponseType == 'OK') {
             hikashop_display($ret->CartItemsResponse->CartItemResponse);
         } else {
             var_dump($ret);
         }
     }
 }
コード例 #21
0
ファイル: tableform.php プロジェクト: q0821/esportshop
	if(publishedNo){
		published=0;
	}
	document.getElementById('name').value = name;
	document.getElementById('published').value = published;
	<?php 
echo $access2;
?>
	this.hikashop.submitform('apply_table', 'adminForm');
}
</script>
<div id="iframedoc"></div>
<?php 
if ($this->first) {
    echo hikashop_display(JText::_('CONFIGURE_WIDGET_ROW'));
}
?>
<fieldset>
	<div class="toolbar" id="toolbar" style="float: right;">
		<button class="btn" type="button" onclick="submitCurrentForm()"><img src="<?php 
echo HIKASHOP_IMAGES;
?>
save.png"/><?php 
echo JText::_('OK');
?>
</button>
	</div>
</fieldset>
<form action="index.php?option=<?php 
echo HIKASHOP_COMPONENT;